NDSolve Quirkiness - Updating the initial conditions after each step?

In summary: It's important to verify the correctness of the solution and use the method that gives you the most accurate and expected result.
  • #1
tqbrowne
1
0
I'm modeling a physical system described by a second-order ODE with LOTS of parameters.

Using SciLab, I sucessfully implimented the model using a while loop with time. Because of the loop structure, every time I called the DE solver (ode), I updated the intial conditions for the current solution with the output from the previous iteration of ode. For example, my original initial conditions, theta[0] = 0 and theta'[0] = 0, would be updated with the solution after the first step.

Now, due to the usefulness (and downright awesomeness) of the Manipulate function, I would like to achieve the same setup in Mathematica. In the process of checking the continuity between Mathematica and SciLab, I ran the ode solver in SciLab without the loop and simply using the original initial conditions. The problem I'm having in both Mathematica and SciLab is that, without updating the intial conditions after each iteration, both solvers fail to return the values that I achieved in Scilab with the loop.

Normally, I would be inclined to trust the solution found without updating the intial conditions. However, I have verified the correctness of the SciLab-looped solution with an analytic solution. The SciLab-looped numerical solution does exactly what I would expect, it converges on the analytic steady-state solution in a predictable fashion.

Should I write a loop in mathematica that updates the initial conditions for NDSolve or is it as simple as changing the solution method?
 
Physics news on Phys.org
  • #2
Any advice would be greatly appreciated. I think the best option is to use a loop to update the initial conditions for NDSolve, as this will give you the same behavior as the SciLab-looped solution. You could also try changing the solution method, but it may not produce the same result as the SciLab loop.
 

Related to NDSolve Quirkiness - Updating the initial conditions after each step?

1. What is NDSolve Quirkiness?

NDSolve Quirkiness is a feature of the NDSolve function in the Wolfram Language that allows for the updating of initial conditions after each step in the numerical solution of a differential equation.

2. Why would I want to update initial conditions after each step?

Updating initial conditions after each step can be useful in situations where the initial conditions are dependent on the solution of the differential equation. This allows for a more accurate and efficient solution of the equation.

3. How does NDSolve Quirkiness work?

NDSolve Quirkiness works by using a method known as the "shooting method", where the initial conditions are updated after each step based on the value of the solution at that step. This process continues until a desired level of accuracy is achieved.

4. Are there any limitations to using NDSolve Quirkiness?

While NDSolve Quirkiness can be a useful tool in solving certain types of differential equations, it may not be appropriate for all situations. It is important to consider the specific equation and initial conditions before deciding to use this feature.

5. Can NDSolve Quirkiness be used with any type of differential equation?

NDSolve Quirkiness can be used with many types of differential equations, including ordinary differential equations, partial differential equations, and delay differential equations. However, it is important to carefully consider the specific equation and initial conditions before using this feature, as it may not be appropriate in all cases.

Similar threads

Replies
7
Views
2K
  • Differential Equations
Replies
1
Views
6K
  • Advanced Physics Homework Help
Replies
7
Views
1K
Replies
1
Views
1K
  • Differential Equations
Replies
3
Views
2K
Replies
2
Views
4K
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
  • Differential Equations
Replies
1
Views
2K
  • Differential Equations
Replies
5
Views
6K
  • Differential Equations
Replies
8
Views
2K
Back
Top