Hi Robert,

Thanks, this explains what is going on. Would there be a way of
including the regular expressions procedure in the show() command? The
output of the line you proposed is a string, which doesn't show well
in show(). :)

Thanks again,
Stan

On Nov 17, 8:05 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> Any decimal number that goes into maxima turns into a 53-bit floating  
> point number (at least by default), which then turns into a 53 bit  
> MPFR coming out. The reason all the trailing 0's are exposed is to  
> show how much precision is known. Maxima (as far as I know) doesn't  
> have the concept of different real numbers to different precisions.
>
> I would imagine a lot of these issues will go away the less we pass  
> through Maxima. In the meantime, using regular expressions to remove  
> the trailing zeros is probably you're best bet.
>
> sage: s = latex(0.6*x); s
> {0.600000000000000 x}
> sage: re.sub(r'(\.[1-9]+)0+', r'\1', s)
> '{0.6 x}'
>
> - Robert
>
> On Nov 17, 2008, at 8:19 AM, Stan Schymanski wrote:
>
>
>
> > Dear Marshall,
>
> > Thanks a lot for looking into this. I tried similar approaches as  
> > well,
> > and so did the original poster. However, as soon as you introduce a
> > symbolic variable into the equation, latex does weird things such as:
>
> > latex(RealField(8)(0.6)*x)
> > produces
> > "{0.601600000000000 x}"
>
> > Does this look like a bug to you, too?
>
> > Cheers
> > Stan
>
> > Marshall Hampton wrote:
> >> There are a number of interact examples on the wiki (such as the  
> >> Gram-
> >> Schmidt one athttp://wiki.sagemath.org/interact/linear_algebra) that
> >> work around this problem by casting to a field of low precision, for
> >> example doing something like
>
> >> latex(RealField(8)(0.6))
>
> >> produces "0.60".
>
> >> Hope that helps,
> >> Marshall Hampton
>
> >> On Nov 17, 9:02 am, Stan Schymanski <[EMAIL PROTECTED]> wrote:
>
> >>> A week older and still not smarter...
> >>> Sorry for the noise, but I am still trying to find a way of getting
> >>> useful latex output for equations that contain decimal numbers. It
> >>> seems that the previous posts passed below the radars of those that
> >>> might know the answer, so I am trying to push it to the surface  
> >>> again.
> >>> Isn't anybody else bothered by rows of 0s in the latex() or show()
> >>> output?
>
> >>> Cheers
> >>> Stan
>
> >>> On Nov 10, 1:25 pm, Stan Schymanski <[EMAIL PROTECTED]> wrote:
>
> >>>> It seems thatlatex(eqn) just evaluates eqn and prints the result  
> >>>> inlatexnotation, without cutting off annoying 0s or giving the  
> >>>> user the
> >>>> opportunity to set a precision. I find this very annoying, as  
> >>>> suchlatexoutput is not very useful for illustration purposes.  
> >>>> Does anyone
> >>>> know a trick how to automatically round ugly numbers for thelatex
> >>>> output? I feel that this should be incorporated into thelatex()  
> >>>> code,
> >>>> though.
> >>>> Here is another illustration of the problem:
>
> >>>> latex(0.6*x)
> >>>> {0.600000000000000 x}
>
> >>>> latex(0.6.n(digits=4)*x)
> >>>> {0.599998500000000 x}
>
> >>>> The second attempt became even uglier!
>
> >>>> This is on sage 3.1.4 on an Intel Macbook Pro.
>
> >>>> Thanks for your help! (Anyone?)
> >>>> Stan
>
> > --
> > ________________________________________
>
> > Stan Schymanski
> > Scientist
> > Max Planck Institute for Biogeochemistry
> > Postfach 10 01 64
> > D-07701 Jena
>
> > Phone: +49.3641.576264
> > Fax: +49.3641.577274
> > WWW:http://www.bgc-jena.mpg.de/~sschym
>
> > Biospheric Theory and Modelling Group
> >http://www.bgc-jena.mpg.de/bgc-theory/
> > _________________________________________
>
>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to