(new to Mathematica)

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

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

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

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

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

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

RowBox[{"(", "4", ")"}],
MultilineFunction->None]\)[u] (g^\[Prime]\[Prime])[u] - 1.5 
RowBox[{"(", "3", ")"}],

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].

enter image description here


There are several ways to do this, but the following code

ruleg = Derivative[1][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[10]. 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[1][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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.