On 07-12-2013 14:09, Ricardo JF wrote:
> i know that %pi,%phi,%e are constants, but
>
> how can i create a particular one:
>
> example:
>
> r --> (1+sqrt(7))/2=1,82287565553
>
> %r,numer; -->1,82287565
Hi,
I guess you don't like:
(%i2) %r: (1+sqrt(7))/2$
because when you type
(%i3) 3*%r;
(%o3) 3*(sqrt(7)+1)/2
you didn't want %r to be replaced by (1+sqrt(7))/2 ?
If that is the case, then remove the previous definition:
(%i4) kill(%r);
and try this:
(%i5) :lisp (mdefprop $%r 1.822875655532295 $numer)
Of course, you should use more significant digits if you need more.
Constants %e, %pi, etc. are defined with 637 digits in src/mlisp.lisp.
You should also tell Maxima that %r is a constant:
(%i5) :lisp (kind $%r constant)
(%i5) :lisp (setf (get $%r 'sysconst) t)
and now look at the result:
(%i5) 3*%r;
(%o5) 3*%r
(%i6) %, numer;
(%o6) 5.468626966596885
(%i7) float(%r/2);
(%o7) .9114378277661475
(%i8) %r: 4;
assignment: cannot assign to %r; it is a declared numeric quantity.
Something I have not figured out yet is how to make bfloat work:
(%i9) bfloat(%r);
(%o9) %r
Regards,
Jaime