|
From: Eduardo O. <edu...@gm...> - 2023-07-19 04:56:57
|
Hi all, especially Stavros...
First: thanks for all the hints!
Second: this is a simple demo of ratpow.lisp:
a : taylor(exp(2*x),x,0,5);
b : ratdisrep(a);
:lisp #$b$
:lisp #$a$
load("ratpow.lisp")$
ratp_hipow(a, x);
ratp_lopow(a, x);
ratp_coeffs(a, x);
ratp_dense_coeffs(a, x);
ratp_dense_coeffs_lo(a, x);
Third: this _almost_ gives me a very nice way to implement a method
that I always teach to my students!!! Suppose that E is exp(%i*x);
this code
f : sin(x)^4 * cos(x)^2;
f1 : expand(exponentialize(f));
f2 : subst([x=1/%i, %e=E], f1);
f3 : rat(f2, E);
converts f to a rational function on E. What do I need to use instead
of the "rat" in the last step to convert f to a _Laurent polynomial_
on E instead of a _rational function_ on E?
Thanks in advance!
Cheers,
Eduardo Ochs
P.S.: (more on the method later...)
On Mon, 17 Jul 2023 at 15:16, Stavros Macrakis <mac...@gm...> wrote:
> The ratpow package handles this.
>
> On Mon, Jul 17, 2023, 13:15 Eduardo Ochs <edu...@gm...> wrote:
>
>> Hi list,
>>
>> a few hours ago I tried to use my luatree thing -
>> http://anggtwu.net/eev-maxima.html#luatree - to understand the
>> low-level representation of Taylor series, and I discovered that
>>
>> 1) it doesn't recognize the difference between "Taylor sums" - this
>> is an informal term; the correct term is canonical rational
>> expressions, a.k.a. CREs - and normal sums,
>>
>> 2) op and args also don't recognize the difference,
>>
>> 3) the internal representation of "Taylor sums" and "normal sums" is
>> very different, and ratp distinguishes them.
>>
>> We can see all that in this example:
>>
>> a : taylor(sin(x),x,0,5);
>> b : x - x^3/6 + x^5/120;
>> op(a);
>> op(b);
>> args(a);
>> args(b);
>> :lisp #$a$
>> :lisp #$b$
>> ratp(a);
>> ratp(b);
>>
>> it yields:
>>
>> (%i1) a : taylor(sin(x),x,0,5);
>> 3 5
>> x x
>> (%o1)/T/ x - -- + --- + . . .
>> 6 120
>> (%i2) b : x - x^3/6 + x^5/120;
>> 5 3
>> x x
>> (%o2) --- - -- + x
>> 120 6
>> (%i3) op(a);
>> (%o3) +
>> (%i4) op(b);
>> (%o4) +
>> (%i5) args(a);
>> 3 5
>> x x
>> (%o5) [x, - --, ---]
>> 6 120
>> (%i6) args(b);
>> 5 3
>> x x
>> (%o6) [---, - --, x]
>> 120 6
>> (%i7) :lisp #$a$
>>
>> ((MRAT SIMP (((%SIN SIMP) $X) $X) (sin(x)490 X491)
>> (($X ((5 . 1)) 0 NIL X491 . 2)) TRUNC)
>> PS (X491 . 2) ((5 . 1)) ((1 . 1) 1 . 1) ((3 . 1) -1 . 6) ((5 . 1) 1 .
>> 120))
>> (%i7) :lisp #$b$
>>
>> ((MPLUS SIMP) $X ((MTIMES SIMP) ((RAT SIMP) -1 6) ((MEXPT SIMP) $X 3))
>> ((MTIMES SIMP) ((RAT SIMP) 1 120) ((MEXPT SIMP) $X 5)))
>> (%i7) ratp(a);
>> (%o7) true
>> (%i8) ratp(b);
>> (%o8) false
>> (%i9)
>>
>> In the example above a is a MRAT and b is a MPLUS. Is there a standard
>> way to access the components of an MRAT from Maxima? What do people
>> use when they need to inspect the innards of MRATs from Maxima?
>>
>> Thanks in advance!
>> Eduardo Ochs
>> http://anggtwu.net/eev-maxima.html
>>
>> _______________________________________________
>> Maxima-discuss mailing list
>> Max...@li...
>> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>>
>
|