Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
I have been using Odesolve successfully for a system of equations. But when I make (to me a seemingly innocuous) change, adding a term (that is zero in this case), I get the error "This value must be a function but has the form: any1". What I am doing wrong?
Solved! Go to Solution.
I think you need to do it as in the attached (note, I've redone your first solve block in such a way as to help with the second one).
Alan
John Rudnicki wrote:
I have been using Odesolve successfully for a system of equations. But when I make (to me a seemingly innocuous) change, adding a term (that is zero in this case), I get the error "This value must be a function but has the form: any1". What I am doing wrong?
You've added another derivative (dv(t)/dt) without a relational / initialization equation, hence you've got more derivatives to solve for than you've got equations; the fact you've multiplied it by zero doesn't make any difference ... It Knows!
Stuart
Sorry if I am being dense, but dont I still have four equations for v, tau, phi and theta, with four initial conditions? If I differentiated the 4th equation, for tau, (I was trying to avoid this), dv(t)/dt would enter that way even without the adding it in the first equation.
JohnRudnicki wrote:
Sorry if I am being dense, but dont I still have four equations for v, tau, phi and theta, with four initial conditions? If I differentiated the 4th equation, for tau, (I was trying to avoid this), dv(t)/dt would enter that way even without the adding it in the first equation.
Attached is an example of what I meant by the second sentence. To me it seems the two systems are mathematically the same. If so, I do not understand why MC interprets them differently.
John Rudnicki wrote:
JohnRudnicki wrote:
Sorry if I am being dense, but dont I still have four equations for v, tau, phi and theta, with four initial conditions? If I differentiated the 4th equation, for tau, (I was trying to avoid this), dv(t)/dt would enter that way even without the adding it in the first equation.
Attached is an example of what I meant by the second sentence. To me it seems the two systems are mathematically the same. If so, I do not understand why MC interprets them differently.
I'm not sure, because I rarely deal with algebraic constraints, but I think that in your original equation you effectively had v(t) as an algebraic constraint, hence why you had to include it in ODESolve's output. When you introduced the derivative, you still didn't have an explicit statement giving dv(t)/dt as a function of the other variables (not including their derivatives), hence Mathcad squawking about undefined variables (insufficient equations in Prime). By solving for dv(t)/dt, you've reduced the problem to an ordinary system of DEs, which ODESolve can handle.
Stuart
I think you need to do it as in the attached (note, I've redone your first solve block in such a way as to help with the second one).
Alan
Thanks. So basically, I needed to turn the constraint tau = ... into an ode for v(t). This is what I did in the 2nd worksheet I posted but I like yours better.
Sorry, I should have looked at your second worksheet first, but didn't! In fact you have expressed the equations more succinctly than I did. However, for some reason, in your second sheet, in the equation for dphi/dt you replaced the v(t)/vratio of your first sheet with ln(v(t)/vratio). This might have led to a mix-up that explains why your two approaches in the second worksheet don't result in graphs that lie on top of each other.
Alan
Thanks. It should be ln ((v(t)/v0). I corrected it in one place but not the other. But the difference in the two graphs is due to the term in eta. With eta = 0 they do coincide (at least on the graph). Eta should damp the system in a case where tau becomes unbounded, which it should for certain combinations of a, b, and khat (but I havent tried this yet).