Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8707

Re: NDSolve solutions

From Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: NDSolve solutions
Date 2012-02-23 10:48 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ji55if$78c$1@smc.vnet.net> (permalink)

Show all headers | View raw


On Feb 20, 8:46 am, Niles <niels.martin... at gmail.com> wrote:
> Hi
>
> I have solved an ODE using NDSolve, and I plot the solution like this:
>
> ParametricPlot[{z[t], z'[t]} /. solution, {t, 0, 2 maxTime}, PlotRange
> -> {{0, 0.2}, {0, 450}}, AspectRatio -> 0.75]
>
> The curve shown (the velocity as a function of position) I want to use
> in a new mathematical expression. How can I do that? If I use z'[t],
> then it is as a function of time, which is no good to me.
>
> I appreciate your help.
>
> Best regards,
> Niles.


To clarify, what I have is a system of ODEs of the form

dx/dt = v
dv/dt = a = C*f(x),

where C denotes a constant and f(x) is some function of x. This system
is easy to solve using e.g.

NDSolve[x''[t] == -C*f(x), x[0] == 0, x'[0] == 0}, x, {t, 0, tMax}];

The solution x[t] (or rather, its derivative x'[t]) I need to use in
the following expression:

B(x) = A + v(x)

where A denotes a constant and v(x) is the velocity as a function of
position x. But please note that v is as a function of x, not t. What
should I do to achieve this?

Best regards,
Niles.

Hi, Niles,

The answer depends upon what are you going to do with B(x). But generally, you may want to operate with B in the parametric form. That is, the pair
{x(t), B(t)} defines the B(x) dependence. If you need to build plot B=B(x) than do it like in the example below:

eq1=x'[t]==v[t];
eq2=v'[t]==Sin[x[t]]-0.1*v[t];
ss=NDSolve[{eq1,eq2,x[0]==0.5,v[0]==0},{x,v},{t,0,20}]
{{x->InterpolatingFunction[{{0.,20.}},<>],v->InterpolatingFunction[{{0.,20.}},<>]}}
ParametricPlot[Evaluate[{x[t],v[t]}/.ss],{t,0,20}]

B[t_]:=1+v[t];
ParametricPlot[Evaluate[{x[t],B[t]}/.ss],{t,0,20},AxesLabel->{"x","B"}]

But you may also do anything else in the parametric form.

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch@iee.lu<mailto:alexei.boulbitch@iee.lu>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: NDSolve solutions Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-02-23 10:48 +0000

csiph-web