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

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

f(x) is computed by elt in ExpressionSpace?. elt uses belong? to check for correct operator and complains otherwise.

AlgebraicNumber? defines:

belong? op == belong?(op)$ExpressionSpace?_&(%) or has?(op, ALGOP)

while ExpressionSpace? exports:

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

so f is not among allowed operators, whereas Expression defines:

    belong? op == true




  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: