# Graph of Laplace equation

I have solved the following Laplace equation

a0 = (1/Pi) Integrate[Cos[φ]^2 + Sin[φ]^3, {φ, 0, 2 Pi}]
an = (1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*Cos[n*φ], {φ, 0, 2 Pi}]
Plot[an, {n, 0, 10}]
bn = (1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*Sin[n*φ], {φ, 0, 2 Pi}]
ann = an*Cos[n*φ]
bnn = bn*Sin[n*φ]
a = Sum[((r/4)^n)*(ann + bnn), {n, 1, Infinity}]
f[r_, φ_] := a0/2 + a
ParametricPlot3D[{r,φ, f[r, φ]}, {r, 0, 1}, {φ, 0, 2 Pi}]
Plot3D[f[r, φ], {r, 0, 1}, {φ, 0, 2 Pi}]


My problem is that Plot3D and ParametricPlot3D doesn't work. Any help?

• a is still expressed as a sum; a value cannot be calculated even if I plug in numbers for r and phi. This is not a plotting problem (yet). You will have to find a way to calculate the value of your sum first. – MarcoB Jul 4 at 15:20
• I can't understand your answer, I am confused, please solve my question – George Jul 4 at 15:23

Clear["Global*"]

a = (1/Pi) Integrate[
Cos[φ]^2 + Sin[φ]^3, {φ, 0, 2 Pi}]

(* 1 *)

a = (1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*
Cos[2*φ], {φ, 0, 2 Pi}]

(* 1/2 *)

a[n_Integer] = Assuming[Element[n, Integers],
(1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*
Cos[n*φ], {φ, 0, 2 Pi}]]

(* 0 *)

a[n_] =
(1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*
Cos[n*φ], {φ, 0, 2 Pi}]

(* ((12 Sin[n π]^2)/(9 - 10 n^2 + n^4) + ((-2 + n^2) Sin[2 n π])/(
n (-4 + n^2)))/π *)

Plot[a[n], {n, 0, 4.2},
Epilog -> {Red, AbsolutePointSize, Point[{#, a[#]} & /@ Range[0, 4]]}] b = (1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*
Sin[φ], {φ, 0, 2 Pi}]

(* 3/4 *)

b = (1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*
Sin[3 φ], {φ, 0, 2 Pi}]

(* -(1/4) *)

b[n_Integer] =
Assuming[Element[n, Integers],
(1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*
Sin[n*φ], {φ, 0, 2 Pi}]]

(* 0 *)

b[n_] =
(1/Pi) Integrate[(Cos[φ]^2 + Sin[φ]^3)*Sin[n*φ],
{φ, 0, 2 Pi}]

(* ((2 (-2 + n^2) Sin[n π]^2)/(n (-4 + n^2)) - (6 Sin[2 n π])/(
9 - 10 n^2 + n^4))/π *)

Plot[b[n], {n, 0, 5.5},
Epilog -> {Red, AbsolutePointSize, Point[{#, b[#]} & /@ Range[0, 5]]}] an[n_] := a[n]*Cos[n*φ];

bn[n_] := b[n]*Sin[n*φ];

sum = Sum[((r/4)^n)*(an[n] + bn[n]), {n, 1, 10}]

(* 1/32 r^2 Cos[2 φ] + 3/16 r Sin[φ] - 1/256 r^3 Sin[3 φ] *)


where the sum was truncated since the higher terms are zero.

f[r_, φ_] = a/2 + sum;

Minimize[{f[r, φ], 0 <= r <= 1,
0 <= φ <= 2 Pi}, {r, φ}]

(* {71/256, {r -> 1, φ -> (3 π)/2}} *)

Maximize[{f[r, φ], 0 <= r <= 1,
0 <= φ <= 2 Pi}, {r, φ}]

(* {169/256, {r -> 1, φ -> π/2}} *)

ParametricPlot3D[{r, φ, f[r, φ]},
{r, 0, 1}, {φ, 0, 2 Pi},
PlotRange -> {Automatic, Automatic, {1/4, 2/3}},
BoxRatios -> {1, 1, 1/2},
AxesLabel -> (Style[#, 14, Bold] & /@ {r, φ, f})] The same plot with

Plot3D[f[r, φ], {r, 0, 1}, {φ, 0, 2 Pi},
PlotRange -> {Automatic, Automatic, {1/4, 2/3}},
BoxRatios -> {1, 1, 1/2},
AxesLabel -> (Style[#, 14, Bold] & /@ {r, φ, f})]

• Very nice observation about the integer values. Especially nice to learn that high ranking terms cancel (i.e., sum to zero) in the Infinite sum. Well done! – Jack LaVigne Jul 6 at 2:34

Replace

f[r_, φ_] := a0/2 + a


By

f[r_, φ_] = a0/2 + a Or leave your definition and use Evaluate. Read up on Hold and the plotting commands. Also Definition[f] is very useful.

ParametricPlot3D[{r, \[CurlyPhi], Evaluate[f[r, \[CurlyPhi]]]}, {r, 0,
1}, {\[CurlyPhi], 0, 2 Pi}]
`