Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coercion problem: creating vectors from a mix of python and symbolic types #3348

Closed
NathanDunfield opened this issue Jun 1, 2008 · 1 comment

Comments

@NathanDunfield
Copy link
Contributor

In the following (isomorphic) cases, the first entry is floored

sage: vector(eval("[0.78, 1, 1 + 2.38 * I]"))
(0, 1, 2.38000000000000*I + 1)
sage: vector([float(5.52), int(1), 1.3*x])
(5, 1, 1.30000000000000*x)

Note: the order of the types here seems to have to be (float, int, symbolic ring) for this to occur. If one uses proper Sage types, the problem goes away:

vector(sage_eval("[0.78, 1, 1 + 2.38 * I]"))
(0.780000000000000, 1.00000000000000, 2.38000000000000*I + 1)

Component: coercion

Issue created by migration from https://trac.sagemath.org/ticket/3348

@mwhansen
Copy link
Contributor

mwhansen commented Jun 4, 2009

comment:1

This has been fixed in the switch to Pynac symbolics:

----------------------------------------------------------------------
| Sage Version 4.0.1.rc1, Release Date: 2009-06-04                   |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: sage: vector(eval("[0.78, 1, 1 + 2.38 * I]"))
(0.78, 1.0, 1.00000000000000 + 2.38000000000000*I)
sage: _.parent()
Vector space of dimension 3 over Symbolic Ring
sage: sage: vector([float(5.52), int(1), 1.3*x])
(5.52, 1.0, 1.30000000000000*x)
sage: _.parent()
Vector space of dimension 3 over Symbolic Ring
sage: vector(sage_eval("[0.78, 1, 1 + 2.38 * I]"))
(0.780000000000000, 1.00000000000000, 1.00000000000000 + 2.38000000000000*I)
sage: _.parent()
Vector space of dimension 3 over Symbolic Ring

@mwhansen mwhansen closed this as completed Jun 4, 2009
@mwhansen mwhansen removed this from the sage-4.0.1 milestone Jun 4, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants