Mathematica Problem with NDSOLVE in Mathematica

  • Thread starter Thread starter nikolafmf
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
The discussion revolves around issues encountered while using Mathematica's NDSolve function for solving differential equations. Initially, a warning is received indicating that the function x[t] lacks dependence on all independent variables, despite x being defined solely in terms of t. A solution was provided that successfully resolved the issue for a simpler system of equations. However, when attempting to apply NDSolve to a more complex system involving four variables, a new warning arises. This warning states that initial values computed by NDSolve yield a zero residual for the differential-algebraic system, but some components differ from specified values. The discussion seeks to identify the underlying cause of this discrepancy and suggests that specifying initial conditions for all dependent variables and their derivatives may help avoid such issues in the future.
nikolafmf
Messages
112
Reaction score
0
Mathematica says:

"NDSolve::alliv: "The function x[t] was specified without dependence on all the independent variables. Each function must depend on all the independent variables.""

But function x depends only on t, there is no other variable specified in the code.

What could be the problem? I attach .nb file below.
 

Attachments

Physics news on Phys.org
Hi

Try this:

Code:
NDSolve[{
  y'[t] == -y[t], 
  x'[t] == x[t] + y[t],
  x[0] == 0, y[0] == 1},
 {x, y}, {t, 0, 1},
 Method -> "ExplicitMidpoint", "StartingStepSize" -> 1/10]
 
It works. Thank you very much :)
 
But for similar system with four variables Mathematica says this:

"NDSolve has computed initial values that give a zero residual for the \
differential-algebraic system, but some components are different from \
those specified. If you need them to be satisfied, it is recommended \
that you give initial conditions for all dependent variables and \
their derivatives."

What could be the cause of this and how to avoid it?
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
885
  • · Replies 0 ·
Replies
0
Views
825
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K