Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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);
click to hide/show revision 2
No.2 Revision

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
click to hide/show revision 3
No.3 Revision

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
click to hide/show revision 4
No.4 Revision

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
click to hide/show revision 5
No.5 Revision

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
click to hide/show revision 6
No.6 Revision

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