0
$\begingroup$

I would like to plot a specific function I have come up with (as part of a solution to a certain ODE) in Maple. It looks like this and involves the HeunG function: $$ \frac{r \sqrt{1-r^2} }{1+r^2} \mathrm{HeunG}(-1,-3,0,\frac{1}{2},\frac{5}{2},1,r^2) $$ or in Maple code:

y:= r -> r*sqrt(-r^2 + 1)*HeunG(-1, -3, 0, 1/2, 5/2, 1, r^2)/(r^2 + 1)

If I call

plot(y(r^2), r = 0 .. 1)

Maple evaluates for a while and finally gives me an error saying it has lost connection with the Maple kernel and I have to restart Maple:

Screenshot of the error message

Otherwise, Maple works fine for me! Why is this happening? Is there any way I could plot this function? I am a new to Maple - so please excuse me if this question is simple to resolve.

EDIT: It has been suggested below that I try to evaluate the function only at finitely many points. For the expression I have given, this actually works! Now the truth is that I have to evaluate a more complicated expression (not worth reproducing here) that involves the derivative, i.e. HeunGPrime. The following code leads to the same error:

eval(HeunGPrime(-1, -3, 0, 1/2, 5/2, 1, r^2), r = 0.8)

I found that one way of getting around this issue is to use

fdiff(HeunG(-1, -3, 0, 1/2, 5/2, 1, r^2), r = 0.8)

instead. This allows to create an array of values and plot like this:

step := 0.1;
with(plots);
listplot([seq([i*step, eval(expr(1, 1, r), r = i*step)], i = 1 .. 10)]);

where I have replaced my complicated function with expr.

$\endgroup$
1
  • $\begingroup$ That's a bug - you should report it. $\endgroup$ May 10, 2019 at 11:38

1 Answer 1

1
$\begingroup$

Try generating a table of values, for instance for $r = 0, 0.1, \cdots, 1$. This may already give you a rough idea of the graphic (decrease the step as needed). I'm suggesting this dumb approach because maybe the plot command is oversampling and calling HeunG an excessive number of times.

$\endgroup$
1
  • $\begingroup$ It's not dumb at all :-) See also my edit and thank you for the hint! $\endgroup$
    – Max
    May 9, 2019 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .