|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/*
* This file:
* http://anggtwu.net/MAXIMA/mac1.mac.html
* http://anggtwu.net/MAXIMA/mac1.mac
* (find-angg "MAXIMA/mac1.mac")
* Author: Eduardo Ochs <eduardoochs@gmail.com>
*
* This file implements a convenient shorthand for MacLaurin series.
* It works like this:
*
* (%i2) mac(1,2,3);
* 2
* (%o2) 3 x + 2 x + 1
* (%i3) mac(1,2,3,...);
* 2
* (%o3)/T/ 1 + 2 x + 3 x + . . .
* (%i4) mac(1,2,3,...) * mac(0,1,0,...);
* 2
* (%o4)/T/ x + 2 x + . . .
* (%i5) 1 / mac(1,2,-3,4,5,...);
* 2 3 4
* (%o5)/T/ 1 - 2 x + 7 x - 24 x + 72 x + . . .
* (%i6)
*
* I used it in:
*
* 2hT279 (c2m232p2p 3 "questao-4")
* (c2m232p2a "questao-4")
* http://anggtwu.net/LATEX/2023-2-C2-Tudo.pdf#page=279
*
* 2hQ96 (find-c2q232page 96 "42,nov29: Séries formais")
* (find-c2q232page 99 "dec04: Aula de reposição/reforço")
* http://anggtwu.net/2023.2-C2/C2-quadros.pdf#page=96
*
* See: (find-es "maxima" "mac-nofix")
*
* (defun e () (interactive) (find-angg "MAXIMA/mac1.mac"))
*/
mac_mkpoly0 (L,n) := sum(L[k]*x^(k-1), k, 1, n);
mac_mkseries0(L,n,deg) := taylor(mac_mkpoly0(L, n), x, 0, deg);
mac_mkpoly (L) := mac_mkpoly0 (L, length(L));
mac_mkseries (L) := mac_mkseries0(L, length(L)-1, length(L)-2);
mac ([L]) := if is(L[length(L)] = "...")
then mac_mkseries(L)
else mac_mkpoly (L);
nofix ("...");
... := "...";
mac_Lp0(m, n) := makelist(ratcoef(m,x,k-1), k, 1, n);
mac_Ls0(m, n) := append(mac_Lp0(m, n), ["..."]);
mac_Lp (m) := mac_Lp0(m, hipow(m,x)+1);
mac_Ls (m) := mac_Ls0(m, taylorinfo(m)[1][3]+1);
mac_L (m) := if taylorp(m) then mac_Ls(m) else mac_Lp(m);
mac_ify(m) := buildq([L:mac_L(m)], mac(splice(L)));
/*
mac_Ls (m) := mac_Ls0(m, hipow(m,x)+1);
*/
/*
* (eepitch-maxima)
* (eepitch-kill)
* (eepitch-maxima)
load("~/MAXIMA/mac1.mac");
mac(1,2,3);
mac(1,2,3,...);
mac(1,2,3,...) * mac(0,1,0,...);
1 / mac(1,2,-3,4,5,...);
mac1 : mac(1,2,-3,4,5,...);
mac2 : mac(a,b,c,d,e,...);
mac2 : 1/mac1;
mac1 * mac2;
mac_Lp0(mac1, 5);
mac_Ls0(mac1, 6);
mac_coefs2(mac1);
mac_coefs3(mac1);
mac_coefs2(x^2);
mac_L (1/mac1);
mac_ify(1/mac1);
mac_ify(x^2);
ratp(mac1);
ratp(x^2);
mac_ify(taylor(sin(x), x, 0, 8));
*/