7.118 Bug in plot in Maple V.5 (15.3.99)

7.118.1 Luis Goddyn
7.118.2 Robert K Wright (24.3.99)
7.118.3 Helmut Kahovec (24.3.99)

7.118.1 Luis Goddyn

Why does plot get stuck on this constant function? Is it trying to simplify before plotting? Be sure to save your work first!

> restart; interface(version); kernelopts(version); 
 
          TTY Iris, Release 5, SUN SPARC SOLARIS, Jan 11 1998 
  Maple V, Release 5, SUN SPARC SOLARIS, Jan 11 1998, CAW-55CD-951412-7 
 
> p :=  (sqrt(2)*exp(t) + 1) * (sqrt(2)*exp(t) - 1); 
 
                      1/2               1/2 
               p := (2    exp(t) + 1) (2    exp(t) - 1) 
 
> q :=  2*exp(t)^2 - 1; 
                                       2 
                          q := 2 exp(t)  - 1 
 
> simplify(expand(p)/q);  # Note: simplify(p/q) fails, even with options! 
 
                                  1 
 
> plot(p/q, t=0..1);
 

[Comments: TTY freezes here, ^C to get out. X11 and MWI interfaces also freeze.]

Plotting error, buffer_read: read failed

It is corrected with Maple 6. (U. Klein)

7.118.2 Robert K Wright (24.3.99)

The problem is not related to the use of exp(t). See below:

> interface(version); 
   Maple Worksheet Interface, Release 5, IBM INTEL NT, May 11 1998 
> kernelopts(version); 
   Maple V, Release 5, IBM INTEL NT, May 08 1998, WIN-55CD-314159-2 
 
> p:= (a*x-1)*(a*x+1); 
 
> q:= a^2*x^2-1; 
 
> a:= 3: 
 
> plot(p/q,x=1..2);
 

No problem for a nonradical.

Now assign a:= sqrt(2) and try plot(p/q,x=1..2):

The Maple session hangs. In windows I can’t save any of this if Maple is hung, so I’m saving now.

(If you try the same example on an HP workstation with Maple V Release 5.1 you get the same result. Don’t try to stop the Maple session by typing ^C! You are not able to stop the process! You have to reboot the workstation or you have to wait for the core dump.

I found the bug some months before. As a workaround you can use a := evalf(sqrt(2)); (instead of a := sqrt(2);) and you will get the plot immediately. U. Klein)

7.118.3 Helmut Kahovec (24.3.99)

If you execute the following statements in a fresh Maple session then everything works fine. However, if you remove the # character in the definition of my_args then Release 5 crashes when it processes INTERFACE_PLOT(my_args).

> restart; 
 
> my_args:= 
>   CURVES( 
>     [ 
>       [0.0, 1.], 
> #      [0.5, 1.000000000000001], 
>       [1.0, 1.] 
>     ], 
>     COLOUR(RGB,1.0,0,0) 
>   ), 
>   AXESLABELS("t",``), 
>   VIEW(0 .. 1.,DEFAULT): 
> INTERFACE_PLOT(my_args);
 

INTERFACE_PLOT() is called in `print/PLOT`() as you may verify by debugging any plot() statement and setting the breakpoint by stopat(`print/PLOT`). Its source code is:

> `print/PLOT`:=proc() 
>   subs( 
>     {('undefined')=('FAIL'),('INTERFACE_TEXT')=('TEXT')}, 
>     INTERFACE_PLOT(args) 
>   ) 
> end:
 

`print/PLOT`() is called at the final processing stage of any plot() statement when the plot structure has already been computed successfully. INTERFACE_PLOT() transfers the data of the plot structure from the Maple kernel to the Maple front-end program. Apparently, that part of the Release 5 software cannot correctly handle a mixture of data points with ordinate values of 1. and 1.+EPS. EPS is the smallest value different from 0 recognized by the CPU.

Since Maple cannot (automatically) simplify the expression

> expr:=(sqrt(2)*exp(t)+1)*(sqrt(2)*exp(t)-1)/(2*exp(2*t)-1); 
 
                  (sqrt(2) exp(t) + 1) (sqrt(2) exp(t) - 1) 
          expr := ----------------------------------------- 
                               2 exp(2 t) - 1
 

to 1 plotting expr gives a lot of data points with ordinate values of 1.+EPS. Since they are mixed with 1. your plot statement crashes at that very point.