Re: manipulate time
- To: mathgroup at smc.vnet.net
- Subject: [mg114777] Re: manipulate time
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Thu, 16 Dec 2010 05:57:03 -0500 (EST)
- References: <ieadlm$ra7$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 12/15/2010 4:52 AM, manel zerelli wrote:
> i want to solve two differential equations in which a parameter "r"
> vary in an intervall. for that i want to see the effect of this
> variation at each time.i want to manipulate time and for each instant
> i scan all the interval of variation of parameter "r".
> i tried this:
>
> Manipulate[
> For[r = 1, r< 4, r++,
> sol = DSolve[{\[Theta]'[t] == k i[t],
> i'[t] == -k \[Theta][t] - r i[t] + 10,
> i[0] == 0, \[Theta][0] == 0}, {i, \[Theta]}, t];
> ParametricPlot[Evaluate[{i[t], \[Theta][t]} /. sol], {t, 0, n},
> PlotRange -> {{-10, 10}, {-1, 15}}]], {n, 0, 7}]
>
> and i tried tu use two for loop
>
> For [t = 0.1, t< 7, t++,
> For[r = 1, r< 3, r++,
> sol = DSolve[{\[Theta]'[t] == k i[t],
> i'[t] == -k \[Theta][t] - r i[t] + 10,
> i[0] == 0, \[Theta][0] == 0}, {i, \[Theta]}, t];
> ParametricPlot[Evaluate[{i[t], \[Theta][t]} /. sol], {t, 0.1, 7},
> PlotRange -> {{-10, 10}, {-1, 15}}]]]
>
> i am a new user of mathematica so i am sorry for the syntax error!
> can you help me o solve this problem
>
You did not have a numerical value for 'k'. Here is a modification below
for you to use as a starting point:
Manipulate[
(
sol=DSolve[{\[Theta]'[t]==k i[t],i'[t]==-k \[Theta][t]-r i[t]+10,i[0]==0,\[Theta][0]==0},{i,\[Theta]},t];
ParametricPlot[Evaluate[{i[t],\[Theta][t]}/.sol],{t,0,n},PlotRange->{{-10,10},{-1,15}}]
)
,
{{n,3,"n"},1,7,Appearance->"Labeled"},
{{r,2,"r"},1,4,Appearance->"Labeled"},
{{k,6,"k"},1,10,Appearance->"Labeled"}
]
--Nasser