8.27 CodeGeneration[C] and hypergeom(..) (3.12.02)

8.27.1 Charles James Leonardo Quarra Cappiello
8.27.2 Stephen Forrest (5.12.02)

8.27.1 Charles James Leonardo Quarra Cappiello

The solution of this equation

>with(DEtools); 
>DO:=(cos(x)*sin(x)/y(x))*diff( cos(x)*sin(x)*diff( y(x),x) ,x ) - 
      l^2*sin(x)^2 - m^2*cos(x)^2 = -k*(k+2)*cos(x)^2 * sin(x)^2;
 
is given as:
>SetSolutions:=dsolve( DO ); 
SetSolutions := y(x) = _C1 hypergeom( 
                                                                  2 
      [- m/2 + 1 + l/2 + k/2, - m/2 + l/2 - k/2], [1 + l], cos(x) ) 
 
            l             (- m/2)             (- m/2) 
      cos(x)  (cos(x) + 1)        (cos(x) - 1)        + _C2 
 
      hypergeom([- m/2 + 1 - l/2 + k/2, - m/2 - l/2 - k/2], [1 - l], 
 
            2        (-l)             (- m/2)             (- m/2) 
      cos(x) ) cos(x)     (cos(x) + 1)        (cos(x) - 1)
 

Now the questions is that i want to get a direct algorithm for the evaluation of this solution, in particular the hypergeom part, but the naive approach fails:

> with(CodeGeneration); 
> C(_C1*hypergeom([-1/2*m+1+1/2*l+1/2*k, 
    -1/2*m+1/2*l-1/2*k],[1+l], 
    cos(x)^2)*cos(x)^l*(cos(x)+1)^(-1/2*m)*(cos(x)-1)^(-1/2*m) 
    +_C2*hypergeom([-1/2*m+1-1/2*l+1/2*k, 
    -1/2*m-1/2*l-1/2*k],[1-l], 
    cos(x)^2)*cos(x)^(-l)*(cos(x)+1)^(-1/2*m)*(cos(x)-1)^(-1/2*m));
 

8.27.2 Stephen Forrest (5.12.02)

CodeGeneration[C] just translates your Maple expression to C in the obvious way, sum to sum, function call to function call, etc.

It won’t expand the hypergeom call or provide you with a C procedure to evaluate it.

You’ll have to either find a way of converting your hypergeometric function within Maple to something CodeGeneration can handle, or find or write a C library to handle hypergeometric functions.

Sometimes convert(..., StandardFunctions) is helpful for the former: in this case, it doesn’t seem to be.