   Differential equation problem
  I came across this physics example yesterday that set the velocity of a hovering object to be dependant on the actual position of the object, i.e. a differential equation being dependant on its integral.the equation was something like this:dy/dt = 50 / ywhere y equals the actual position of the object. So its supposed to shoot up and then slow down a bit when it reaches a certain height. The problem I had trying to model this is that the position starts at 0 so the rate of change initially is infinite. e.g.void Object::Update(float timeStep){float vel = 50.0f / this->posy;posy += vel * timeStep;}In this first update the vel is infinite therefore the position will be infinite by the next frame. If i set y to a small value then this problem is solved. I understand that in the real world you wouldn't get fixed integration time steps like this so as soon as y is greater than 0 the rate of change is not infinite and therefore the object will start to slow down but if i'm updating the object every 0.02 seconds or any timeStep > 0 then on the second frame the position will be infinite. Is there any way to model this so as the position can equal 0?   
  You have a differential equation of the form,dx/dt = f(x)where f is not Lipschitz.  Therefore Picard's theorem (existence and uniqueness of solutions to ODEs) does not hold.  In other words, there may be multiple different trajectories all of which satisfy that ode and initial condition.  Freaky, eh?I may be able to come up with multiple solutions even to yours...Anyway, ignoring all of this, one way around this problem is to use an implicit ODE simulator.  For instance, solve the equation,[y(t + dt) - y(t)]/dt = 50/[(y(t) + y(t + dt))/2]for y(t + dt), at every timestep, using e.g. Newton's method.  Of course, given the caveats about Picard's Theorem not holding, you might nevertheless want to be wary of any solutions you get.   ;  I think reality doesn't really allow for infinite speeds (something about the speed of light in vacuum and a finite amount of energy being available in the universe...). So perhaps you should start with a more reasonable equation.The analytical solution to your differential equation is very easy:dy/dt = 50/y => y*dy = 50*dt => y^2/2 = 50*t + C => y = sqrt(100*t + C)If you are at y=0 when t=0, it means that C=0, so you finally havey = 10*sqrt(t);  Thanks for the replies.   ;Quote:Original post by alvaroThe analytical solution to your differential equation is very easy[. ...] you finally havey = 10*sqrt(t)There are more solutions than just this!  Here is another:y = -10*sqrt(t)You can verify by differentiating.  I may have seen this problem before; IIRC it has other solutions besides even just these two...   ;  Hmmm... I doubt there are other solutions. But I would love to see them if they exist!   ;Quote:Original post by alvaroHmmm... I doubt there are other solutions. But I would love to see them if they exist!I can't think of any more, but I did dig out my Analysis book to find the example problems I was remembering.  Turns out they're not the same as staticVoid2's.If you're interested, they were (using problem numbering from the book),7.  y' = 3 abs(y)^(2/3)8.  y' = 2 sqrt(abs(y)) , y(0) = 0(from Introduction to Analysis by Maxwell Rosenlicht, at the end of the chapter on the fixed point theorem and friends).   ;Quote:Original post by EmergentIf you're interested, they were (using problem numbering from the book),7.  y' = 3 abs(y)^(2/3)8.  y' = 2 sqrt(abs(y)) , y(0) = 0Oh, those examples are nastier.I managed to convince myself that dy/dt=50/y only has the solutions we talked about. You can think of it as y*dy-50*dt=0 and then it's perfectly smooth and unique solution is guaranteed (as a curve in the t-y plane, not as an explicit function y(t)).;Quote:Original post by alvaroYou can think of it as y*dy-50*dt=0 and then it's perfectly smooth and unique solution is guaranteed (as a curve in the t-y plane, not as an explicit function y(t)).Is this a PDE result?  I only know PDEs at a "I took Calc III a long time ago and paid attention" level, not a "I took a grad course and know them formally" level.  I wasn't aware of any general existence-and-uniqueness theorems.  Is this a special case for which one exists or something?And... When you write this, are dy and dt meant to be differential forms?  I want to take the dual isomorphism of both sides to write something likey (d/dy) - 50 (d/dt) = 0so I can think of it as a PDE in the usual way, but it's about at this point that I get confused. :-)   ;  Yes, dy and dt are differential forms, and so is y*dy-50*dt. I did study these things formally in grad school, but this was over 10 years ago, so I'm not sure I can give you all the details. There is a theorem that says that every point in which a differential form is not 0 has a neighborhood where you can pick coordinates x and y such that the differential form in those coordinates is expressed as dx=0. That guarantees that the whole neighborhood is nicely divided into curves that are solutions of the differential equation. These curves are called "leaves", and the differential form locally describes something called a "foliation".Things break down when you find singularities (points where the differential form is 0) or if your differential form is not continuous enough (perhaps it has to be C2, which implies Lipschitz continuity). The differential form y*dy-50*dt is analytical (about as continuous as you can hope for) and never 0, so every point should be well behaved.   