Mathematica: moving point creating a curve

In summary, the conversation discusses the combination of two animations, one showing a plot and the other showing a moving circle. The desired result is achieved by using a parametric plot and adding a graphics element with a point to the animation. The code is provided for achieving this result.
  • #1
MikhailKhot
2
0
Dear all,

here is my animation of a simple plot:

Animate[
ParametricPlot[ {Sin[tf], Cos[tf]}, {tf, 0, t}, PlotStyle -> {{Thickness[0.002], Red}, {Thickness[0.002], Blue}},
PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}}, AspectRatio -> Automatic], {t, 0.01, 100, 0.01},
AnimationRate -> 2, AnimationRunning -> False]

I want to have the same animation, but with a circle moving together with the plot, creating it, i.e. to combine the result above with

Animate[
Show[
Graphics[
{{PointSize[Large], Red, Point[{Sin[t], Cos[t]}]}}, PlotRange -> {{-2, 2}, {-2, 2}}, Axes -> True,
AspectRatio -> Automatic]], {t, 0, 100}, AnimationRate -> 1, AnimationRunning -> False]

How can I get it? Many-many thankd!
 
Physics news on Phys.org
  • #2
Got an answer myself;))

Animate[
Show[
ParametricPlot[
{(1.2 + (1 - tf*0.1)*Boole[tf < 10])*
Sin[tf], (1 + (1 - tf*0.1)*Boole[tf < 10])*Cos[tf]},
{tf, 0, t},
PlotStyle -> {{Thickness[0.002], Red}, {Thickness[0.002], Blue}},
PlotRange -> {{-2.3, 2.3}, {-2.3, 2.3}, {-2.3, 2.3}},
Axes -> False, AspectRatio -> Automatic],
Graphics[{{PointSize[Large], Red,
Point[{(1.2 + (1 - t*0.1)*Boole[t < 10])*
Sin[t], (1 + (1 - t*0.1)*Boole[t < 10])*Cos[t]}]}},
PlotRange -> {{-2.3, 2.3}, {-2.3, 2.3}}, Axes -> False,
AspectRatio -> Automatic]],
{t, 0.01, 100, 0.01},
AnimationRate -> 2, AnimationRunning -> False]
 

1. How do I create a moving point in Mathematica?

To create a moving point in Mathematica, you can use the Dynamic module and the Locator function. First, define the point as a Locator and then use the Manipulate function to control its movement. You can also use the Animate function to create a continuous motion for the point.

2. How can I create a curve from a moving point in Mathematica?

To create a curve from a moving point in Mathematica, you can use the ParametricPlot function. This function allows you to specify the x and y coordinates as a function of time, which will create a curve as the point moves. You can also use the Graphics and Line functions to manually create a curve by connecting multiple points.

3. Can I customize the appearance of the moving point and curve in Mathematica?

Yes, you can customize the appearance of the moving point and curve in Mathematica. You can use the Graphics and Style functions to change the color, size, and shape of the point. For the curve, you can use options such as PlotStyle and Thickness to change its color and thickness. You can also add labels and legends to make the graph more informative.

4. Is it possible to add multiple moving points and curves in the same graph in Mathematica?

Yes, you can add multiple moving points and curves in the same graph in Mathematica. You can use the Show function to combine different plots and graphics. You can also use the Manipulate function to control the movement of multiple points simultaneously. Additionally, you can use the Overlay function to display multiple graphs on top of each other.

5. How do I export the graph with the moving point and curve as an image or animation in Mathematica?

You can export the graph with the moving point and curve as an image or animation in Mathematica by using the Export function. You can specify the file format (e.g. JPEG, GIF, MP4) and the file path. You can also use the Manipulate function to create an interactive animation and then use the Export function to save it as a video file.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
697
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Back
Top