• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Maths, just get me the x :d

Status
Not open for further replies.
Level 9
Joined
Dec 21, 2006
Messages
490
hi there

anyone able to get me the x out of this:

0 = (g*m /q² ) * (ln(m*v*cos (b) - q*x) - ln(m*v*cos(b))) + (x * sin b +(g * m * x ) / (q* v)) / cos b

it's a formula for ballistics
m = mass
q= air drag
v = starting speed
b = angle
g = 9.81

i suck at maths, can't get the x out of the ln
rep. for correct answer

x = ...

added the close bracket
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
You should probably start with the diferential equation to do that easilly instead of the general solution...

Well ill give it a shot.
Sorry but you left out a close bracket so I can not garuntee a correct solution (you need to fix the equation before it can be solved correctly).

Once again, I advise giving the differential equations as well as they can be useful for such rearangements.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
Muhahahahaaa, the mathimatics to solve for x requires the omega (W) function. This I believe is not nativly in SC2 so will need to be implimented. This is due to the soltuion involving xe^x (which the omega function is capable of unwinding).

Behold the power of mathimatica (an engineers best friend)

As you can see, that is one hellishly complex solution... Although most of it is easy to do, the omega function I believe is not nativly in SC2 so you will need to use university level mathimatics (or a guide) to code some function to solve an appoximation of omega for certain values. Sec is an inverse trigometric function (1/cos).

Good luck implimetning it into SC2.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
Looking at the forumla, he wants to calculate the distance a projectile will travel if fired at certain conditions on a plane.

There are 2 problems with this...
1. The general solution is for one of the initial fireing conditions and not the distance traveled, thus you have an xe^x which requires omega to find x. This is probably because you pretend the target height is the same as the firing height (equal roots in the assisting equation).
2. This does not take into account that the terrain is not flat. The projectile might collide with a hill sooner or travel further if fired from a hill over a plain in reality ingame (unless your map terrain is very boring).

Air drag is a major source of complexity in the equation, as mentioned eariler that if you ignore it the general solution will be much simpler.
 
Level 9
Joined
Dec 21, 2006
Messages
490
i found another solution that splits up the formula into X-vector and y-vector of t . set y to 0 and get the t. put it into the x vector thing and finished. then i * (-1/2025 * (Angledegrees-45)² +1). the last formula is to get a more realistic value. the longest distance is now reached at 35° which (quote google) complies to reality.

i am working on a TANK WARZ like map, just in 3D.
distance depends on:
a) mass
b) air drag ( which will actually change due to wheater)
c) angle
d) power
e) 9.81 which will actually not change

the y0 to y1 will be ignored since this affects the distance not that hard and yes i will add hills etc which will block the different projectiles (normal explo,nuke, etc).
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
35 degrees? I don't know about the effect of air drag, but I am pretty sure it should be 45 without air drag for maximum distance.

EDIT: Proof
verticalSpeed = startSpeed * Sin a
horizontalSpeed = startSpeed * Cos a
timeInAir = 2*vericalSpeed/g
distance = horizontalSpeed * timeInAir
alltogether: distance = startSpeed * Sin a * startSpeed * Cos a * 2 /g
So the formula, dependand on angle, is something* Sin * Cos, and Sin * Cos has highest value for 45 edgrees
 
Level 10
Joined
Nov 28, 2008
Messages
655
Air resistance makes everything 10000000 times more complicated.

Just make it a flat frictional force, and be happy with it.

I promise, no one will be able to tell.


I would also recommend actually learning some physics...

You found an equation that happens to break up the forces in to x and y to find t?
That is 10 minutes into physics 1 bro.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
So is this solved? Your last post was a bit confusing...

Anyway, You must remember that both X and Y are important as elevation can increase the distance of a projectiles path.

Air resistance is nothing easy. Yes it can be simplified into a drag factor but that is just part of it. It involves the velocity of the bullet (which is a function in this case as it varies with time) and the density of the air as well as some equation to cover the interaction between the bullet and the air. Yes if you are studying aeronatucil engineering or physics at university you may find this sort of problem easy but a simple highschool physics degree is not enough to understand this.
 
Level 9
Joined
Dec 21, 2006
Messages
490
yes, it is solved, at least for me. have all variables i need to have. (solving differential equation isn't that easy in the first place.....)
thx to all ppl trying to help

i ignored the elevation because the distance doesn't change that much( only in special cases). for all special things like hills etc i already found a trigger solution that checks the angle. so the projectile will hit the hill and not behind it.
 
Status
Not open for further replies.
Top