Dear all, I'm not a mathematician, so I am probably asking a very naive question here:
Could someone point me to a reason why anything should be printed as 1.00000000*var? Those factors of 1.0000000 that turn up in otherwise pretty equations are among the most annoying 'features' to me. I would also appreciate a switch that would allow me to get rid of all decimal 0s in the latex representation if they are not followed by a non-0. For example, I would like something like this: 1.2*x+1.000000002*y instead of 1.20000000000000*x + 1.00000000020000*y Thanks, Stan Alex Ghitza wrote: > On Sun, Jul 19, 2009 at 9:04 AM, William Stein<[email protected]> wrote: > >> Please do not make the above change. It would be very inconsistent >> with what happens for symbolic variables: >> >> sage: var('x,y,z,w') >> sage: f = 1.0*x^2 - 1.0*y >> sage: f.variables() >> (x, y) >> > > I'm not sure symbolic variables are consistent to start with: > > sage: SR(1.0) > 1.00000000000000 > sage: SR(1.0*x) > x > sage: SR(2.0*x) > 2.00000000000000*x > sage: SR(1.0*x+1.0) > x + 1.00000000000000 > > > This does not look promising. Printing should be consistent across > similar elements of the same parent, and it's not. > > I would argue that, strictly speaking, the variable 'x' is not an > element of the polynomial ring R[x]. The latter is defined as finite > formal sums of the form > > a0 + a1*x + ... + an*x^n > > So x is not in R[x], but R(1)*x is. x is a formal variable/symbol, > while R(1)*x is a polynomial. > > What I'm trying to get at is this: we can't have our cake and eat it > too. If we agree that 1.0*x should be printed as 1.0000000000*x, and > we want f.variables() to return x as an element of the polynomial > ring, then it will be printed as 1.00000000000*x. > > If we make f.variables() return the formal variable x somehow, then we > can always do R(x) to get the polynomial. > > > I'm not saying that I think I have the correct solution to this, I'm > just pointing out that symbolic expressions are printed almost as > inconsistently as multivariate polynomials (and differently to > univariate polynomials) so they might not be the right model to > follow. > > > Best, > Alex > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
