Mathematics - Functions

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
You might want to put down other things that can be used in the WE too... like some formulas. :)

I am working on a jumping system using some formulas in physics, and they're helping out a lot.

EX:

A = Acceleration
Vi = Initial Velocity
T = Time
ΔX = Displacement/Distance
ΔX = 1/2A(T^2) + ViT

I'm using variables that automatically increase, and change it.

This way, I can just imput a few numbers, like the unit's max height, and how long it jumps for, and it will automatically calculate all the other variables, and I can set the Formula as what the Flying height will be changed too. (Rather than tons of If-Then-Else's).
 
C

Capt Griffen

Guest
Reals are floating point values, with 32 bits, I believe. As such trying to pin down an exact level of precision is pointless, and downright wrong.
 

Jazradel

Helping people do more by doing less.
Reaction score
102
This is how blizzard defines certain values:
constant real bj_PI = 3.14159
constant real bj_E = 2.71828
constant real bj_RADTODEG = 180.0/bj_PI
constant real bj_DEGTORAD = bj_PI/180.0
 
G

Greenspawn

Guest
here's a neat little tip to get around the square root problem.

sqrt(x^(2/n)) where x is the base number and n is the root of the number you want. For example:

3rd root(8) = 2

sqrt(8^(2/3) = 8^((2/3)/2) = 8^(1/3) = 3rd root(8) = 2

this'll allow for you to calculate 3rd roots, 4th roots, 152nd roots, and any other roots.

~Greenspawn
 

Corleone

New Member
Reaction score
44
Nice tutorial. +rep

a) pi≈3.1415926536 (Believe me or not, but I didn't look it up anywhere, I just remember it to the 10th digit The most accurate(if I remember correctly) is 22/7

Believe it or not, I know the first 108 digits:p
 

Void

New Member
Reaction score
16
Er....

W T F ?
My noobish brain doesnt comprehendo all of this stuff... :nuts:
Give me a taco dammit!!!
 

martix

There is no spoon
Reaction score
49
So lets see how this thing is doing. Been a long time since I wrote this. I wonder if it opened the minds of a few people as to what you can do with the instrumentarium provided here.
I just did a minor edit, added a few examples and links to useful stuff.
 

3ICE

Cool Member
Reaction score
3
Re: whatever :D

A quick review:

Poke button:
4. Math - Random Percentage *(Real-ONLY)
Returns a REAL value between 0 and 100 to be used as a percentage(nothing more to say I guess).
should be
4. Math - Random Percentage *(Real-ONLY)
Returns a REAL value between 0.00 and 1.00 to be used as a percentage(nothing more to say I guess).

5. Math - Min
This is used to compare 2 numbers and give the lesser one. The position doesn't matter. It always involves at least variable(or you banged your head and don't know if 1 is bigger than 2)
Example: Min(5,2) would return 2 as it is lesser than 5.
should be
5. Math - Min
This is used to compare 2 numbers and give the lesser one. The position doesn't matter. It always involves at least variable(or you banged your head and don't know if 1 is bigger than 2)
Example: Min(5,2) would return 2 as it is less than 5.

9. Math - Modulo
Calculates the remainder of a devision.(That would be enough for me, but who knows what people are out there).
It gives you what is left behind when the division reaches the decimal point. Divisions that return a whole number do not have a remainder.
This is a very useful, yet underused function. It can be used for ex. when going from one numeric system to another(decimal->hex->octal).
should be
9. Math - Modulo
Calculates the remainder of a division.(That would be enough for me, but who knows what people are out there).
It gives you what is left behind when the division reaches the decimal point. Divisions that return a whole number do not have a remainder.
This is a very useful, yet underused function. It can be used for ex. when going from one numeric system to another(decimal->hex->octal).

These are pretty much all the algebraic functions, now comes Trigonometry(the advanced stuff).
Some notes - using the arithmetic function you can actually get past the 2 digit decimal limitation when using predefined numbers(ones you typed yourself, not changeable). For example - 943.89/100=9.4389 - thats how you can simulate a more accurate number.
should be
These are pretty much all the algebraic functions, now comes Trigonometry(the advanced stuff).
Some notes - using the arithmetic function you can actually get past the 2 digit decimal limitation when using predefined numbers(ones you typed yourself, not changeable). For example - 943.89/100=9.4389 - thats how you can simulate a more accurate number. (Or you can convert the trigger into JASS and have as many decimals as you want!)

3. Conversions - Convert degrees to radians and vise versa. To understand these, you gotta understand both definitions.
Degrees - Any positive real number between 0 and 360
Radian - One radian is the angle of an arc created by wrapping the radius of a circle around its circumference. The radius 'r' fits around the circumference of a circle exactly 2p times. That is why the circumference of a circle is given by circumference = 2pi*r. So there are 2pi radians in a complete circle, and pi radians in a half circle. Degrees=Radians*180/pi
should be
3. Conversions - Convert degrees to radians and vice versa. To understand these, you gotta understand both definitions.
Degrees - Any positive real number between 0.00 and 360.00
Radian - One radian is the angle of an arc created by wrapping the radius of a circle around its circumference. The radius 'r' fits around the circumference of a circle exactly 2pi times. That is why the circumference of a circle is given by circumference = 2pi*r. So there are 2pi radians in a complete circle, and pi radians in a half circle. Degrees=Radians*180/pi

+rep

I learnt a new thing too! THX for the Modulo :D
Now i can finally
finish my extended
gold storage and
management system
that uses lumber for
100k gold (like in HLW)​
 

CaptDeath

New Member
Reaction score
103
i wondered what all those math functions were and now i understand even though i just skimmed it was good smileys alot?
 

Sk8-tEr

New Member
Reaction score
5
I've never used sin or any such things and I have no idea how you would use the square root... Is your example map using all these math functions or whatever almost done?
It would help a lot. I think this tutorial is really only for advanced map makers who need recap without some examples of triggers.
 

UndeadDragon

Super Moderator
Reaction score
447
If you have never used sin, or square root before, I would encourage you to do some advanced maths before attempting to use them, unless you are following a tutorial. Not that anything bad will happen, but it will just help you understand what you are doing better.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top