Re: Some questions about a Mathematica script
- To: mathgroup at smc.vnet.net
- Subject: [mg120803] Re: Some questions about a Mathematica script
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Wed, 10 Aug 2011 06:49:02 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 8/9/11 at 7:21 AM, dale.jenkins8 at deletegooglemail.com (DaleJenk) wrote: refering to: >soln = NDSolve[{{x1''[t] == dx1, x2''[t] == dx2, >x3''[t] == dx3}, {x1[0] == x1int, x1'[0] == 0.0, x2[0] == x2int, >x2'[0] == 0.0, x3[0] == x3int, x3'[0] == 0.0}}, {x1[t], x2[t], >x3[t], x1'[t], x2'[t], x3'[t]}, {t, 0, 5}, >Method -> "StiffnessSwitching"]; >1. At the end of the NDSolve instruction comes the list: {x1[t], >x2[t], x3[t], x1'[t], x2'[t], x3'[t]}. What exactly is the reason >for putting in the primed items in this list? The arguments to NDSolve are a list of equations, a list of functions you want solutions for and finally a list showing the independent variable and the range over which you want a solution. The specific call to NDSolve you copies as a list of second order differential equations. So, the second list with {x1[t], ... x1'[t] ...} is telling NDSolve to return both the function x[1t] and its derivative x1'[t]. The prime in x1'[t] is a notation indicating a derivative. >2. "soln" and "solnx1", etc. are all just labels. Right? No, these are not just labels. They are symbols that get assigned values. >3. But what exactly does soln[[1,1]] refer to? NDSolve is returning a list of things that are stored in soln. The [[1,1]] portion specifies which element of soln is wanted. In this case, [[1,1]] refers to the first element of the first list stored in soln.