# FullSimplify does not work well (require answer in terms of a particular variable)

(new to Mathematica)

I am trying to simplify the Schwarzian derivative of f w.r.t. u.(In). Here f is prime of Weierstrass function (In) which has some constraints (In)

In:= f[u_] := D[g[u], u]

In:= f[u]^2 == 4 g[u]^3 - a*g[u] - b

Out= Derivative[g][u]^2 == -b - a g[u] + 4 g[u]^3

In:= FullSimplify[f'''[u]/f'[u] - 1.5 f''[u]^2/f'[u]^2]


gives the output (for some reason Out is of this form on copying)

(
\!$$\*SuperscriptBox[\(g$$,
TagBox[
RowBox[{"(", "4", ")"}],
Derivative],
MultilineFunction->None]\)[u] (g^\[Prime]\[Prime])[u] - 1.5
\!$$\*SuperscriptBox[\(g$$,
TagBox[
RowBox[{"(", "3", ")"}],
Derivative],
MultilineFunction->None]\)[u]^2)/(g^\[Prime]\[Prime])[u]^2


The output is in terms of primes of g[u] and the expression is not simplified. Any help is appriciated. I would prefer if the answer was a function of g[u]. There are several ways to do this, but the following code

ruleg = Derivative[g][u] :> f[u];
f[u_] := Sqrt[4 g[u]^3 - a g[u] - b];
dg[ex_] := D[ex, u] /. ruleg // Simplify;
f0 = f[u]; f1 = dg[f0]; f2 = dg[f1]; f3 = dg[f2];
S = f3/f1 - 3/2 f2^2/f1^2 // Factor;
S /. g[u] -> g // InputForm


returns the result

(12*(2*a*b + 3*a^2*g + 48*b*g^2 + 16*a*g^3 - 48*g^5))/(a - 12*g^2)^2


which agrees with the result that I found using PARI/GP. Notice the InputForm which allows me to simply copy/paste the result. Without it you get convoluted mess that you found with Out. Notice the dg[] which returns the simplified derivative wrt u using ruleg to replace g'[u] with f[u] defined as the square root of the Weierstrass cubic.

NOTE: For those readers not familiar with the Weierstrass p-function $$\wp(z)$$, it satisfies the differential equation $$\wp'(z)^2 = 4\wp^3 - g_2\wp(z) - g_3.$$ Read the documentation for InverseWeierstrassP for some context. The question just renames $$z,\wp,\wp',g_2,g_3$$ into the cubic elliptic curve equation $$f(u)^2 = 4\ g(u)^3 -a\ g(u)- b.$$ Using this equation, we can express the first derivative of $$\wp$$ as $$f(u)$$ by taking the square root as in the definition f[u_]. We want to express higher derivatives of $$f(u)$$ also in terms of $$g(u)$$ using the equation relating $$f(u)$$ to $$g(u)$$. We can do this by first taking the derivative wrt $$u$$ of any expression involving $$g(u)$$, and then make the substitution of $$f(u)$$ in place of $$g'(u)$$. That is what the function dg[] does. Otherwise, Mathematica does not know that g'[u] == f[u] unless we use a rule to allow it to make the substitution whenever it finds g'[u]. There are other ways to get Mathematica to do the right thing, but I used a simple way to do it. An alternate way is this simple code

Derivative[g] ^= Function[u, Sqrt[4 g[u]^3 - a g[u] - b]];
f[u_] := g'[u] ; S = f'''[u]/f'[u] - 3/2 f''[u]^2/f'[u]^2 // Factor;


which uses UpSet[] to place a rule to evaluate g'[] in the Derivative[] function as inUpValues. This way is slicker, and does a specific thing which may be closer to what you wanted. My original method is more general.

• Thank you. Can you please explain why f'[u] does not work but defining it as D[f0, u] does? – wanabephysicist May 30 at 23:57
• @wanabephysicist Please read my lengthy NOTE. – Somos May 31 at 0:48