Register to reply

Mathematica: plot and evaluate function of 2 variables

by hasidim
Tags: mathematica, sphericalplot3d
Share this thread:
hasidim
#1
Oct12-10, 10:37 AM
P: 15
Hi all,

I am trying to evaluate and plot a function of two variable in mathematica.

Function:

R(t,\theta) = a(t) + b(t)*Y_n(\theta)
Where a(t) and b(t) are functions (that I have evaluated already), and Y is the spherical harmonic for a given n, and R is the radius.

In mathematica I am unsure how to evaluate and plot a function of two variables in spherical coordinates. I attempted to use "SphericalPlot3D" to plot R as a function of \theta and \phi, and "Manipulate" to add a slider to adjust the time but am having no luck.

Any help would be APPRECIATED!!!
Phys.Org News Partner Science news on Phys.org
New type of solar concentrator desn't block the view
Researchers demonstrate ultra low-field nuclear magnetic resonance using Earth's magnetic field
Asian inventions dominate energy storage systems
Bill Simpson
#2
Oct12-10, 03:30 PM
P: 1,037
Is this something like what you are trying to do?

a[t_] := 2t; b[t_] := t^2; m = 1;(* < --- Substitute your functions here *)
R[t_, n_, m_, theta_, phi_] := a[t] + b[t]*SphericalHarmonicY[n, m, theta, phi]
Manipulate[SphericalPlot3D[R[t, n, m, theta, phi], {theta, 0, 2Pi}, {phi, 0, Pi}], {t, 0, 1}, {n, 0, 4, 1}]

Can you perhaps adapt this for what you need?
hasidim
#3
Oct12-10, 03:39 PM
P: 15
Quote Quote by Bill Simpson View Post
Is this something like what you are trying to do?

a[t_] := 2t; b[t_] := t^2; m = 1;(* < --- Substitute your functions here *)
R[t_, n_, m_, theta_, phi_] := a[t] + b[t]*SphericalHarmonicY[n, m, theta, phi]
Manipulate[SphericalPlot3D[R[t, n, m, theta, phi], {theta, 0, 2Pi}, {phi, 0, Pi}], {t, 0, 1}, {n, 0, 4, 1}]

Can you perhaps adapt this for what you need?
That is pretty similar to what I have tried... but, I'll try copying that and modifying it.

As usual, I suspect that I am missing just one small detail.

Bill Simpson
#4
Oct12-10, 09:16 PM
P: 1,037
Mathematica: plot and evaluate function of 2 variables

If your modification doesn't work then divide the problem into simpler tasks.
Confirm that
SphericalPlot3D[SphericalHarmonicY[1, 2, theta, phi]], {theta, 0, 2Pi}, {phi, 0, Pi}]
plot matches http://mathworld.wolfram.com/SphericalHarmonic.html
and substitute a few other values for the 1 and 2.
Then try a simpler Manipulate example using a Real and Integer value from the Help and confirm that works. That might uncover some of your missing details.


Register to reply

Related Discussions
Mathematica: Animated plot sphere as function of time Math & Science Software 1
Plot two variables as a function of the third one Math & Science Software 8
Plot inverse function Mathematica Math & Science Software 5
Contour plot of a function of other functions (rather than variables) in Mathematica Math & Science Software 1
How do i plot a function of two variables in mathematica? Math & Science Software 3