Mathematica 9 is now available
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: [mg127127] Re: Varying a constant in an ODE to Manipulate solution
  • From: Narasimham <mathma18 at hotmail.com>
  • Date: Sun, 1 Jul 2012 02:11:38 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201206130857.EAA03730@smc.vnet.net> <jreout$nqu$1@smc.vnet.net> <js3uk2$10i$1@smc.vnet.net>

On Jun 23, 1:26 pm, Narasimham <mathm... at hotmail.com> wrote:
> 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 one
> > > > 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 ->  Automati=
c,
> > > > >    PlotRange ->  {{-3, 3}, {-10, 10}}], {c, -0.5, 2, 0.2}]
>
> > > > --
> > > > Murray Eisenberg                     murrayeise=
nb=
> ..=
> > .@=
> > > gmail.com
> > > > 80 Fearing Street                    phone 413 =
54=
> 9-=
> > 10=
> > > 20 (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 mor=
e
> > 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},Mes=
h-=
> >{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,P=
lo=
>
> 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 [% ] above would certainly produce error diagnostics as of
> > now!! *)
>
> > Is it  possible to push up or upgrade a constant  (along with a cho=
se=
> n
> > 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 t=
o
> > 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,P=
lo=
>
> 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!! *)tRange->{{0,5},{=
-2=
>
> .5,2.5},  {-2.5,2.5}},PlotRange-> >{{0,5},{-2.5,2.5}, {-2.5,2.5}},PlotL=
abel->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 a 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 to suggest this as the prospect of computing and
> viewing generalized functions (numerically at least to begin with)
> whereby multiple constants can get embedded into 3-space and
> even into a muti-dimensional spaces by the power of functional
> definition flexibility and graphical depiction in Mathematica, is
> is indeed exciting.
>
> Regards
> Narasimham

The suggestion actually is for solid modeling,could not express it
earlier.

To appreciate the invariantly fixing up any one among three variables
and making the
three component surfaces which can be morphed/ Manipulated/ clubbed
back/integrated
in 3D solid modelling,I have written this code ( fwiw, instructional)
in mathematical solid
parametric 3D modeling thus:

 c = 1.2; " 3 PARAM DECOMPN THICK CYL  Solid modelling  "
" Take two out of 3 parameters  {a,t,v } at a time  for surface  \
generation and
 one out  three parameters at a time for single generating parameter \
line. "
 Clear[a, t, v] ;
" vary v & t. It  makes  a cylinder surface, Dilatation of each cyl \
surface  at a =1 generates  a solid. "
a = 1.;
aa = ParametricPlot3D[ {a Cos[t + v], c t , a Sin[t + v] }, {t, 0,
    2 Pi}, { v, 0, 2 Pi}, Mesh -> {18, 4}] ;
at = ParametricPlot3D[ {a Cos[t + 2.5], c t , a Sin[t + 2.5] }, {t,
    0, 2 Pi}, PlotStyle -> {Orange, Thick}] ;
Clear[a, t, v] ;
" vary a & t. It makes a  helical fin surface, entire fin rigid body
\
Rotation at  v = Pi /2 generates a solid. "
v = Pi/2. ;
vv = ParametricPlot3D[ {a Cos[t + v], c t , a Sin[t + v] }, {t, 0,
    2 Pi}, { a, 1, 1.6}, Mesh -> {18, 4}] ;
va = ParametricPlot3D[ {a Cos[4 + v], c  4. ,  a  Sin[4 + v] }, { a,
    1, 1.6}, PlotStyle -> {Orange, Thick}] ;
Clear[a, t, v] ;
" vary v & a. It  makes  an annulus surface , entire annulus  \
Translation  at t = Pi  generates  a solid. "
t = Pi ;
tt = ParametricPlot3D[ {a Cos[t + v], c t , a Sin[t + v] }, { v, 0,
    2 Pi}, {a, 1, 1.6}, Mesh -> {18, 4}] ;
tv = ParametricPlot3D[ {1.25 Cos[t + v], c  t  ,
    1.25 Sin[t + v] },  { v, 0, 2 Pi}, PlotStyle -> {Orange, Thick}] ;
Surfs = Show[{aa, vv, tt}, PlotRange -> All, Axes -> None,
  Boxed -> False]
Lines = Show[{at, va, tv}, PlotRange -> All, Axes -> None,
  Boxed -> False]
Show[Surfs, Lines]

I hope the need for development of general command in solid
modeling is clearer from above closed parametric form example.

Regards
Narasimham




  • Prev by Date: Re: Rearranging terms - user-defined
  • Next by Date: Re: case of inconsistent API between Drop and Part?
  • Previous by thread: Re: Book
  • Next by thread: Re: Varying a constant in an ODE to Manipulate solution