## Rotated pole

### Forward conversion

### Geographic to Cartesian

x: cos(λ) * cos(φ);

y: sin(λ) * cos(φ);

z: sin(φ);

### Latitude rotation

xr: cos(φ_p) * z - sin(φ_p) * x;

yr: y;

zr: -cos(φ_p) * x - sin(φ_p) * z;

### Cartesian to spherical (rotated)

R2: xr*xr + yr*yr;

R: sqrt(R2);

λ_r: atan2(yr, xr);

φ_r: asin(zr);

### Redudant terms

Following terms are repeated many times in the derivative results. For making formulas smaller, they will be substituted.

xsinφp: x*sin(φ_p);

xcosφp: x*cos(φ_p);

zsinφp: z*sin(φ_p);

zcosφp: z*cos(φ_p);

cc: cos(φ)*cos(φ_p);

cs: cos(φ)*sin(φ_p);

cλss: cos(λ)*zsinφp;

cλsc: cos(λ)*zcosφp;

dxφ: cλss + cc;

dyφ: cs - cλsc;

mzt: zsinφp + xcosφp;

xr: zcosφp - xsinφp;

y2s: y*y*sin(φ_p);

Ry: R2 + mzr*mzr;

### Derivative

Only one derivative is shown. To see the others, edit the variables in diff(φ_r,λ). For making formulas smaller, some terms are substituted by the variables defined above. The substituted variables have the "s" subscript for differentiating them from the definitions above.

subst(x_s, x, subst(y, y, subst(z_s, z, subst(cc_s, cc, subst(cs_s, cs,
        subst(zcosφp_s, zcosφp, subst(zsinφp_s, zsinφp, subst(xcosφp_s, xcosφp, subst(xsinφp_s, xsinφp,
                subst(cλss_s, cλss, subst(cλsc_s, cλsc, subst(dxφ_s, dxφ, subst(dyφ_s, dyφ,
                        subst(mzt_s, mzt, subst(xr_s, xr, subst(R2_s, R2, subst(Ry_s, Ry, subst(R_s, R, diff(φ_r, φ)))))))))))))))))));