[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: expand sin (nx) and cos (nx)
From: |
Martin Rubey |
Subject: |
[Axiom-developer] Re: expand sin (nx) and cos (nx) |
Date: |
17 Mar 2006 15:47:07 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Dear Francois,
Francois Maltey <address@hidden> writes:
> I hope I can compile it without problem later inside the MANIP.spad
yes.
> At the end of this input file you can try :
>
> expand1 (cos (3*x))+%i*expand1 (sin (3*x)) - (cos(x)+%i*sin(x))^3
> expand1 (cos (a+b))
> expand1 (sin (a-b)) -- doesn't work
> expand1 (sin (b-a)) -- is right
>
> So I have several problems :
>
> // A //
>
> My first function is a function which gives the name of the function :
>
> With mupad I done :
> op (3*x+5*y, 1) -> _plus
> op (3*x, 1) -> _mult
> op (x^3, 1) -> _power
> op (sin(3*x), 1) -> sin
> op (cos(3*x), 1) -> cos
in axiom there are operations isPlus, isTimes and so on. Maybe this helps. In
fact, it seems to me that you only need to test whether your expression is of
the form sin(something) or cos(something). This can be easily done with the
domain PATTERN and the operation isOp
For example, try:
isOp(sin(x)::PATTERN INT)$PATTERN INT
or
s := (isOp(sin(x)::PATTERN INT)$PATTERN INT).op
(I just forgot how to get the operator "sin")
isOp(sin(x+y)::PATTERN INT, s)$PATTERN INT
> // B //
>
> Why must I add some coerces in this input file
the coercions b := ... : EXPR INT are necessary, since "numer" returns a
SparseMultivariatePolynomial. If you want to get an Expression, try "numerator"
instead. However, in the EXPR domain there is no leadingMonomial. So the
coercion is necessary.
> // C //
>
> What are the usual Expression ... type.
>
> Can I be sure that coef in Integer, Fraction Integer, Complex Integer ?
> Is it possible to have Float or DoubleFloat...
No. There is no usual EXPR ... type. Well, Boolean does not work well. Float
does, though.
> How can I test if variable coef in an Integer or not ?
Looking at your code, coef is of type R if arg is of type EXPR R. Thus if R is
INT, you are done. If R is something else you have to use
(retractIfCan coef)@Union(Integer,"failed")
Sorry that I'm answering late, but I'm out of time currently...
Martin