login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxOperatorsAndSqrt revision 1 of 2

1 2
Editor: Bill Page
Time: 2015/03/16 16:59:00 GMT+0
Note: awkward

changed:
-
This fails unexpectedly:
\begin{axiom}
f:=operator 'f
f(sin(-1))
f(sqrt(-1))
\end{axiom}

But this works
\begin{axiom}
f(sqrt(-1)::Expression(Integer))
\end{axiom}

This happens because 'sqrt(-1)' is interpreted as an AlgebraicNumber and

\begin{axiom}
AlgebraicNumber has ExpressionSpace
\end{axiom}

while ExpressionSpace exports::

    belong? op   ==
        has?(op, 'any) and (is?(op, PAREN) or is?(op, BOX))

whereas Expression overrides this with::

    belong? op == true


This fails unexpectedly:

fricas
f:=operator 'f

\label{eq1}f(1)
Type: BasicOperator?
fricas
f(sin(-1))

\label{eq2}f \left({-{\sin \left({1}\right)}}\right)(2)
Type: Expression(Integer)
fricas
f(sqrt(-1))
>> Error detected within library code: Unknown operator 3: f

But this works

fricas
f(sqrt(-1)::Expression(Integer))

\label{eq3}f \left({\sqrt{- 1}}\right)(3)
Type: Expression(Integer)

This happens because sqrt(-1) is interpreted as an AlgebraicNumber? and

fricas
AlgebraicNumber has ExpressionSpace

\label{eq4} \mbox{\rm true} (4)
Type: Boolean

while ExpressionSpace? exports:

    belong? op   ==
        has?(op, 'any) and (is?(op, PAREN) or is?(op, BOX))

whereas Expression overrides this with:

    belong? op == true