5

I am new to Maxima and I can't find in the documentation how to do formal calculation on complex numbers. When I use unspecified variables, Maxima seems to assume that they are real : conjugate(x) returns x for instance.

Is there anyway to solve this issue ?

Thanks in advance.

Adam
  • 1,254
  • 12
  • 25
Selim Ghazouani
  • 151
  • 1
  • 3

2 Answers2

5

You can declare a variable complex:

(%i1) declare(x, complex) $
(%i2) conjugate(x);
(%o2)                            conjugate(x)
(%i3) conjugate(realpart(x));
(%o3)                             realpart(x)
slitvinov
  • 5,693
  • 20
  • 31
0

Here are some tests with to_poly package :

(%i1) load(to_poly);
(%o1)  home/a/maxima/share/to_poly_solve/to_poly.lisp
(%i2) r;
(%o2) r 
(%i3) isreal_p(r);
(%o3) true     /*  When I use unspecified variables, Maxima seems to assume that they are real */ 
(%i4) z:x+y*%i;
(%o4) %i y + x
(%i5) isreal_p(z);
(%o5) isreal_p(%i y) /* maxima can't check if it is real or not */
(%i6) isreal_p(x);
(%o6) true
(%i7) isreal_p(y);
(%o7) true
(%i8) complex_number_p(z); 
(%o8) false 
(%i9) declare(z, complex);
(%o9) done
(%i10) complex_number_p(z);
(%o10)   false /* still not complex */

It seems more "complex".

Adam
  • 1,254
  • 12
  • 25