Tag Info

New answers tagged

3

What about this?: wave[x_, t_, k_, ω_, ϕ_] := Sin[ω*t + k.x + ϕ]; Animate[Plot3D[wave[{x, y}, t, {1, 1}, 1, 0], {x, 0, 3}, {y, 0, 3}], {t, 0, 10}] where {x,y} or x in the wave function definition is a 2D vector (in order to be able to draw it; in reality, x is a 3D vector and there would be no way to plot), k is the wave vector (I just used {1, 1} for ...


21

Generally always check Demonstrations site for good code. I cannot not mention an excellent "classic" of planar three body problem by Stephen Wolfram and Michael Trott. Code is short and I verified it runs in the latest M10.1. I slightly changed variable labels so code parses better here, removed MaxRecursion -> ControlActive[3, 9] from plot option and ...


1

Another way is just to render the frames first and then use ListAnimate, (BTW I set y0 to -0.1, since its definition is missing) mypara[\[Alpha]_] := ParametricPlot[{{Cos[\[Theta]], Sin[\[Theta]]}, {2 Cos[\[Alpha]] + Cos[\[Theta]], 2 Sin[\[Alpha]] + Sin[\[Theta]]}, {r, 0}}, {\[Theta], 0, 2 \[Pi]}, {r, 1, 2}, PlotRange -> 3, Frame -> False] ...


4

Use ImageRotate instead of Rotate. Rotate works on Graphics primitives and objects and returns a Graphics primitive or objects with head Rotate. (* with ImageRotate increased angle for illustrative purposes *) image = Import["http://i.stack.imgur.com/R6UgC.jpg"]; Imrot = ImageRotate[image, 20 Degree]; ImageTrim[Imrot, {{560, 400}, {900, 900}}] See the ...


1

You can make a function that plots the content of a file like this: plot[file_] := Module[{mmm, figure, pos, b}, mmm = ReadList[NotebookDirectory[] <> file, Number, RecordLists -> True]; (* ... the rest of your code. *) ] To make an animation you have to first create a list with all the "frames", then you can display it with ListAnimate ...


16

Usage Just use this function with any polyhedron in in form: GraphicsComplex[pts_, Polygon[vertices_, ___]]. When I find time and motivation maybe I will add more DownValues so it can be more general. At the moment you can play with solids given by PolyhedronData[... "Faces"]: polyhedronRandomWalk[ PolyhedronData["DuerersSolid", "Faces"] ] ...


0

You can also use Show with the option ImageSize: image = Show[ExampleData[{"TestImage", "Lena"}], ImageSize -> 40]; f = 5 + Sin[#] + Sin[Sqrt[2] #] &; Animate[Plot[{f[z]}, {z, 0, 50}, PlotRange -> {{0, 50}, {0, 10}}, Epilog -> Inset[image, {x, f[x]}]], {x, 0, 50}]


0

The issue at least on my machine (Linux, M10.1) is that the plots take a long time to generate and so creating a smooth animation with on-the-fly generated plots is, well, impossible. You could generate the plots beforehand, though. Here's some code to show you the progress of plot generation as well. Assuming that you have defined a function f[t] that ...


1

I guess there is some floating-point-related issue here... This works: f[t_] := RegionPlot[ TransformedRegion[ Rectangle[{-1, -1}, {1, 1}], { Indexed[#1, {1}] (1 + t (Indexed[#1, {2}]^2 - 1)) + 2 t, Indexed[#1, {2}] (1 + t (Indexed[#1, {1}]^2 - 1)) + 2 t } & ], PlotRange -> {{-1 + 2 t, 1 + 2 t}, {-1 + 2 t, 1 + 2 t}} ] ...



Top 50 recent answers are included