I'm new to Mathematica. I used it to integrate the scalar field(adsbygoogle = window.adsbygoogle || []).push({});

[tex]f:\mathbb{R}^3 \to \mathbb{R} \; \bigg| \;f(x,y,x)=z^2[/tex]

over the top half of a unit sphere centered on the origin, paramaterising this surface with

[tex]\phi: \mathbb{R}^2 \rightarrow \mathbb{R}^3 \; \bigg| \; \phi(r,\theta)=(r \cos \theta, r \sin \theta, \sqrt{1-r^2})[/tex]

so that

[tex]f(\phi(r,\theta))=1-r^2.[/tex]

I set up the integral like this:

[tex]\int_R f(\phi(r,\theta))\left \| \partial_r \phi \times \partial_\theta \phi \right \| dr d\theta = \int_0^{2\pi} \int_0^1 r \sqrt{1-r^2} \; dr d\theta = \frac{2 \pi}{3}[/tex]

where the partial sign (curly d) with subscript variable stands for the partial derivative with respect to that variable, ||v|| denotes the norm (a.k.a. magnitude) of a vector v, and the times symbol, x, is the cross product of vectors.

In Mathematica, I was able to calculate this as follows:

phi={r*Cos[theta],r*Sin[theta],Sqrt[1-r^2]}; Integrate[phi[[3]]^2*Norm[Cross[D[phi,r],D[phi,theta]]],{theta,0,2*Pi},{r,0,1}]

and also, in the following two different ways, by plugging in the already simplified integrand:

Integrate[r*Sqrt[1-r^2],{theta,0,2*Pi},{r,0,1}]

Integrate[Integrate[r*Sqrt[1 - r^2], {r, 0, 1}], {theta, 0, 2*Pi}]

But the last of these methods didn't work when I used the unsimplified expression phi[[3]]^2*Norm[Cross[D[phi,r],D[phi,theta]]] in place of r*Sqrt[1 - r^2].

Integrate[

Integrate[

phi[[3]]^2*Norm[Cross[D[phi, r], D[phi, theta]]], {r, 0,

1}], {theta, 0, 2*Pi}]

It took a long time to calculate, then produced many lines of complicated symbolic expressions involving complex numbers and hyperbolic trig functions. A similar thing happened when I asked it to calculate just the inner integral:

Integrate[phi[[3]]^2*Norm[Cross[D[phi, r], D[phi, theta]]], {r, 0, 1}]

Can anyone tell me what went wrong: why the simplified expression worked with both methods, Integrate[ ,{ },{ }] and Integrate[Integrate[ ,{ }],{ }], but the equivalent full one only worked by the first method, Integrate[ ,{ },{ }]? Something to do with the order of operations that leads it to try dividing by something unpleasant, or am I making an elementary syntactic mistake?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Integration in Mathematica

**Physics Forums | Science Articles, Homework Help, Discussion**