Skip to main content
added 1334 characters in body
Source Link

Below a sample of some first-order differential equations I try to solve. Although there are no non-numerical values involved in the equations, Mathematica systematically spits out "Encountered non-numerical value at $\tau$ == 0".

And I also get the error: "Cannot solve to find an explicit formula for the derivatives. NDSolve
will try solving the system as differential-algebraic equations"... What does that mean exactly and how can I remedy this?

Might the problem lie somewhere else?

Thanks in advance for your help !

eqs = {0 == (1.38 D[r[5/6, 0][\[Tau]], \[Tau]] == -10.18 + 
   9.61 r[5/6, 0][\[Tau]] - 3.1 r[5/6, \[Pi]/4][\[Tau]]), 
  0 == (2.95 (D[r[5/6, \[Pi]/4][\[Tau]], \[Tau]]) == -21.7 + 
   13.8 r[5/6, \[Pi]/4][\[Tau]] + 
   1.66 (r[5/6, 0][\[Tau]] - 1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   1.67 (4.64 .3 r[5/6, \[Pi]/4][\[Tau]]) (r[5/6, 0][\[Tau]] - 
       1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   3.33 (r[5/6, 0][\[Tau]] - 2 r[5/6, \[Pi]/4][\[Tau]] + 
      r[5/6, \[Pi]/2][\[Tau]])), 
  0 == (4.53 (D[r[5/6, \[Pi]/2][\[Tau]], \[Tau]]) == -33.2 - 
   5.10 (2 r[5/6, \[Pi]/4][\[Tau]] - 2 r[5/6, \[Pi]/2][\[Tau]]) + 
   21.14 r[5/6, \[Pi]/2][\[Tau]])};

Unknowns = {r[5/6, 0], r[5/6, \[Pi]/4], r[5/6, \[Pi]/2]};
Unknowns\[Tau] = Unknowns /. r[a_, b_] :> r[a, b][\[Tau]];

Init = Join[Map[(0 == #) &, Unknowns\[Tau] /. \[Tau] -> 0], 
Map[(0 == #) &, D[Unknowns\[Tau], \[Tau]] /. \[Tau] -> 0]];

sols = NDSolve[Flatten[{eqs, Init}], Unknowns, {\[Tau], 1, 3}][[1]];

---------- Edit--------

So the context is that I am trying to solve some differential equation for a function $r(x,y,t)$ that I have discretised on a grid along the x-y direction leaving the time dependence continuous. So I end up with a set of differential equations for t with unknowns the point in my grid. The code above is for a sample of points $r(a,b)$ in this grid (and the corresponding equations.)

$\left\{0=\left(1.38 r\left(\frac{5}{6},0\right)'\tau =9.61 r\left(\frac{5}{6},0\right)\tau -3.1 r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau -10.18\right),0=\left(2.95r\left(\frac{5}{6},\frac{\pi }{4}\right)'\tau =-2.32464r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau \left(r\left(\frac{5}{6},0\right)\tau -1.r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)^2+1.66\left(r\left(\frac{5}{6},0\right)\tau -1.r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)^2+13.8r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau -3.33\left(r\left(\frac{5}{6},0\right)\tau -2r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau +r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)-21.7\right),0=\left(4.53r\left(\frac{5}{6},\frac{\pi }{2}\right)'\tau =-5.1\left(2r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau -2r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)+21.14r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau -33.2\right)\right\}$

Below a sample of some first-order differential equations I try to solve. Although there are no non-numerical values involved in the equations, Mathematica systematically spits out "Encountered non-numerical value at $\tau$ == 0".

And I also get the error: "Cannot solve to find an explicit formula for the derivatives. NDSolve
will try solving the system as differential-algebraic equations"... What does that mean exactly and how can I remedy this?

Might the problem lie somewhere else?

Thanks in advance for your help !

eqs = {0 == (1.38 D[r[5/6, 0][\[Tau]], \[Tau]] == -10.18 + 
   9.61 r[5/6, 0][\[Tau]] - 3.1 r[5/6, \[Pi]/4][\[Tau]]), 
  0 == (2.95 (D[r[5/6, \[Pi]/4][\[Tau]], \[Tau]]) == -21.7 + 
   13.8 r[5/6, \[Pi]/4][\[Tau]] + 
   1.66 (r[5/6, 0][\[Tau]] - 1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   1.67 (4.64 .3 r[5/6, \[Pi]/4][\[Tau]]) (r[5/6, 0][\[Tau]] - 
       1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   3.33 (r[5/6, 0][\[Tau]] - 2 r[5/6, \[Pi]/4][\[Tau]] + 
      r[5/6, \[Pi]/2][\[Tau]])), 
  0 == (4.53 (D[r[5/6, \[Pi]/2][\[Tau]], \[Tau]]) == -33.2 - 
   5.10 (2 r[5/6, \[Pi]/4][\[Tau]] - 2 r[5/6, \[Pi]/2][\[Tau]]) + 
   21.14 r[5/6, \[Pi]/2][\[Tau]])};

Unknowns = {r[5/6, 0], r[5/6, \[Pi]/4], r[5/6, \[Pi]/2]};
Unknowns\[Tau] = Unknowns /. r[a_, b_] :> r[a, b][\[Tau]];

Init = Join[Map[(0 == #) &, Unknowns\[Tau] /. \[Tau] -> 0], 
Map[(0 == #) &, D[Unknowns\[Tau], \[Tau]] /. \[Tau] -> 0]];

sols = NDSolve[Flatten[{eqs, Init}], Unknowns, {\[Tau], 1, 3}][[1]];

Below a sample of some first-order differential equations I try to solve. Although there are no non-numerical values involved in the equations, Mathematica systematically spits out "Encountered non-numerical value at $\tau$ == 0".

And I also get the error: "Cannot solve to find an explicit formula for the derivatives. NDSolve
will try solving the system as differential-algebraic equations"... What does that mean exactly and how can I remedy this?

Might the problem lie somewhere else?

Thanks in advance for your help !

eqs = {0 == (1.38 D[r[5/6, 0][\[Tau]], \[Tau]] == -10.18 + 
   9.61 r[5/6, 0][\[Tau]] - 3.1 r[5/6, \[Pi]/4][\[Tau]]), 
  0 == (2.95 (D[r[5/6, \[Pi]/4][\[Tau]], \[Tau]]) == -21.7 + 
   13.8 r[5/6, \[Pi]/4][\[Tau]] + 
   1.66 (r[5/6, 0][\[Tau]] - 1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   1.67 (4.64 .3 r[5/6, \[Pi]/4][\[Tau]]) (r[5/6, 0][\[Tau]] - 
       1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   3.33 (r[5/6, 0][\[Tau]] - 2 r[5/6, \[Pi]/4][\[Tau]] + 
      r[5/6, \[Pi]/2][\[Tau]])), 
  0 == (4.53 (D[r[5/6, \[Pi]/2][\[Tau]], \[Tau]]) == -33.2 - 
   5.10 (2 r[5/6, \[Pi]/4][\[Tau]] - 2 r[5/6, \[Pi]/2][\[Tau]]) + 
   21.14 r[5/6, \[Pi]/2][\[Tau]])};

Unknowns = {r[5/6, 0], r[5/6, \[Pi]/4], r[5/6, \[Pi]/2]};
Unknowns\[Tau] = Unknowns /. r[a_, b_] :> r[a, b][\[Tau]];

Init = Join[Map[(0 == #) &, Unknowns\[Tau] /. \[Tau] -> 0], 
Map[(0 == #) &, D[Unknowns\[Tau], \[Tau]] /. \[Tau] -> 0]];

sols = NDSolve[Flatten[{eqs, Init}], Unknowns, {\[Tau], 1, 3}][[1]];

---------- Edit--------

So the context is that I am trying to solve some differential equation for a function $r(x,y,t)$ that I have discretised on a grid along the x-y direction leaving the time dependence continuous. So I end up with a set of differential equations for t with unknowns the point in my grid. The code above is for a sample of points $r(a,b)$ in this grid (and the corresponding equations.)

$\left\{0=\left(1.38 r\left(\frac{5}{6},0\right)'\tau =9.61 r\left(\frac{5}{6},0\right)\tau -3.1 r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau -10.18\right),0=\left(2.95r\left(\frac{5}{6},\frac{\pi }{4}\right)'\tau =-2.32464r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau \left(r\left(\frac{5}{6},0\right)\tau -1.r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)^2+1.66\left(r\left(\frac{5}{6},0\right)\tau -1.r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)^2+13.8r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau -3.33\left(r\left(\frac{5}{6},0\right)\tau -2r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau +r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)-21.7\right),0=\left(4.53r\left(\frac{5}{6},\frac{\pi }{2}\right)'\tau =-5.1\left(2r\left(\frac{5}{6},\frac{\pi }{4}\right)\tau -2r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau \right)+21.14r\left(\frac{5}{6},\frac{\pi }{2}\right)\tau -33.2\right)\right\}$

Source Link

NDSolve Encountered non-numerical value

Below a sample of some first-order differential equations I try to solve. Although there are no non-numerical values involved in the equations, Mathematica systematically spits out "Encountered non-numerical value at $\tau$ == 0".

And I also get the error: "Cannot solve to find an explicit formula for the derivatives. NDSolve
will try solving the system as differential-algebraic equations"... What does that mean exactly and how can I remedy this?

Might the problem lie somewhere else?

Thanks in advance for your help !

eqs = {0 == (1.38 D[r[5/6, 0][\[Tau]], \[Tau]] == -10.18 + 
   9.61 r[5/6, 0][\[Tau]] - 3.1 r[5/6, \[Pi]/4][\[Tau]]), 
  0 == (2.95 (D[r[5/6, \[Pi]/4][\[Tau]], \[Tau]]) == -21.7 + 
   13.8 r[5/6, \[Pi]/4][\[Tau]] + 
   1.66 (r[5/6, 0][\[Tau]] - 1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   1.67 (4.64 .3 r[5/6, \[Pi]/4][\[Tau]]) (r[5/6, 0][\[Tau]] - 
       1. r[5/6, \[Pi]/2][\[Tau]])^2 - 
   3.33 (r[5/6, 0][\[Tau]] - 2 r[5/6, \[Pi]/4][\[Tau]] + 
      r[5/6, \[Pi]/2][\[Tau]])), 
  0 == (4.53 (D[r[5/6, \[Pi]/2][\[Tau]], \[Tau]]) == -33.2 - 
   5.10 (2 r[5/6, \[Pi]/4][\[Tau]] - 2 r[5/6, \[Pi]/2][\[Tau]]) + 
   21.14 r[5/6, \[Pi]/2][\[Tau]])};

Unknowns = {r[5/6, 0], r[5/6, \[Pi]/4], r[5/6, \[Pi]/2]};
Unknowns\[Tau] = Unknowns /. r[a_, b_] :> r[a, b][\[Tau]];

Init = Join[Map[(0 == #) &, Unknowns\[Tau] /. \[Tau] -> 0], 
Map[(0 == #) &, D[Unknowns\[Tau], \[Tau]] /. \[Tau] -> 0]];

sols = NDSolve[Flatten[{eqs, Init}], Unknowns, {\[Tau], 1, 3}][[1]];