0
$\begingroup$

I'm getting one those annoying 'NDSolve::deqn: List of equations is expected instead of True' errors. I have done everything I can think of to Remove and Clear all variables, including restarting Mathematica and restarting my computer. I also tried renaming the variable r as rr. The error message is specific to the third equation in the list.

Here is the entire contents of the notebook:

Remove["Global`*"];
NDSolve[{w == c*(i1 - 3),
i1 == rr'[\[Rho]]^2 + rr[\[Rho]]^2/\[Rho]^2 + \[Rho]^2/(rr'[\[Rho]]^2*rr[\[Rho]]^2),    
\[Rho]*D[w, rr[\[Rho]]] - D[\[Rho]*D[w, rr'[\[Rho]]], \[Rho]] == 0,
rr[0] == 0,
rr[8] == 10},
rr, \[Rho], 
Method -> {"Shooting","StartingInitialConditions" -> 
{rr[0] == 0, rr'[0]  == 10/8}}] 
$\endgroup$
  • 1
    $\begingroup$ For some answers, search the site for the message name: mathematica.stackexchange.com/search?q=deqn $\endgroup$ – Michael E2 Jan 18 '16 at 19:24
  • $\begingroup$ In this case, try calculating D[w, rr[\[Rho]]] and see what you get. Likewise for D[w, rr'[\[Rho]]]. -- Another tip: The True in the message is the 3rd element of the list. Therefore the third equation is messing you up. $\endgroup$ – Michael E2 Jan 18 '16 at 19:27
  • $\begingroup$ Another observation: The variables w, c, and i1 are written as if they are parameters (not functions of ρ, for example). They must be given numeric values for NDSolve to work. OTOH, you're differentiating w which suggests it is not a constant, but some sort of function. If so, it needs to be a function of the independent variable ρ. Finally ρ needs to be given an interval of integration. (NDSolve is a numerical integrator, DSolve is the symbolic solver.) $\endgroup$ – Michael E2 Jan 18 '16 at 19:34
  • $\begingroup$ Thanks for your input Michael E2. I tried evaluating terms in the third equation as you suggested. Both terms are 0. So the equation is trivial, 0-0==0. Next problem: how to fix that? w is a function of i1 which is a function of rho but perhaps I am not communicating this relationship sufficiently to Mathematica? $\endgroup$ – Dessie Jan 18 '16 at 19:53
  • $\begingroup$ That's right, you haven't defined w etc. quite right. Now I see what you're after. You could, outside of NDSolve, define w = c*(i1 - 3), with a single =. Ditto for i1 = .... Well, that's a start, but you'll have to fix the derivatives....let me see. $\endgroup$ – Michael E2 Jan 18 '16 at 19:59
1
$\begingroup$

Comment, trying to understand the set up:

Does this look right at all? I used symbols r and rp to denote rr[ρ] and its derivative

Clear[r, rp, w, i1];
w[ρ_, r_, rp_] := c*(i1[ρ, r, rp] - 3);
i1[ρ_, r_, rp_] := rp^2 + r^2/ρ^2 + ρ^2/(rp^2*r^2)

ρ*D[w[ρ, r, rp], r] - D[ρ*D[w[ρ, r, rp], rp] /. {r -> rr[ρ], rp -> rr'[ρ]}, ρ] == 0 /.
   {r -> rr[ρ], rp -> rr'[ρ]}
(*
c ρ ((2 rr[ρ])/ρ^2 - (2 ρ^2)/(rr[ρ]^3 Derivative[1][rr][ρ]^2)) - 
  c (-((2 ρ^2)/(rr[ρ]^2 Derivative[1][rr][ρ]^3)) + 2 Derivative[1][rr][ρ]) - 
  c ρ (-((4 ρ)/(rr[ρ]^2 Derivative[1][rr][ρ]^3)) +
       (4 ρ^2)/(rr[ρ]^3 Derivative[1][rr][ρ]^2) + 
       2 rr''[ρ] + (6 ρ^2 rr''[ρ])/(rr[ρ]^2 Derivative[1][rr][ρ]^4)) == 0
*)
$\endgroup$
  • $\begingroup$ Yes this was the problem. I am new to Mathematica and I am still struggling with when to use assignments vs. equations vs. functions. In this case, the correct approach was to use functions to express the relationships and that was the key to getting rid of the error. $\endgroup$ – Dessie Jan 19 '16 at 13:58
  • $\begingroup$ @Dessie Quite right. It is easier in Mathematica to deal with calculus in terms of functions and f'[x] than in terms of algebra and Leibniz' notation $df/dx$. $\endgroup$ – Michael E2 Jan 19 '16 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.