This page gives a few comments about the expression domain Expression Integer
and the use of more specific domains.
The Integer
in Expression Integer
is maybe misleading.
Just think of Expression Integer
as something that makes panAxiom behave
like a (nearly) untyped computer algebra system like Maple or Mathematica.
Roughly speaking, you forget about all the type stuff.
That's not totally true, but for a new user it is probably the best way
to do the first steps just with (untyped) expressions.
You can only appreciate all those different types if you do more advanced
things in panAxiom.
Types especially become important if one wants to implement a bigger library.
One big difference for example is: In Expression Integer
it is
undecidable whether an element is actually equal to zero.
Consequently, expressions which mathematically have the same value
may be different as elements of Expression(Integer)
.
Actually, arithmetic in Expression(Integer)
is automatically
doing algebraic simplifications, but otherwise treats quantities as independent.
So if you say zero?(e) for some expresssion e you might get false
although e can actually be simplified to zero.
fricas
(1) -> e: Expression Integer := sin(x)^2 -1 + cos(x)^2
Type: Expression(Integer)
fricas
zero? e
Type: Boolean
fricas
simplify e
Type: Expression(Integer)
Technically, expression above is an algebraic relation between transcendental
quantities sin(x)
and cos(x)
. FriCAS can handle such relations between
elementary functions (via normalize
), but does not do this automatically. But
elementary constants cause theoretical trouble
(see SchanuelConjecture?). And nonelementary functions may satisfy relations
unknown to FriCAS.
Similarly, Expression(Integer)
treats algebraic quantities as independent:
fricas
a := x^(1/4)
Type: Expression(Integer)
fricas
b := sqrt(x)
Type: Expression(Integer)
fricas
a^2 - b
Type: Expression(Integer)
fricas
-a^2 - b
Type: Expression(Integer)
Mathematically, for given x
in a field, one of the two expressions above must
be zero. But FriCAS shows both as if they were nonzero.
At deeper level, FriCAS treats expression as rational function of kernels.
Simple calculations in Expression(Integer)
are correct only if kernels
are independent, that is transcentental kernels are algebraically independent
and defining polynomials of algebraic kernels are irreducible.
For transcendental elementary functions normalize
from ElementaryFunctionStructurePackage
rewrites expression in terms of algebraically independent kernels.
Note: For simpler, more specialized domains like 'DMP([a,b]?, Integer)',
the function zero? always returns what you expect.