From: Stavros M. <mac...@gm...> - 2023-07-17 18:16:26
|
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 > |