No Animation: Plotting Polar Function $p(r,\theta)$

Reply 3:Hi Dwsmith,I am not sure whether I understand the question correctly. You want to animate a plot with r variable changing? You can tryAnimate[Plot[u[r, \[Theta]], {\[Theta], -Pi/2, Pi/2}, PlotRange -> {0, 3.25}, GridLines -> Automatic, Frame -> True, PlotStyle -> {Thick, Red}], {{r, 0}, 0, 1, 0.1, Appearance -> "Open"}]Hope this helps!Best,Yu
  • #1
Dustinsfl
2,281
5
$$
p(r,\theta) = \frac{1}{2\pi}\sum_{n = -\infty}^{\infty}r^{|n|}e^{in\theta} = \frac{1}{2\pi}\left[\frac{1 - r^2}{1 - 2r\cos\theta + r^2}\right].
$$
So I produced the graph but it won't animate.

Code:
MyR = Table[r, {r, 0, 1, .1}];

u[\[Theta]_] = 1/(2*Pi)*((1 - r^2)/(1 - 2*r*Cos[\[Theta]] + r^2));
Plot[u[MyR, \[Theta]], {\[Theta], -Pi/2, Pi/2}, 
 PlotRange -> {0, 3.25}, PlotStyle -> {Red}, AspectRatio -> 2/3]
View attachment 378

Code:
Animate[Plot[u[\[Theta]], {\[Theta], -Pi/2, Pi/2}, 
  PlotRange -> {0, 3.25}, GridLines -> Automatic, Frame -> True, 
  PlotStyle -> {Thick, Red}], {r, 0, 1, 0.1}, 
 AnimationRunning -> False]
This code doesn't produce any errors or Mathematica complaining but nothing happens when I hit play.
 

Attachments

  • Poissons kernel.jpg
    Poissons kernel.jpg
    8.3 KB · Views: 69
Last edited:
Physics news on Phys.org
  • #2
dwsmith said:
$$
p(r,\theta) = \frac{1}{2\pi}\sum_{n = -\infty}^{\infty}r^{|n|}e^{in\theta} = \frac{1}{2\pi}\left[\frac{1 - r^2}{1 - 2r\cos\theta + r^2}\right].
$$
So I produced the graph but it won't animate.

Code:
MyR = Table[r, {r, 0, 1, .1}];

u[\[Theta]_] = 1/(2*Pi)*((1 - r^2)/(1 - 2*r*Cos[\[Theta]] + r^2));
Plot[u[MyR, \[Theta]], {\[Theta], -Pi/2, Pi/2}, 
 PlotRange -> {0, 3.25}, PlotStyle -> {Red}, AspectRatio -> 2/3]
View attachment 378

Code:
Animate[Plot[u[\[Theta]], {\[Theta], -Pi/2, Pi/2}, 
  PlotRange -> {0, 3.25}, GridLines -> Automatic, Frame -> True, 
  PlotStyle -> {Thick, Red}], {r, 0, 1, 0.1}, 
 AnimationRunning -> False]
This code doesn't produce any errors or Mathematica complaining but nothing happens when I hit play.

Hi dwsmith, :)

I don't use Mathematica but seeing this question go unanswered I posted this in the Google Mathematica group. Here are the replies.

Kind Regards,
Sudharaka.Reply 1:

myR = Table[r, {r, 0, 1, .1}];

u[r_, \[Theta]_] = 1/(2*Pi)*((1 - r^2)/
(1 - 2*r*Cos[\[Theta]] + r^2));

Plot[Evaluate[
Tooltip[u[#, \[Theta]], #] & /@ myR],
{\[Theta], -Pi/2, Pi/2},
PlotRange -> {0, 3.25},
AspectRatio -> 2/3,
Frame -> True,
Axes -> False]

Plot3D[u[r, \[Theta]],
{\[Theta], -Pi/2, Pi/2},
{r, 0, 1},
PlotRange -> {0, 4},
AspectRatio -> 2/3,
ClippingStyle -> None]

Animate[
Plot[u[r, \[Theta]], {\[Theta], -Pi/2, Pi/2},
PlotRange -> {0, 3.25},
GridLines -> Automatic,
Frame -> True,
PlotStyle -> {Thick, Red}],
{r, 0, 1, 0.1},
AnimationRunning -> False]

Manipulate[
Plot[u[r, \[Theta]], {\[Theta], -Pi/2, Pi/2},
PlotRange -> {0, 3.25},
GridLines -> Automatic,
Frame -> True,
PlotStyle -> {Thick, Red}],
{r, 0, 1, 0.01, Appearance -> "Labeled"}]


Reply 2:


You need to define u as a function of two variables.

u[r_,theta_]= ...
as in

MyR = Table[r, {r, 0, 1, .1}];

u[r_ ,\[Theta]_] = 1/(2*Pi)*((1 - r^2)/(1 - 2*r*Cos[\[Theta]] + r^2));
Plot[u[MyR, \[Theta]], {\[Theta], -Pi/2, Pi/2},
PlotRange -> {0, 3.25}, PlotStyle -> {Red}, AspectRatio -> 2/3]
Then

Animate[Plot[u[r,\[Theta]], {\[Theta], -Pi/2, Pi/2}, PlotRange -> {0, 3.25}, GridLines -> Automatic, Frame -> True, PlotStyle -> {Thick, Red}], {r, 0, 1, 0.1}, AnimationRunning -> False]
 

FAQ: No Animation: Plotting Polar Function $p(r,\theta)$

What is a polar function?

A polar function is a mathematical equation that describes a relationship between a point on a polar coordinate system and its distance from the origin and angle from the positive x-axis.

How is a polar function different from a regular function?

A polar function is graphed on a polar coordinate system, which is different from the Cartesian coordinate system used for regular functions. In a polar system, the x and y coordinates are represented by the distance from the origin and the angle from the positive x-axis, respectively.

Can a polar function have multiple values for the same input?

Yes, a polar function can have multiple values for the same input, as the angle and distance from the origin can vary for different points on the graph. This is different from a regular function, which only has one output for each input.

How do I plot a polar function?

To plot a polar function, you can use a graphing calculator or software, which will allow you to input the equation and generate a graph. Alternatively, you can plot the function manually by using a polar coordinate grid and plotting points by hand.

What are some common polar functions?

Some common polar functions include cardioids, roses, and limaçons. These functions often have symmetrical and repetitive patterns, making them visually appealing and useful for creating designs and animations.

Similar threads

Replies
1
Views
821
Replies
2
Views
700
Replies
1
Views
3K
Replies
1
Views
1K
Replies
1
Views
1K
Replies
3
Views
2K
Replies
1
Views
7K
Back
Top