axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] I can't translate from the interpreter to the compiler


From: Francois Maltey
Subject: [Axiom-developer] I can't translate from the interpreter to the compiler
Date: 21 Mar 2006 21:47:50 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Hello, 

In the interpreter I have this single line :

fct (n, x) == eval (real ((c + %i * s)^n), [c, s], [cos x, sin x])

I want to add this function in manip.spad... :-(

So I add theses macros :

  CI      ==> Complex Integer
  LV      ==> OrderedVariableList [c,s]
  PCI     ==> SparseMultivariatePolynomial(Complex Integer, LV)
  PI      ==> SparseMultivariatePolynomial(Integer, LV)

I add theses variables :

  v1c := ((variable (c))@Union (OrderedVariableList [c,s], "failed"))::LV
  v1s := ((variable (s))@Union (OrderedVariableList [c,s], "failed"))::LV
  vc := v1c :: PCI
  vs := v1s :: PCI
  ve : PCI := vc + (imaginary()::CI) * vs             -- the (c + %i * s)

The interpreter is fine : 8 caracters for the Moivre formula.
I become stupid in front of the compiler : I must type theses 5 lines. 

And now after hours, axiom reject both 

  real (ve^n)
  map (t +-> real t, ve^n)

How can I coerce this SMP Complex Integer to SMP Integer ?

How can I use eval from SMP (Integer, [c,s]) to SMP (R, K) ?
where R is the basis Ring of the Expression
  and K are the kernels? functions of Expression.

I hope the end of my program is easier to translate in *.spad.

If someone can help me, again...

the Mupad code for this is :

    if t = DOM_INT then
      y := y / n;
      S:= genident("S");
      C:= genident("C");
      return(subs(expand(((C+I*S)^n-(C-I*S)^n)/2/I),[C=cos(y),S=sin(y)]))
    end_if

If possible I prefer use real and imag, and no C+I*S and C-I*S.
But today I can't get any results.

Fran├žois, in France
And thanks a lot for your reponses about cartesian product, types, etc. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]