## Plotting Scatter Plot to Spherical Coordinates

I’m trying to plot the natural numbers as spherical coordinates. Specifically, let $$S_n={x:xinmathbb{N},xleq n}$$. I want to plot $$(y,y,y) = (r,theta,varphi)$$, for all $$yin S_n$$. Basically, the radial distance, polar angle, and azimuthal angle would all be the same natural number.

How could I plot this?

## pr.probability – Almost evenly distributed spherical random vectors

Consider $$n$$ i.i.d uniformly distributed random vectors $$z_1 ,cdots , z_n in mathbb{S}^{d-1}$$. What is the best lower bound on $$n$$ for which whp there exists a constant $$c>0$$ such that the following bound holds for all $$vin mathbb{R}^dbackslash {0}$$:

$$begin{equation} cnleq leftvertleft{i:langle z_i,v rangle>0 right} rightvert end{equation}$$

## differential equations – Spherical Parallel Manipulator Lagrangian problem

I faced a very serious problem and I urgently need the help of specialists in robotics, mechanics, physics and mathematics.

I am trying to derive equations of motion from the Lagrangian of a spherical parallel manipulator based on work (3.2 Inverse dynamic modeling): https://www.sciencedirect.com/science/article/abs/pii/S0921889014001250

According to this article, the Lagrangian for the corresponding drive axle consists of two parts:

1. Lagrangian of distal and proximal links.

$$L_i=frac{1}{2}I_{l_1}theta_i^2+frac{1}{2}boldsymbol{omega_i}^Tboldsymbol{I}_{l_2}boldsymbol{omega_i}-m_{l_1}chi_1boldsymbol{g}^Tboldsymbol{h_i}-m_{l_2}chi_2boldsymbol{g}^Tboldsymbol{e_{ix}}$$

where $$boldsymbol{h_i}=frac{u_i+v_i}{||u_i+v_i||}$$;$$boldsymbol{e_{ix}}=frac{v_i+w_i}{||v_i+w_i||}$$; $$m_{l_1},m_{l_2},chi_1,chi_2,I_{l_1}$$ – masses, center of masses of proximal and distal links and moment of inertia of proximal link; $$u_i,v_i,w_i$$ – design vectors depending on design parameters of the mechanism, angles of rotation of drives and something else? …

1. Platform Lagrangian

$$L_p=frac{1}{2}boldsymbol{Omega}^Tboldsymbol{I}_{p}boldsymbol{Omega}-m_{p}Rcos(beta)g^Tboldsymbol{p}$$

where $$boldsymbol{p}$$ – unit vector of platform direction; $$boldsymbol{I}_{p}$$ – tensor of inertia of platform; $$boldsymbol{g}=(0;0;-9.81)^T$$;$$m_p,R,cos(beta)$$ – mass, radius of sphere and angle beetwen platform and center of rotation;

In general, the Lagrangian is written as follows:

$$L=L_1+L_2+L_3+L_p$$

In the article, the authors took as generalized coordinates:

$$boldsymbol{q}=(theta_1,theta_2,theta_3,phi,Theta,sigma)$$;

where – $$theta_1,theta_2,theta_3$$ – drive angle of rotation; $$phi,Theta,sigma$$ – platform angles of rotation;

Further, the authors derive the equations of motion according to the classical formula, but they do not give more visual and additional calculations:

$$frac{d}{dt}(frac{dL}{ddot{boldsymbol{q}}})-frac{dL}{dboldsymbol{q}}=0$$

From that moment on, I encountered problems of the following nature, which I cannot solve on my own:

1. Lagrangian structure assumes that the vector of generalized coordinates $$q$$ proposed by the authors lacks the position and velocity vector for the distal link and platform, i.e. $$q≠(theta_1,theta_2,theta_3,phi,Theta,sigma)$$, but $$q=(theta_1,theta_2,theta_3,boldsymbol{omega},boldsymbol{Omega})$$. Their generalized coordinates do not allow deriving the equations of motion, since angular velocity of the distal link $$boldsymbol{omega}$$ in the article there is no corresponding angular position.
2. Moments of inertia of the platform $$boldsymbol{I}_{p}$$ and the distal link $$boldsymbol{I}_{l_2}$$ are nonstationary and, strictly speaking, depend on the angle of rotation of the drives, i.e. from $$theta_1,theta_2,theta_3$$. There is absolutely no indication of this in the article, but this should be taken into account when deriving the equations of motion from $$L$$. But the question is that it is not clear what all these moments of inertia depend on – on the angle of rotation of the drives or on the angle of rotation of the platform, i.e. what to include in the Lagrangian, $$boldsymbol{I}_{p}(theta_1,theta_2,theta_3)$$ or $$boldsymbol{I}_{l_2}(phi,Theta,sigma)$$ ?
3. The third problem follows from the second and is connected with the fact that we can still find the coordinates of the design vectors $$u_i$$ and $$v_i$$ using the known design parameters and angles of rotation of the drive $$theta_1,theta_2,theta_3$$, but the position of the vector $$w_i$$ is calculated iteratively using the problem of direct kinematics, and one position of the drives $$theta_1,theta_2,theta_3$$ corresponds to 8 platform positions, i.e. it is impossible to establish a direct analytical connection between the angles of rotation of the drives $$theta_1,theta_2,theta_3$$ with the position of the platform $$phi,Theta,sigma$$ and the coordinates of the vector $$w_i$$, and therefore, it is impossible to differentiate the potential energy component of the Lagrangian $$L$$ by the generalized coordinate $$q$$.

Dear experts,
please help me understand the principle of working with this Lagrangian $$L$$ as soon as possible.
I would be grateful for your help in resolving these issues.
I have Mathematica, Maple and Simulink at hand and I am ready to do the proposed calculations and present the results.

Some excerpts from the article are presented below:

## equation solving – Spherical harmonics Y (l,m,theta,phi) for general l, m

I am trying to solve integrals involving spherical harmonics Y(l,m, theta, phi) and their derivatives. I do not have any particular l,m, theta, phi values. I need to solve it for general l,m. When I am putting particular l,m values(forex l=3,m=1), Mathematica evaluates it and gives the answer. However, if I keep l,m as it is, Mathematica is not giving output. I am new to programming and coding. The code I have written is

``````Y(l_, m_, (Theta)_, (Phi)_) :=
SphericalHarmonicY(l, m, (Theta), (Phi))

Ybar(l_, m_, (Theta)_, (Phi)_) :=
SphericalHarmonicY(l, m, (Theta), (Phi)) /. I -> -I

Integrate(
D(Y(3, 1, (Theta), (Phi)), (Theta)) D(
Ybar(4, 1, (Theta), (Phi)), (Theta)) Sin((Theta))
Cos((Theta)), {(Theta), 0, (Pi)}, {(Phi), 0, 2 (Pi)})
``````

Mathematica is evaluating this as I have put particular l,m values above.

However, If I write

``````Integrate(
D(Y(l, m, (Theta), (Phi)), (Theta)) D(
Ybar(L, m, (Theta), (Phi)), (Theta)) Sin((Theta))
Cos((Theta)), {(Theta), 0, (Pi)}, {(Phi), 0, 2 (Pi)})
``````

Mathematica is not giving any output for this. Can anyone help me with this? I need to solve the above integral keeping l,m as it is, without any particular values of l,m.
Can anyone suggest any code?

## How to represent Spherical Coordinate System unit vectors?

I have set the coordinate system to Spherical and then tried taking derivative of unit vectors with respect to spherical coordinates, but I didn’t get the result as shown in the textbooks.
i.e., given the input as D[UnitVector[3,2],{Ttheta}] but the output obtained as zero, whereas the textbook result is -r̂. How to quickly represent a Spherical unit vector in Mathematica?

## dg.differential geometry – Comparison inequality between Sobolev-seminorm w.r.t spherical uniform distribution and gaussian distribution

Let $$d$$ be a large positive integer. Let $$f:mathbb R^d to mathbb R$$ be a continuously differentiable function. Let $$X$$ be uniformly distributed on the unit-sphere $$S_{d-1} := {x in mathbb R^d |x| = 1}$$ and let $$Z$$ be a random vector in $$mathbb R^d$$ with iid coordinates from $$N(0,1/d)$$. Let $$nabla_{S_{d-1}}f:S_{d-1} to mathbb R^d$$ be the spherical gradient of $$f$$, defined by $$nabla_{S_{d-1}} f(x) :=(I_d-xx^top)nabla f(x)$$, where $$nabla f(x)$$ is the usual / euclidean gradient of $$f$$ at $$x$$.

Question. Is there any comparison inequality between $$mathbb E|nabla_{S_{d-1}} f(X)|^2$$ and $$mathbb E|nabla f(Z)|^2$$, meaning the existence of abolute constants $$c,C>0$$ independent of $$f$$ and $$d$$, such that $$c mathbb E|nabla_{S_{d-1}} f(X)|^2 le mathbb E|nabla f(Z)|^2 le C mathbb E|nabla_{S_{d-1}} f(X)|^2$$?

## Tangential component of a vector field to a spherical surface.

The problem is:
Vector E is given by
$$E = hat{R}5Rcos(theta) – hat{theta}frac{12}{R}sin(theta)cos(phi) +hat{phi}3sin(phi)$$
Determine the component of E tangential to the spherical surface $$R = 2$$ at point P($$2$$,$$30^circ$$,$$60^circ$$).

The solution to the above problem is (according to the solution manual):

At P, E is given by
$$E = hat{R}5(2)cos(30^circ) – hat{theta}frac{12}{2}sin(30^circ)cos(60^circ) +hat{phi}3sin(60^circ) = hat{R}8.67 – hat{theta}1.5 + hat{phi}2.6$$

The $$hat{R}$$ component is normal to the spherical surface while the other two are tangential.
Hence
$$E_t = -hat{theta}1.5 + hat{phi}2.6$$
End of solution

Now my question is, how do you know which components are tangential and which are perpendicular.

## sphericalharmonicy – Confirming orthogonality of spherical harmonics symbolically

One can confirm the orthogonality of the `SphericalHarmonicY`s for specific values of their parameters (`l, m, ll, mm`) as I showed in my solution here, but I have been unable to verify it for the general case, as in:

``````Assuming({l, ll, m, mm} ∈ Integers &&
-l <= m <= l && -ll <= mm <= ll ,
Integrate(
Conjugate(
SphericalHarmonicY(l, m, ϑ, φ))
SphericalHarmonicY(ll, mm, ϑ, φ)
Sin(ϑ),
{ϑ, 0, π}, {φ, 0, 2 π}))
``````

Are there any tricks, or assumptions, or other techniques that enable Mathematica to symbolically evaluate that integral (leading to a product of `KroneckerDelta` functions)? I even tried `FunctionExpand` to express each `SphericalHarmonicY` using exponentials and other simpler functions, but the integral was still not evaluated.

## dg.differential geometry – Spherical harmonics, \$frak{sl}_2\$, and algebra gradings

LEt $$S^2$$ be the usual $$2$$-sphere considered as the quotient $$S^3/S^1$$, and denote by $$mathrm{Pol}(S^2)$$ the algebra of polynomial functions on $$S^2$$. We can decompose $$mathrm{Pol}(S^2)$$ into its spherical harmonics, but here I would rather decompose them into simple $$frak{sl}_2$$-modules:
$$mathrm{Pol}(S^2) simeq bigoplus_{k in 2mathbb{N}} V_k.$$
This decomposition must surely not be an algebra grading ($$V_k.V_l$$ will surely not be contained in $$V_{k+l}$$). What is an easy way to prove this?

## plotting – Plot a figure in cartesian XY coordinates in 2D using spherical angles

I have the following equations in $$x$$, $$y$$, $$z$$ coordinates:

$$x = R_0(f(theta,phi)sin(theta)cos(phi) + partial_{theta}f(theta,phi)cos(theta)cos(phi) – partial_{phi}f(theta,phi)sin(phi)/sin(theta)$$

$$y = R_0(f(theta,phi)sin(theta)sin(phi) + partial_{theta}f(theta,phi)cos(theta)sin(phi) + partial_{phi}f(theta,phi)cos(phi)/sin(theta)$$

$$z = R_0(f(theta,phi)cos(theta) – partial_{theta}f(theta,phi)sin(theta)$$

with $$f(theta,phi) = 1 + frac{4epsilon_e}{1-4epsilon_e}(cos^4(theta) + sin^4(theta)(1 -2sin^2(phi)cos^2(phi)))$$

where $$epsilon_e = 0.047, R_0 = 15$$. Here, $$theta,phi$$ are spherical angles

Now, I would like to plot $$(x,y)$$ for $$epsilon_e = 0.047$$ and $$0$$

This is what I have tried:

``````f((Theta)_, (Phi)_) :=
1 + ((4 Subscript((Epsilon), e))/(
1 - 3 Subscript((Epsilon), e)))((
Cos^4)((Theta)) + (
Sin^4)((Theta)) (1 - 2 (Sin^2)((Phi)) (Cos^2)((Phi)) ))
x = Subscript(R, 0)(
f((Theta)_, (Phi)_) Sin((Theta)) Cos((Phi))  +
Diff(f((Theta)_, (Phi)_), (Theta)) Cos((Theta)) Cos((Phi)) -
Diff(f((Theta)_, (Phi)_), (Phi)) Sin((Phi))/Sin((Theta)))

y = Subscript(R, 0)(
f((Theta)_, (Phi)_) Sin((Theta)) Sin((Phi))  +
Diff(f((Theta)_, (Phi)_), (Theta)) Cos((Theta)) Sin((Phi)) +
Diff(f((Theta)_, (Phi)_), (Phi)) Cos((Phi))/Sin((Theta)))

z = Subscript(R, 0)(
f((Theta)_, (Phi)_) Cos((Theta)) -
Diff(f((Theta)_, (Phi)_), (Theta)) Sin((Theta)))
``````

Can anyone suggest how to proceed forward to plot in XY-2D plane ? Do I have to use SphericalPlot or ListPlot?