evalf() on cube roots
Hi, I noticed that evalf( (-1)^(1/3) ) gives 0.5+0.86602540378443864673*I Is there any way to tell GiNaC to return the real root by default? Jan
Hi, On 08/01/2015 08:01 PM, Jan Rheinländer wrote:
I noticed that
evalf( (-1)^(1/3) )
gives
0.5+0.86602540378443864673*I
Is there any way to tell GiNaC to return the real root by default?
There isn't. GiNaC, like almost all other systems, returns the solution on the principal branch, compatible with exp(log(-1)/3). -richy. -- Richard B. Kreckel <http://in.terlu.de/~kreckel/>
Hi,
I noticed that
evalf( (-1)^(1/3) )
gives
0.5+0.86602540378443864673*I
Is there any way to tell GiNaC to return the real root by default? There isn't. GiNaC, like almost all other systems, returns the solution on the principal branch, compatible with exp(log(-1)/3). I suppose there is some excellent mathematical reason for this...but for me it means that I can't use GiNaC to verify Cardano's formula for a cubic function:
x = (-1 - sqrt(2))^(1/3) + (-1 + sqrt(2))^(1/3); (-1-sqrt(2))^(1/3)+(-1+sqrt(2))^(1/3)
evalf(x^3 + 3 * x + 2); 3.3544445609126528848+8.9073474964875349776*I
Surely there must be a way to verify such a formula in GiNaC??? Jan
On 08/02/2015 08:59 PM, Jan Rheinländer wrote:
There isn't. GiNaC, like almost all other systems, returns the solution on the principal branch, compatible with exp(log(-1)/3). I suppose there is some excellent mathematical reason for this...
Actually, there isn't. Branch cuts are a matter of convention. Nothing more but also nothing less.
but for me it means that I can't use GiNaC to verify Cardano's formula for a cubic function:
x = (-1 - sqrt(2))^(1/3) + (-1 + sqrt(2))^(1/3); (-1-sqrt(2))^(1/3)+(-1+sqrt(2))^(1/3)
evalf(x^3 + 3 * x + 2); 3.3544445609126528848+8.9073474964875349776*I
Surely there must be a way to verify such a formula in GiNaC???
It should be straightforward to replace such rational expressions by the form you want them to be in before calling evalf(), using techniques such as these: <http://www.ginac.de/FAQ.html#advanced> Cheers -richy. -- Richard B. Kreckel <http://in.terlu.de/~kreckel/>
participants (2)
-
Jan Rheinländer
-
Richard B. Kreckel