Skip to content

Taking the real part of a sum of exponentials with imaginary exponents gives wrong result #12807

Closed
@sagetrac-inaki

Description

@sagetrac-inaki

In sage 4.8 the following computation gives 1/2, while the right result is -3/2:

sage: a = exp(i*2*pi/3)
sage: b = exp(i*pi/3)
sage: c = 2*a-b
sage: c.real()
1/2

Doing the computation numerically gives the right result:

sage: N(c).real()
-1.50000000000000

and asking maxima directly also works:

sage: (c.maxima_methods().rectform()).real()
-3/2

This is sage 4.8 running on Fedora 16, linux 3.1.0-7.fc16.x86_64 SMP.

Depends on #18362

Upstream: Fixed upstream, in a later stable release.

Component: symbolics

Author: Ralf Stephan

Branch/Commit: 410bab7

Reviewer: Travis Scrimshaw

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions