MathGroup Archive 2006

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

Search the Archive

Re: animation question


Clear["Global`*"]

fr[n_] := Plot[(Sqrt[7*x^4 + 6*x + 5] - Sqrt[7*x^4 + 3*x +
3])*Sqrt[63*x^2 - 5*x + 20], {x, 0, n},
   PlotRange -> {{0, 10}, {2, 6.5}}, Frame -> {True, True, False,
False}, Epilog -> {Red, Line[{{0, 4.5}, {10, 4.5}}]}]

Table[fr[n], {n, 1, 10, 0.1}];
SelectionMove[EvaluationNotebook[], All, GeneratedCell];
FrontEndTokenExecute["CellGroup"]
FrontEndTokenExecute["OpenCloseGroup"]

Here is another solution I thought

fr2[n_] := Plot[(Sqrt[7*x^4 + 6*x + 5] - Sqrt[7*x^4 + 3*x +
3])*Sqrt[63*x^2 - 5*x + 20], {x, 0, n},
   PlotRange -> {{0, 10}, {2, 6.5}}, Frame -> {True, True, False,
False}, AxesOrigin -> {0, 4}, AxesStyle -> Red]

Table[fr2[n], {n, 1, 10, 0.1}];
SelectionMove[EvaluationNotebook[], All, GeneratedCell];
FrontEndTokenExecute["CellGroup"]
FrontEndTokenExecute["OpenCloseGroup"]

Yet another solution which offers better animation hadling (thanks
again David!)

<< "Graphics`Animation`"

fr[n_] := Plot[(Sqrt[7*x^4 + 6*x + 5] - Sqrt[7*x^4 + 3*x +
3])*Sqrt[63*x^2 - 5*x + 20], {x, 0, n},
   PlotRange -> {{0, 10}, {2, 6.5}}, Frame -> {True, True, False,
False}, Epilog -> {Red, Line[{{0, 4.5}, {10, 4.5}}]}]

Animate[fr[n], {n, 1, 10, 0.1}];
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200,
AnimationDisplayTime->0*0.1, AnimationDirection -> Forward]}]

dimitris wrote:
> Consider the simple animation
>
> fr[n_] := Show[Plot[(Sqrt[7*x^4 + 6*x + 5] - Sqrt[7*x^4 + 3*x +
> 3])*Sqrt[63*x^2 - 5*x + 20], {x, 0, n},
>     PlotRange -> {{0, 10}, {2, 6.5}}, Frame -> {True, True, False,
> False}], Graphics[{Red, Line[{{0, 4.5}, {10, 4.5}}]}]]
>
> Table[fr[n], {n, 1, 10, 0.1}];
> SelectionMove[EvaluationNotebook[], All, GeneratedCell];
> FrontEndTokenExecute["CellGroup"]
> FrontEndTokenExecute["OpenCloseGroup"]
>
> How is possible to hold the red line (which has the meaning of the
> limit as x->infinity; try
> Limit[(Sqrt[7*x^4 + 6*x + 5] - Sqrt[7*x^4 + 3*x + 3])*Sqrt[63*x^2 - 5*x
> + 20], x -> Infinity])
> fixed (i.e. not "animated")?
>
> I think where I have inserted the graphic primitive I can't avoid this.
> But I can't think something other.
> 
> Regards
> Dimitris


  • Prev by Date: Re: [Help Needed] Converting C++ program into Mathematica Function
  • Next by Date: Sovling non-linear eq-sys (beginners question)
  • Previous by thread: Re: animation question
  • Next by thread: Re: animation question