# Cassini-Soldner

## Definitions from EPSG guidance notes

T: tan(φ) ²;

A: λ * cos(φ);

A2: A*A;

A3: A2 * A;

A4: A2 * A2;

C: e² * cos(φ)² / (1 - e²);

Q: T - 8*(C + 1);

rν: sqrt(1 - e² * sin(φ)²);

x: (A - T*A3/6 + Q*T*(A3*A2) / 120) / rν;

y: tan(φ)*(A²/2 + (5 - T + 6*C)*A^4 / 24) / rν;

## Derivatives

### ∂x/∂λ

The substituted variables have the "s" subscript for differentiating them from the definitions above.
∂x/∂λ = (cosφ / rν) * following expression:

ratsubst(A_s, A, subst(T_s, T, subst(Q_s, Q, multthru(1/cos(φ), diff(x,λ) * rν))));

### ∂x/∂φ

Note that A = λ * cosφ can be substituted in many places (I didn't found how to instruct Maxima to do that).

subst(rν_s, rν, subst(C_s, C, subst(C_s, C, diff(x,φ))));

### Manual simplification

See source code for definition of symbols B, D, V and W.

implemented: B * (λ²*V - W + B²*(λ² + 8*C_s*A_s²)/60 +(D*(B²*V/2 + 1) - 1)*ν);

### ∂y/∂λ

∂y/∂λ = (1/rν) * following expression:

diff(y, λ)*rν;

### ∂y/∂φ

I didn't found how to simplify the following formula with WxMaxima. The simplification has been done by hand.

dy_dφ: diff(y, φ);

### Manual simplification

See source code for definition of symbols B and S.

imlemented: (B²*ν) * ((S/4 + 1/2)*((cos(φ)*e*ν)² + (csc(φ))²) - (S+1 + A_s²*C_s/2 + λ²/12));