axiom-developer
[Top][All Lists]

## [Axiom-developer] [FAQ] (new)

 From: billpage Subject: [Axiom-developer] [FAQ] (new) Date: Mon, 24 Jan 2005 19:16:56 -0600

Simplification of Expressions

Suppose we compute

\begin{axiom}
integrate(exp(-x**2/2)/sqrt(2*%pi),x=%minusInfinity..%plusInfinity)
\end{axiom}

*And now I wonder why common factors are not cancelled and why not the
result "1" is produced.*

In general (unlike some other computer math systems) Axiom automatically
performs only a very small number of basic simplifications. This is not
one of them, so we need to provide some help. In particular we need to tell
Axiom how to expand square roots.

\begin{axiom}
expandSqrt := rule sqrt(a*b)==sqrt(a)*sqrt(b)
\end{axiom}

Next, notice that the output of the integration operation has a complicated
type structure. This would interfere with the simplification, so we first
simplify the type before we apply the rule.

\begin{axiom}
(%% 1)::Expression Integer
expandSqrt %
\end{axiom}

Graphics?

Try this

\begin{axiom}
draw(5*besselJ(0,sqrt(x**2+y**2)), x=-20..20, y=-20..20)
\end{axiom}

*Not clear why latex is not rendered properly ... *

The reason why this did not originally render properly was because I had not
defined \axiomType as a valid LaTeX command in the LatexTemplate page. The
output of the draw command generates this as part of it's LaTeX output.

Anticipating the next question::

Where is the graphic??

Although graphics is available in the most recent version of Axiom
from the Savannah CVS (see AxiomDownload), the problem is that graphics
has not yet been integrated into MathAction. Doing so will require
solving some problems about using X-windows on the MathAction server.

Declaring Types

The idea that one should be able to "declare the type" of a
variable in Axiom by the command
\begin{axiom}
n:PositiveInteger
\end{axiom}

is a frequent expectation of new users of Axiom - especially if one
have used other computer algebra systems, after all Axiom is supposed
to be a "strongly typed" system, right?

Unfortunately Axiom does not attempt to use this type information
when forming expressions - but worse - declaring the type actually
interferes with the use of the variable to form expressions!
When you write 'n:PositiveInteger' what this tells Axiom is that
'n' will be assigned an integer value greater than 0 - only that.
After it is actually assigned some value, then it can be used
exactly like that value, but not before.

To me, this is a tremedous waste of an opportunity in Axiom to
to deal with "domain of computation" issues such as are
addressed in other untyped computer algebra systems by the use
of "assumptions" such as::

assume(x,PositiveInteger);

Such knowledge can be used to considerably improve the quality
and generality of the computations.

--