Problem with NDSOLVE in Mathematica

  • Context: Mathematica 
  • Thread starter Thread starter nikolafmf
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around issues encountered while using the NDSolve function in Mathematica, specifically regarding the specification of dependent variables and initial conditions in differential equations. The scope includes technical explanations and problem-solving related to computational methods in mathematics.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports an error message from Mathematica indicating that a function was specified without dependence on all independent variables, despite the function x being defined only in terms of t.
  • Another participant suggests a modified NDSolve command that resolves the initial issue, indicating that the problem may have been related to the original formulation of the equations.
  • A different participant raises a concern regarding a similar error encountered with a system involving four variables, where Mathematica indicates that initial values computed lead to a zero residual but differ from specified conditions, prompting a question about the cause and potential solutions.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the underlying causes of the errors reported, as different issues are raised in relation to the use of NDSolve with varying numbers of dependent variables.

Contextual Notes

Limitations include the potential need for initial conditions for all dependent variables and their derivatives, which may not have been adequately specified in the problematic cases.

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
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 0 ·
Replies
0
Views
1K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K