[Maxima] question about symbolic/numerical mixing

Giovanni giovannibis at inwind.it
Fri Feb 20 04:26:21 CST 2009


  giovedì 19 febbraio 2009, 14:26, Stavros Macrakis:

> (%i7) numer:true$
> (%i8) resimplify(exprlist);
> (%o8) [-x,sin(0.043478260869565*%pi),a*x]
>       /* setting numer makes 1/23 into a float, but not %pi */
> 
> (%i9) float:true$
> (%i10) resimplify(exprlist);
> (%o10) [-x,0.13616664909625,a*x]
>       /* float flag controls %pi -> float */

  Your examples are quite useful, but here the observed behaviour is a
little different:
(%i1) x:sin(1/23*%pi);
                                       %pi
(%o1)                              sin(---)
                                       23
(%i2) expand(x);
                                       %pi
(%o2)                              sin(---)
                                       23
(%i3) numer:true$
(%i4) expand(x);
(%o4)                     sin(.04347826086956522 %pi)
(%i5) float:true$
(%i6) expand(x);
(%o6)                     sin(.04347826086956522 %pi)

  But, to make a long story short, what i need is the ability to do
something like this:
x1:sin(%pi/4)$

display(x1);
x1=1/sqrt(2)

x2:ev(x1,numer)$
display(x2);
x2=.0771

but *whitout* have to define another variable (i've made an example
with display/ldisplay because i'd like to have TeX formatted output, to
be included in a report with /input{}).

thanks,
  Giovanni



More information about the Maxima mailing list