[metapost] Built-in functions

Robert Jerrard rjerrard at math.concordia.ab.ca
Thu Sep 28 21:55:01 CEST 2006


Hello all, I have been using MetaPost for a while now and quite like
it. I am using MetaPost 0.641 on a Debian system.

Built-in functions, as far as I can tell include x**p but I have seen no
restriction on the value of p. Consequently, I was surprised that
putting   

funca=(xtmin*ux,((xtmin-2)**(1/3)+1)*uy)
    for ix=xtmin step ddx until xtmax:
      ..(ix*ux,((ix-2)**(1/3)+1)*uy)
    endfor
    ..((xtmax)*ux,((xtmax-2)**(1/3)+1)*uy);

in an mp file in an attempt to draw a cube root function lead to an
error messages:

********************************************************************
! Undefined power: -5**0.33333.
<to be read again> 
                   ;
hide->exitif.numeric.begingroup(TEXT0);
                                       endgroup;
takepower->...&decimal(EXPR1)&"**"&decimal(EXPR0))
                                                  fi.fi
<to be read again> 
                   +
l.1643   funca=(xtmin*ux,((xtmin-2)**(1/3)+
                                           1)*uy)
? 
! Emergency stop.
<to be read again> 
                   ;
hide->exitif.numeric.begingroup(TEXT0);
                                       endgroup;
takepower->...&decimal(EXPR1)&"**"&decimal(EXPR0))
                                                  fi.fi
<to be read again> 
                   +
l.1643   funca=(xtmin*ux,((xtmin-2)**(1/3)+
                                           1)*uy)
49 output files written: Graphs.1 .. Graphs.49
Transcript written on Graphs.log.
********************************************************************

Is it not possible to do a cube root?

Also, is there a built-in log function of any base, can not see one in any documentation?

Thanks for any help, Bob
-- 
Dr. Robert J. Jerrard, Professor of Mathematics,
Concordia University College of Alberta,
7128 Ada Blvd., Edmonton, Alberta, T5B 4E4, Canada.
Phone: (780) 479-9291, Fax: (780) 474-1933.



More information about the metapost mailing list