# Simplifying numerical expressions involving special functions

I've encountered the following problem. There is the identity that the special functions EllipticK[x] and EllipticE[x] satisfy:

$$K(x)E(1-x)+E(x)K(1-x)-K(x)K(1-x)=\frac{\pi}{2}$$

Mathematica does not seem to know it so I included it into assumptions:

$Assumptions = EllipticK[x] EllipticE[1 - x] + EllipticE[x] EllipticK[1 - x] - EllipticK[x] EllipticK[1 - x] == Pi/2  If I now evaluate Simplify[EllipticK[x] EllipticE[1 - x] + EllipticE[x] EllipticK[1 - x] - EllipticK[x] EllipticK[1 - x]]  I will get Pi/2, fine. The problem is that I want this identity to be used not only symbolically but also numerically, i.e. for example I would like Mathematica to simplify Simplify[EllipticE[2/3] EllipticK[1/ 3] + (EllipticE[1/3] - EllipticK[1/3]) EllipticK[2/3]]  down to Pi/2. Not only It does not happen when I just stated this identity symbolically but even direct evaluation with this assumption does not yield desirable answer. Namely, FullSimplify[ EllipticE[2/3] EllipticK[1/ 3] + (EllipticE[1/3] - EllipticK[1/3]) EllipticK[2/3], Assumptions -> EllipticE[2/3] EllipticK[1/ 3] + (EllipticE[1/3] - EllipticK[1/3]) EllipticK[2/3] == Pi/2]  returns EllipticE[2/3] EllipticK[1/ 3] + (EllipticE[1/3] - EllipticK[1/3]) EllipticK[2/3]  How can I get Pi/2 there instead? - ## 1 Answer The following transformation function works in this case: xfn[e_] := e /. EllipticK[x_] EllipticE[y_] /; x + y == 1 :> Pi/2 - (EllipticE[x] EllipticK[y] - EllipticK[x] EllipticK[y]); FullSimplify[ EllipticE[2/3] EllipticK[1/3] + (EllipticE[1/3] - EllipticK[1/3]) EllipticK[2/3], TransformationFunctions -> {Automatic, xfn}] (* π/2 *)  Edit: The reason the using $Assumptions does not work as it is used in the question is that the assumption is effectively about the symbol x. It will not be used as a general identity about elliptic functions.

For instance, having the assumption in terms of x and the expression in terms of y results in no simplification:

Block[{\$Assumptions =
EllipticK[x] EllipticE[1 - x] + EllipticE[x] EllipticK[1 - x] -
EllipticK[x] EllipticK[1 - x] == Pi/2},
Simplify[EllipticK[y] EllipticE[1 - y] +
EllipticE[y] EllipticK[1 - y] - EllipticK[y] EllipticK[1 - y]]
]

(* EllipticE[y] EllipticK[1 - y] + (EllipticE[1 - y] - EllipticK[1 - y]) EllipticK[y] *)


If the xa are changed to ys, or vice versa, the output will be π/2.

-
Thank you! Suggested method indeed works. –  Weather Report Apr 3 '13 at 9:35