TransWikia.com

Quick questions about a document example for Components and Data Structures

Mathematica Asked on June 5, 2021

NDSolve can be broken into several basic steps for advanced usage according to Components and Data Structures. In the documentation, a simple example is given as follows.

  1. Creating an NDSolve`StateData object, which includes the info needed to solve the equation:

     state = First[NDSolve`ProcessEquations[{x''[t] + (1 + 4 UnitStep[Sin[t]]) x[t] == 0, x[0] == 1, x'[0] == 0}, x, t, Method -> "ExplicitRungeKutta"]]
    
     (* NDSolve`StateData[<0.>] *)
    
  2. Integrating the equation up to t = 10 Pi with the time interval specified by a list of intermediate times

     NDSolve`Iterate[state, Pi Range[10]]
    
  3. Generating the current solution and associated derivatives in the forward directon

     sol = NDSolve`ProcessSolutions[state, "Forward"]
    
     (* {x[31.4159] -> 0.843755, Derivative[1][x][31.4159] -> -1.20016, (x'')[31.4159] -> -0.843755, (x'')[31.4159] -> (x'')[31.4159] -> -1} *)
    

I have two questions with regard to the step 2 and 3, respectively.

(1) The document states that NDSolve`Iterate allows you to specify intermediate times at which to stop. This can be useful to avoid discontinuities. It sounds great but I don’t understand what does it mean by at the intermediate times to stop. Does it mean that by specifying intermediate times we can use NDSolve`ProcessSolutions to save all the intermediate solutions otherwise we only have a solution for the final time? Can anyone give an example to demonstrate how to avoid discontinuities in solving a differential equation with NDSolve`Iterate[state, list_of_times]?

(2) I can understand that NDSolve`ProcessSolutions gives the solution and associated derivatives in the step 3, however, I do not understand what is the last element in its output list, i.e., (x'')[31.4159] -> (x'')[31.4159] -> -1?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP