Physics Forums

## gradient of spherical co-ords/ differentiation help

1. The problem statement, all variables and given/known data
h(sph)=exp(r2sin2($$\theta$$)sin2($$\phi$$)+r2cos2($$\theta$$))

need to find gradient of this function, i have er and etheta.... but can someone please tel me why when maple differentiates with respect to phi, why does it say it equals zero????

coz i get (2r2sin2($$\theta$$)sin($$\phi$$)cos($$\phi$$)*h)ephi

PhysOrg.com  science news on PhysOrg.com  >> Front-row seats to climate change>> Attacking MRSA with metals from antibacterial clays>> New formula invented for microscope viewing, substitutes for federally controlled drug

MY ORIGINAL cartesian function was h(x,y,z)=exp(y2+z2) then i converted it.... i know once i get dh/dphi i have to multiply it by 1/rsin(theta) but maple says that dh/dphi=0???? how can that be since dh/dtheta works???

if anyone doesnt know im trying to find dh/dphi... to get (1/rsin(theta))(dh/dphi).... and apparently it equals 0... and i cant found out y...

Recognitions:
Homework Help

## gradient of spherical co-ords/ differentiation help

I think the problem lies with what $\theta$ and $\phi$ are. In physics the azimuth and zenith are often reversed. So what convention does your book use? In this case differentiation with respect to $\phi$ does not yield 0 where as differentiation with respect to $\theta$ does yield 0. So I am pretty sure you're using the wrong convention.

Secondly why do you even bother to transform that function into spherical coordinates?

i dont know, its what my hw said sheet said to do....   and my book states that r=root(x^2+y^2+z^2) theta=arccos(z/r) and phi=arctan(y/x)..... something like that?? sorry im unsure what you mean by convention... and what do mean the diff with respect to theta equals 0??? how did you get that?

and the gradh in cart co-ords is (0,2y*exp(y^2+z^2),2z*exp(y^2+z^2)) can just apply spherical co-ords straight from gradh????

Recognitions:      Homework  Help  There are two different conventions.  1) The mathematics convention where the azimuth, the angle between the x-axis and the radius in the x-y plane, is called $\theta$ and the zenith, the angle between the z axis and the radius is called $\phi$  2)The physics convention where the azimuth, the angle between the x-axis and the radius in the x-y plane, is called $\phi$ and the zenith, the angle between the z axis and the radius is called $\theta$  Read this carefully, draw a picture perhaps so that you fully understand the difference.  The definition in your book has $\theta$ as the zenith. Where as seeing as maple gives 0, has $\phi$ as the zenith. Do you understand why maple gets zero and you get a non-zero value now?  Write down the definition of the gradient in spherical coordinates (on the forum) and label each term with, radius, zenith, azimuth. Since you want to find the $\phi$ term you will need to use which term in the definition of the gradient given the convention used in the book? Since maple uses the other convention which term did maple use?  And no you can't just apply spherical coordinates straight after taking the Cartesian gradient.

ok then this is for maths, and r is length, theta is angle measured down form z axis, and phi is angle measured from x axis. ok i think i understand, what you are saying but if maple is opposite to my book, then does that mean that etheta is 0?? then definition of grad in sperical in my book is   f(r,$$\theta$$,$$\phi$$) then graf=($$\partial$$f/$$\partial$$r)er+(1/r)($$\partial$$f/$$\partial$$$$\theta$$)etheta+(1/r*sin$$\theta$$)($$\partial$$f/$$\partial$$$$\phi$$)ephi  does that help?

so will my answer have a zero??? or is just rigth to do what i did... or how do u change maple to do what i want?

Recognitions:      Homework  Help  Even though this may be for maths the convention your book uses is the convention I labeled the physics convention. It doesn't really matter though feel free to call it anything you want as long as you always pay attention to how $\phi$ and $\theta$ are defined. This way you can use the appropriate convention.  So the gradient your book gives you is:  $$\nabla f=\frac{\partial f}{\partial r}e_r+\frac{1}{r} \frac{\partial f}{\partial \theta}e_\theta+\frac{1}{r \sin \theta} \frac{\partial f}{\partial \phi}e_\phi$$  maple: $$\nabla f=\frac{\partial f}{\partial r}e_r+\frac{1}{r} \frac{\partial f}{\partial \phi}e_\phi+\frac{1}{r \sin \phi} \frac{\partial f}{\partial \theta}e_\theta$$  So if you want to know the $\phi$ component then you have to use the the $\theta$ component in maple while also switching all $\theta s$ and $\phi s$ in the definitions of x,y,z in spherical coordinates. Nice and confusing isn't it?  Just calculate all three terms and I will check if you got the correct answer or not.  I would really suggest you do it by hand instead of using some function in a program you don't now its definition of.

ok yes, well for etheta i get  ((2r2sin$$\theta$$sin2$$\phi$$cos$$\theta$$)-2r2cos$$\theta$$sin$$\theta$$*h)/r???? which does not equal zero???

Recognitions:      Homework  Help  I made an error in the last sentence of my previous post. I will fix it. If you include the exponent your answer is the correct one. You can simplify it a bit if you like.

so all three should be...  (2rsin2$$\theta$$sin2$$\phi$$+2rcos2$$\theta$$)exp(...)er  ((2r2sin$$\theta$$sin2sin$$\phi$$cos$$\theta$$-2r2cos$$\theta$$sin$$\theta$$)/r)exp(...)etheta  ((2r2sin2$$\theta$$sin$$\phi$$cos$$\theta$$)/(rsin$$\theta$$))exp(....)ephi   ???? idk, just doesnt look right

Recognitions:      Homework  Help  In the third one the cosine should read  $\cos \phi$. The others seem correct. Try to simplify the second one by using $\sin 2x=2 \sin x \cos x$ and $\sin^2x+\cos^2x=1$.

ok ty heaps for ur help = ) very much appreciated

Thread Tools

|                                                                          |                            |         |
|--------------------------------------------------------------------------|----------------------------|---------|
| Similar Threads for: gradient of spherical co-ords/ differentiation help |                            |         |
| Thread                                                                   | Forum                      | Replies |
|                                                                          | Calculus & Beyond Homework | 13      |
|                                                                          | Calculus & Beyond Homework | 5       |
|                                                                          | Calculus & Beyond Homework | 14      |
|                                                                          | Differential Geometry      | 3       |
|                                                                          | Calculus & Beyond Homework | 7       |
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 20, "mathjax_display_tex": 36, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9310598373413086, "perplexity_flag": "middle"}