Plotting (complex?) functions



["Andrey G. Grozin" <A.G.Grozin at inp.nsk.su>, Mon, 18 Sep 2006 21:58:52 +0700 (NOVST)]:
> I am *very much* against this (proposed) behaviour, because it makes no 
> sense:

+1, especially as it is not always easy (or at least, not convenient
quite often) to control the precise form of the result in a CAS
computation.

Furthermore, the desired restriction can presumably be added quite
easily by the user.  An ugly and cumbersome attempt, little tested,
that seems to work:

  ensure_real(x) := if freeof(%i, x)
                    then x
                    else throw('notReal) $
 
  my_illdefined_realonly_plot2d(funs,[stuff]) :=
    apply(plot2d,
          cons(funmake(catch,
                       [subst(ensure_real, 'ensure_real_aux,
                              scanmap('ensure_real_aux,
                                      funs,
                                      'bottomup))]),
               stuff)) $

At least 

  my_illdefined_realonly_plot2d(sqrt(x-2) * sqrt(x-4), [x,-5,5]) $

gives a maxout.gnuplot (no gnuplot installed here) that only contains
data for x>=4.

HTH,

Albert.