Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Varying a constant in an ODE to Manipulate solution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126998] Re: Varying a constant in an ODE to Manipulate solution
  • From: Narasimham <mathma18 at hotmail.com>
  • Date: Fri, 22 Jun 2012 05:13:22 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201206130857.EAA03730@smc.vnet.net> <jreout$nqu$1@smc.vnet.net>

On Jun 21, 2:20 pm, Narasimham <mathm... at hotmail.com> wrote:
> On Jun 18, 1:46 am, Narasimham <mathm... at hotmail.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
> > On Jun 15, 12:41 pm, Murray Eisenberg <mur... at math.umass.edu> wrote:
>
> > > It's not clear to me what you want to do.
>
> > I hope this reply clarifies, and my broader question too.
>
> > > Do you want to create 3D-parametric plot of the trajectory in space --
> > > possibly as a dynamic with the time t as dynamic parameter?
>
> > Yes. I can get this plot OK simply as:
>
> > Manipulate[ParametricPlot3D[Evaluate[sol[c][[1]]], {t, -3, 3},
> > PlotStyle ->  {Red, Thick},
> > AspectRatio ->  Automatic, PlotRange ->  {{-3, 3}, {-10, 10}}], {c,
> > -0.5, 2, 0.2}]
>
> > Also I have asked in a separate but related question now under
> > clearance by moderators
> > regarding Clairaut's Equation_
>
> > How to include traces of these lines in the plot and not have them
> > flying in the 3space
> > on the Manipulate command. Call them t parameter lines as t is
> > continuous and c is discrete.
>
> > > And/or do one of those same things but do it just in 2D, selecting some
> > > pair of the 3 components of the solution function?
>
> > Yes, that was my query. Bob Hanlon pointed out my error. (Evaluating
> > together was needed).
>
> > > Or a 3D-parametric plot of the trajectory over a fixed-duration time in
>
> > terval, but dynamic
>
> > > with c as control variable?
>
> > Yes, in fact that is going to be my next question now, and thanks that
> > you have foreseen it !
>
> > Call these lines c parameter lines as c would be the continuous
> > control variable and t's would be discrete.
>
> > In this case, each time dot is extruded or curvilinearly dragged
> > across the surface, cutting the
>
> > t lines. Bringing together action of control variables t and c, we
> > have a surface sol[c_,t_] which
>
> > can be computed and plotted. t and c are two parameters for this
> > patch.
>
> > How can this be done? I am almost sure this is doable. I shall try for
> > Clairaut's 2D problem and send result when done.
>
> > Regards
>
> > Narasimham
> > > On 6/13/12 4:57 AM, Narasimham wrote:
> > > > Same topic is continued. Thanks to Murray Eisenberg and Bob Hanlon
>
> > > > All variables or a single variable are easily pocked out from sol[c_]
> > > > list for plotting.
> > > > But how to pick out two out of them for ParametricPlot  ( 2D) ?
>
> > > > sol[c_] := {x[t], y[t], z[t]} /.
> > > >    First[NDSolve[{y''[t] + Sin[y[t]/c] == 0, y'[0] == 0,
> > > >       y[0] == 1/(1 + c), x'[t] == t, x[0] == c^2,
> > > >       z'[t] == 2 c x[t] - y[t], z[0] == 2}, {x, y, z}, {t, -3, 3}]]
> > > > Manipulate[
> > > >   Plot[Evaluate[sol[c]], {t, -3, 3}, PlotStyle ->  {Red, Thick},
> > > >    AspectRatio ->  Automatic,
> > > >    PlotRange ->  {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
> > > > Manipulate[
> > > >   Plot[Evaluate[sol[c][[1]]], {t, -3, 3}, PlotStyle ->  {Red, Thick},
> > > >    AspectRatio ->  Automatic,
> > > >    PlotRange ->  {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
> > > > " 2 parameter Dynamic manipulation not OK"
> > > > Manipulate[
> > > >   Plot[{Evaluate[sol[c][[1]]], Evaluate[sol[c][[1]]]}, {t, -3, 3},
> > > >    PlotStyle ->  {Green, Thick}, AspectRatio ->  Automatic,
> > > >    PlotRange ->  {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
>
> > > --
> > > Murray Eisenberg                     murrayeisenb ..  > . at gmail.com
> > > 80 Fearing Street                    phone 413 549-1020 (H)
> > > Amherst, MA 01002-1912
>
> With some conviction I make the following suggestion.
>
> { a Cos[t], a Sin[t] } with perturbation of a gives an annular ring.
> Boyles Law P*V = const for given const temp T becomes generalised to
> gas law P V / T = const. when T is varied. The  general form is more
> value in scientific work.
>
> The same case illustrates my point.
>
> c=1 ;
> CL1=Manipulate[ParametricPlot3D[{c Cos[t],0.6 t,c Sin[t]},{t,
> 0,Pi},PlotStyle->{Red,Thick},PlotRange->{{-1.5,1.5},{0,2},{0,1.5}}],{c,
> 1,1.5,.1}]
> CL2=ParametricPlot3D[{c Cos[t],0.6 t,c Sin[t]},{t,0,Pi},{c,1,1.5},Mesh->{15,4}]
>
> sol[c_]:={x[t],y[t],z[t]}/.First[NDSolve[{y''[t]+Sin[y[t]/
> c]==0,y'[0]==0,y[0]==1/(1+c),x'[t]==t,x[0]==c^2,z'[t]==2 c x[ t]-
> y[t],z[0]==2},{x,y,z},{t,-3,3}]];
>
> DIFF1=
> Manipulate[ ParametricPlot3D[Evaluate[{sol[c][[1]]  ,sol[c][[2]] ,
> sol[c][[3]] }],{t,-2,2},PlotStyle->{Red,Thick},AspectRatio->Automatic,PlotRange->{{0,5},{-2.5,2.5},  {-2.5,2.5}},PlotRange-
> >{{0,5},{-2.5,2.5}, {-2.5,2.5}},PlotLabel->Style[Framed[ "c PARAMETRIC
>
> LINES EXIST BUT INVISIBLE"] ]],{c,-0.5,2,0.2}]
>
> DIFF2=
> ParametricPlot3D[Evaluate[{sol[c][[1]]  ,sol[c][[2]] , sol[c][[3]] }],
> {t,-2,2},{c,-0.5,2,0.2}, PlotStyle->{Red,Thick},AspectRatio->Automatic,PlotRange->{{0,5},{-2.5,2.5},  {-2.5,2.5}},PlotRange-
> >{{0,5},{-2.5,2.5}, {-2.5,2.5}}]
>
> (* the [% ] above would certainly produce error diagnostics as of
> now!! *)
>
> Is it  possible to push up or upgrade a constant  (along with a chosen
> domain) into a variable, from state X1 ( with one independent variable
> t  ) to CL2 ( with two independent variables  t and c) thereby
> spreading/dragging/extruding a line  into a surface?
>
>  It is possible to generalize both in closed form (analytically
> definable functions )and in differential form (for  smooth continuous
> manifolds ) with automatically generated boundary conditions added ,
> from surfaces to solids/volumes and  further on to 4D objects .. by
> proper assembly or stacking  into 3- space objects.
>
> It is possible to implement a form in CL2 for every form CL1 to
> accommodate c seeding among determining differential equations as well
> as in Boundary Conditions as an add-on/ generalization function by
> variation of parameter c, sharing same boundary conditions between
> them.
>
> The manner of range specification  in code available to the user is to
> put c and t ranges simply together inside square bracket rather than
> on either side of the closing square bracket.
>
> So I tend to suggest/ request for making a provision, incorporating
> whatever it takes to realize it, to enable plot of DIFF2  without
> error diagnostics and output the same DIFF1 as DIFF2 but now as a
> surface .
>
> The logic is the same, to me at least, in such a result depiction. The
> DIFF2 should show _a surface_ just as CL2 does.
>
> This may seem too long drawn out, A request for its acceptance or
> implementation in further Mathematica development  may look a tall
> order, I took liberty to make the comment. Please comment about your
> view and problems involved in what looks as a crass generalization. Or
> a simple code to make it routinely available be please indicated.
>
> Regards
> Narasimham
>
> sol[c_]:={x[t],y[t],z[t]}/.First[NDSolve[{y''[t]+Sin[y[t]/
> c]==0,y'[0]==0,y[0]==1/(1+c),x'[t]==t,x[0]==c^2,z'[t]=
=
> ==2 c x[ t]-
> y[t],z[0]==2},{x,y,z},{t,-3,3}]];
> DIFF1=
> Manipulate[ ParametricPlot3D[Evaluate[{sol[c][[1]]  ,sol[c][[2]] ,
> sol[c][[3]] }],{t,-2,2},PlotStyle->{Red,Thick},AspectRatio->Automatic,Plo=
tRange->{{0,5},{-2.5,2.5},  {-2.5,2.5}},PlotRange-
> >{{0,5},{-2.5,2.5}, {-2.5,2.5}},PlotLabel->Style[Framed[ "c PARAMETRIC
>
> LINES EXIST BUT INVISIBLE"] ]],{c,-0.5,2,0.2}]
>
> DIFF2=
> ParametricPlot3D[Evaluate[{sol[c][[1]]  ,sol[c][[2]] , sol[c][[3]] }],
> {t,-2,2},{c,-0.5,2,0.2}, PlotStyle->{Red,Thick},AspectRatio->Automatic,Pl=
otRange->{{0,5},{-2.5,2.5},  {-2.5,2.5}},PlotRange-
> >{{0,5},{-2.5,2.5}, {-2.5,2.5}}]
>
> (* the % would certainly produce error diagnostics!! *)

If DIFF2 cannot work without error diagnostics (regarding pushing
domain of c inclusively into square brackets together with domain of
t, please indicate  dynamic adapter code/module  lines that may be
appended so that one need not write own code lines with Tooltip or
whatever it takes to compute/display the generalized function [t,c].

Took liberty of suggesting this as the prospect of computing and
viewing generalized functions (numerically at least to begin with)
whereby multiple parameters can get embedded even into a muti-
dimensional spaces by the power of functional depiction in
Mathematica .. is indeed exciting.

Regards
Narasimham






  • Prev by Date: Re: Default path for opening files
  • Next by Date: LibraryLink & MinGW
  • Previous by thread: Re: Varying a constant in an ODE to Manipulate solution
  • Next by thread: Re: Varying a constant in an ODE to Manipulate solution