Equation that integrates previous y-value.

  • Context: Undergrad 
  • Thread starter Thread starter Pharrahnox
  • Start date Start date
Click For Summary
SUMMARY

The discussion centers on deriving an equation to calculate the maximum velocity of a ship in a game using modified physics equations. The thrust is calculated as thrust = ((p*r)^0.5)*10, with constants p = 3.33x10^5 and r = 0.04. Friction is defined as friction = f*v*a, where f = 500, v is velocity, and a = 1.5. The final equation for velocity over time is v(t) = (c/k)(1 - e^(-kt)), where c = t/m and k = fa/m, indicating that the maximum speed approaches c/k as time increases.

PREREQUISITES
  • Understanding of basic physics concepts such as thrust and friction
  • Familiarity with differential equations and their applications
  • Knowledge of exponential functions and their graphical representations
  • Basic programming skills for implementing equations in a game environment
NEXT STEPS
  • Study differential equations, particularly the exponential growth and decay models
  • Learn how to implement physics equations in game development using a programming language like Python or C#
  • Research numerical methods for solving differential equations in computational simulations
  • Explore graphing techniques for visualizing equations and their behavior over time
USEFUL FOR

Game developers, physics enthusiasts, and students studying dynamics who are interested in implementing physics-based motion in simulations or games.

Pharrahnox
Messages
106
Reaction score
0
I am making a game that has some sort of physics equations, although heavily modified to make it work better. I am trying to find the maximum velocity of a ship according to these rules/steps:

thrust = ((p*r)^0.5)*10

-where r is a constant (0.04) and p is the power (3.33x10^5 in this case)

friction = f*v*a

-where f is another constant (500), v is the velocity, and a is yet another constant (1.5 in this case)

force = t-friction
acceleration = force/mass (mass = 1403.14)
velocity += acceleration

Ok, so there are several steps involved to find the velocity, but I am trying to make an equation that can show the velocity at any point in time, assuming you are accelerating the whole time. This equation would also give me the maximum velocity.

The problem I am having is that the equation would involve the previous y value, and I don't know how to put that into an equation.

Somthing like y = y_previous + (107.457 - (750 * y_previous) / mass)

Thanks for any help.
 
Mathematics news on Phys.org
Where the change in y depends on the previous value of y, the equivalent continuous equations is:
$$\frac{dy}{dt}=ky$$ ... where k is a constant.

The solution is an exponential.
 
I have done a bit of research, and this appears to be a differential equation, of which I have no understanding of, and staring at the weird equations doesn't seem to help...

The dy/dt bit that you have there, how can I apply to my equation? I get what it means, that the change in y with respect to the change in time is equal to the y value multiplied by a constant, yet I don't know how to use that.
 
For a computer $$\frac{dy}{dt}\approx \frac{\Delta y}{\Delta t}$$ where ##\Delta t## is your time-step.

Your acceleration number is your ##\Delta v##

##v_{n+1}=v_n+\Delta v##

Putting your equations together: $$\Delta v = \frac{1}{m}\left( t-fav_n \right) = c+kv$$... where c=t/m and k=fa/m are constants.

http://mathinsight.org/from_discrete_to_continuous_dynamical_systems
 
Is it c + kv or c - kv? Because c + kv would mean the friction adds to the acceleration.

As for the link, I can't view the videos at the moment, my internet is really slow right now.

So with the equation you have there, where do you go from there? How do you put that into a graph, because it is still pretty much in the form of v = vn-1+Δv?
 
from what I put - yeah. cut and paste error :)
off the first line, k=-fa/m but it is probably clearer to make k positive for fa positive.
Thus c-kv.

Trying to find a tutorial page that does not use video:
http://mathinsight.org/thread/elementary_dynamical_systems

I'd write $$\frac{dv}{dt} = c-kv$$ ... and solve the differential equation.

$$v(t) = \frac{c}{k}+v_0e^{-kt}$$ ... ##v_0=v(t=0)##.

Plot that and you see it tends towards the value c/k as time gets very big. So that is your top speed.

You need to learn how to do this - getting other people to do it usually costs money.
 
Ok thanks for your help. When you plot that, do you mean that that is the equation I can use for the graph, or that I have to find each individual value by plugging it into the formula? In this case, would v0 = 0, because it starts from rest? Then that would make the equation just v(t) = c/k.
 
There's something missing isn't there?
... as long as t>fav, which is the case for v=0, there should be motion
... I think I put the brackets in the wrong place.
Good thing I'm not charging you :)

[edit:]Checked the math...

The actual equation should have been:

$$v(t)=\frac{c}{k}\big(1-e^{-kt}\big)$$

The discrete form gives $$v_n = \frac{c}{k}\big(1-e^{-nk\Delta t}\big):n=0,1,2,\cdots$$ ... for constant time interval Δt.

By "plot that" I just mean make a graph of the equation.

Aside:
since you only have acceleration as long as (t-fav)>0, that means that when v=t/fa, the acceleration stops.
therefore v=t/fa is the final speed.

from the continuous equation:
c=t/m, and k=fa/m so c/k = t/fa is the final speed ... in agreement with your model.
 
Last edited:
  • Like
Likes   Reactions: 1 person
Thankyou so much, this is just what I wanted. It might be a while before I get to the stage of understanding how to get to that point, but I'll learn eventually. I'll continue to research and I'll ask my teachers, but unfortunately they don't offer Specialist Maths at my school... Anyway, this is great. Thanks again.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 97 ·
4
Replies
97
Views
6K
  • · Replies 37 ·
2
Replies
37
Views
2K
Replies
3
Views
1K