# Revision history [back]

Do not use floating points and their rounding errors which can't be avoided. The complex numbers give the right answer 1.0000000000000

i=CC(-3)
j=CC(-1)
k=CC(2)
((j + sqrt(i))/k)*((j - sqrt(i))/k);


Do not use floating points and their rounding errors which (which can't be avoided. The avoided). Use arithmetic specific to complex numbers give the right answer 1.0000000000000numbers

i=CC(-3)
j=CC(-1)
k=CC(2)
((j + sqrt(i))/k)*((j - sqrt(i))/k);
var('t,v,a,b', domain="complex")
v=sqrt(-3);
a=(-1+v)/2
b=conjugate(a);
t = a*b;

a;
b;
t.real();
t.imag();


displays

1/2*sqrt(-3) - 1/2
1/2*conjugate(sqrt(-3)) - 1/2
1
0


Do not Default complex numbers use double precision floating points and their rounding errors (which can't be avoided). Use arithmetic specific to complex numbers

var('t,v,a,b', domain="complex")
v=sqrt(-3);
a=(-1+v)/2
b=conjugate(a);
t = a*b;

a;
b;
t.real();
t.imag();


displays

1/2*sqrt(-3) - 1/2
1/2*conjugate(sqrt(-3)) - 1/2
1
0


Default complex numbers use double precision floating points and their rounding errors (which can't be avoided). Use arithmetic specific to complex numbers

var('t,v,a,b', domain="complex")
v=sqrt(-3);
a=(-1+v)/2
b=conjugate(a);
t = a*b;

v;
a;
b;
t.real();
t.imag();


displays

sqrt(-3)
1/2*sqrt(-3) - 1/2
1/2*conjugate(sqrt(-3)) - 1/2
1
0


Default complex numbers use double precision floating points and their rounding errors (which can't be avoided). Use arithmetic specific to complex numbers

var('t,v,a,b', domain="complex")
v=sqrt(-3);
a=(-1+v)/2
a=(-1+v)/2;
b=conjugate(a);
t = a*b;

v;
a;
b;
t.real();
t.imag();


displays

sqrt(-3)
1/2*sqrt(-3) - 1/2
1/2*conjugate(sqrt(-3)) - 1/2
1
0


Default complex numbers use double precision floating points and their rounding errors (which can't be avoided). avoided).

Use variable from the right field and arithmetic specific to complex numbers

var('t,v,a,b', domain="complex")
v=sqrt(-3);
a=(-1+v)/2;
b=conjugate(a);
t = a*b;

v;
a;
b;
t.real();
t.imag();


displays

sqrt(-3)
1/2*sqrt(-3) - 1/2
1/2*conjugate(sqrt(-3)) - 1/2
1
0