Ask Your Question

Revision history [back]

This is because numbers have more than one cube root, and Sage is choosing a complex (non-real) cube root for the first term in your sum. Your calculator is choosing the real cube root. To force Sage to use the real root, it's best to work with numerical approximations throughout:

a = 70 - 13*sqrt(29)
b = 70 + 13*sqrt(29)
x = real_nth_root(N(a), 3) + real_nth_root(N(b), 3)
print(N(x))

should print

5.00000000000009

This is because numbers have more than one cube root, and Sage is choosing a complex (non-real) cube root for the first term in your sum. Your calculator In more detail, Sage is very cautious, with good mathematical reason, when raising negative numbers to non-integer exponents. The first summand is negative, and that's where the issue arises. (Your calculator, on the other hand, is choosing the real cube root. root.) To force Sage to use the real root, it's best to work with numerical approximations throughout:

a = 70 - 13*sqrt(29)
b = 70 + 13*sqrt(29)
x = real_nth_root(N(a), 3) + real_nth_root(N(b), 3)
print(N(x))
print(x)

should print

5.00000000000009