~~stoggle_buttons~~
====== Maxima ======
===== TeXmacs =====
TeXmacs es un programa que escribe la salida de maxima en formato LaTex. En Debian Jessie no existe el
paquete, hay que bajarse los de Wheezy manualmente, intentar instalarlo con
# dpkg --install texmacs
y resolver las dependencias manualmente (cuando se pueda, descargando de los repos de Jessie)
[[http://www.texmacs.org/tmdoc/plugins/maxima/maxima-tutorial/maxima-tutorial.en.html|Maxima en Texmacs]]
Para añadir una nueva línea en texmacs, Mayus+Enter
===== General =====
/* Comentario */
diff(expr, var); Deriva expr respecto de var
integrate(f(x), x); Integra f(x) respecto de x
diff(f(x), x[, orden]) = d/dx (f(x))
%pi %e %i %pi inf (infinito real) infinity (infinito complejo) zeroa = 0+ zerob = 0- (infinitesimos)
Cargar scripts y librerias
batch("script.mac")
load("lib.mac")
random(1.0) -> random de 0.0 a 1.0
[1, 2, 3, 4] -> Listas x[1] = 1, x[2] = 2
a:3$ No imprime nada
a:3; Imprime el resultado de la operación
A: matrix([1, 0], [0, 1])
. -> operador punto (matrices, vectores). Por defecto es no conmutativo (hay que declarlo conmutativo)
~ -> producto cruz
and, not, or
display(a)
kill(var) -> elimina asignaciones
: -> asignación
:: -> evalúa la parte de la izquierda también
:= -> define función, permite f(2)
::= -> define una macro
'expr -> desactiva evaluación
ev(expr, var1=val1, ..., varN=valN)
[b]float(expr)
fpprec: 16 -> numero de cifras de los bigfloats
===== Flujo de control =====
<, <=, >=, >, =, # (equivale a not =, diferente de notequal), and, or, not
equal(x, y), notequal(x, y)
if (expr) then 1 else 0
for i: 0 [step 1] thru 10 do body
for i: 0 [step 1] [while|unless] condition do body
for i in list do body
===== Propiedades y suposiciones =====
declare(f, propiedad1, g, propiedad2, ...) declara propiedades de funciones
additive f(a+b, x+y) = f(a, x+y)+f(b, x+y)
antisymmetric f(x, z, y) = -f(x, y, z)
commutative f(x, z, y) = f(x, y, z)
decreasing a > b => f(a) < f(b)
increasing a > b => f(a) > f(b)
[even|odd]fun
lassociative f (f (a, b), f (c, d)) = f (f (f (a, b), c), d)
rassociative f (f (a, b), f (c, d)) = f( a, f (b, f (c, d)))
linear
multiplicative f(a*b*c) = f(a)*f(b)*f(c)
nary f(x, f(y, z)) = f(x, y, z)
outative f(a*x) = a*f(x)
posfun f(x) > 0
symmetric f(z, y, x) = f(x, y, z)
declare(a, propiedad1, b, propiedad2, ...) declara propiedades de números
constant
even, odd
integer, noninteger
rational, irrational
[non]scalar
real, imaginary, complex
properties(f) -> propiedades de f
assume(x > 0, y > x, ...)
forget([previous_assume_expression_list])
facts() -> lista todos los assume
facts(var) -> lista todos los de var
maybe(expr) prueba si expr se puede deducir a partir de los assume
is(expr) como maybe (más restrictivo en errores)
compare(x, y) -> dice si x > y, x = y, ...
is([not]equal(x, y))
# va con el tipo -> x#0 es true pero is(equal(x, 0)) es unknown sin suposiciones
and, or, not
===== Simplificación =====
combine -> combinar en un mismo denominador
distrib -> distribuir (multiplicar sumando por sumando)
expand -> expande como distrib y además expande exp
ratexpand -> más rapido para funciones racionales
ratsimp
radcan -> simplifica a una forma canónica
expandwrt(expr, var1, ..., varN) -> expande solo dichas variables
expandwrt_factored(expr, var1, ..., varN)
exponentialize -> convierte sin(h), cos(h) a exponenciales
multthru(expr)
multtrhu(expr1, expr2)
coeff(expr, x, n) -> devuelve el coeficiente de x^n en expr
factor(expr) -> factoriza en primos
factorout(expr, x1, x2, ...) -> convierte a f(x1, x2, ...)*g donde g no depende de x1, x2, ...
factorsum(x^2 + 2*x + 1) -> (x+1)^2, pero expand((x + 1)^2 + (x + y)^2) tiene variables cruzadas y no sirve
fullratsimp() simpifica todo
Simplificación trigonométrica
load(atrig1) -> carga valores conocidos de sin y cos
load(ntrig) -> simplifica f(n*%pi/10) con n entero
halfangles: false -> sustituye angulos mitad
trigexpandplus: true -> expande sumas de ángulos
trigexpandtimes: true -> expande ángulos n*x, n = 2, 3, 4, ...
triginverses: true -> expande trig(atrig(x)) = x. Con all también atrig(trig(x)) = x
trigexpand
trigsimp -> usa sin^2 x + cos^2 x = 1 y similares. trigrat, ratsimp, radcan puede simplificar más
trigrat
trigreduce(expr) -> combina en ángulos dobles, triples
trigreduce(expr, var)
===== Números complejos =====
[In]: abs(sqrt(1+%i*x))
[Out]: |sqrt(i*x+1)|
[In]: cabs(sqrt(1+%i*x))
[Out]: (x^2+1)^(1/4)
carg complex arg
conjugate, [imag|real]part, [polar|rect]form
plog -> logaritmo complejo entre -pi y pi
===== Plots =====
contour_plot (x^2 + y^2, [x, -4, 4], [y, -4, 4])
implicit_plot(f(x, y) = g(x, y), [x, -4, 4], [y, -4, 4])
plot2d(sin(x), [x, -20, 20], [y, -1.5, 1.5])
plot3d (u^2 - v^2, [u, -2, 2], [v, -3, 3], [grid, 100, 100])
plot3d([f1(x, y), f2(x, y), [x, -3, 3], [y, -3, 3]], [grid, 100, 100])
plot3d([x(u, v), y(u, v), z(u, v)], [u, -3, 3], [v, -3, 3], [grid, 100, 100])
[elevation,0], [azimuth,0] en plot3d se ve desde arriba
===== Límites y cálculo diferencial =====
limit(expr, x, val, dir) dir = plus|minus
tlimit(expr, x, val, dir) lo calcula con taylor
taylor ((1+x)^(1/2), x, 0, 4) expande en serie de taylor (1+x)^(1/2) en x = 0 hasta x^4
Si el punto es inf, también expande en el infinito
depends([f, g, ...], [x, y, z, ...]) f = f(x, y, z), g = g(x, y, z)
load("vect")
grad, div, curl, laplacian
ev(express(grad(x^2 + y^2 + z^2)), diff) -> express lo convierte a derivadas, ev evalua derivadas
changevar(integral, f(x,y), y, x) -> hace el cambio de variable f(x, y) = 0 en la integral
load("dbint") -> dbint(f, r, s, a, b) -> f(x, y), r(x), s(x), a, b
integrate(expr, x[, a, b])
residue (expr, z, z_0)
first(quad_qag(f(x), x, a, b, order))
Sin first devuelve:
valor de la integral
error absoluto estimado
veces que se ha evaluado la funcion
código de error
**Se expresa con un subíndice de la coordenada una derivada:**
rt = dr/dt
===== Soluciones de ecuaciones (simbólicas y numéricas) =====
[bf]allroots(polinomio)
solve(expr) -> resuelve simbólico
[bf_]find_roots(expr, x, a, b)
load("newton1")
newton (expr, x, x_0, eps)
load("mnewton") -> newton en multiples variables
mnewton([f(x, y, z), g(x, y, z)], [x, y], [0.2, 1.7])
Las siguientes variables controlan tanto newton como mnewton
newtonepsilon: 10.0^(-fpprec/2)
newtonmaxiter: 50
===== Funciones especiales =====
bessel_j (index, expr) Bessel function, 1st kind
bessel_y (index, expr) Bessel function, 2nd kind
bessel_i (index, expr) Modified Bessel function, 1st kind
bessel_k (index, expr) Modified Bessel function, 2nd kind
hankel_1 (v,z) Hankel function of the 1st kind
hankel_2 (v,z) Hankel function of the 2nd kind
struve_h (v,z) Struve H function
struve_l (v,z) Struve L function
assoc_legendre_p[v,u] (z) Legendre function of degree v and order u
assoc_legendre_q[v,u] (z) Legendre function, 2nd kind
%f[p,q] ([], [], expr) Generalized Hypergeometric function
gamma (z) Gamma function
gamma_incomplete_lower (a,z) Lower incomplete gamma function
gamma_incomplete (a,z) Tail of incomplete gamma function
hypergeometric (l1, l2, z) Hypergeometric function
slommel
%m[u,k] (z) Whittaker function, 1st kind
%w[u,k] (z) Whittaker function, 2nd kind
erfc (z) Complement of the erf function
airy_ai (x) Airy function Ai(x)
airy_dai (x) d/dx Ai(x)
airy_bi (x) Airy function Bi(x)
airy_dbi (x) d/dx Bi(x)
jacobi_sn (u, m) Jacobian function sn(u,m)
jacobi_cn (u, m) Jacobian function cn(u,m)
jacobi_dn (u, m) Jacobian function dn(u,m)
jacobi_sc (u, m) Jacobian function sc(u,m) = sn(u,m)/cn(u,m)
jacobi_sd (u, m) Jacobian function sd(u,m) = sn(u,m)/dn(u,m)
jacobi_cd (u, m) Jacobian function cd(u,m) = cn(u,m)/dn(u,m)
jacobi_ns (u, m) Jacobian function ns(u,m) = 1/sn(u,m)
jacobi_nc (u, m) Jacobian function nc(u,m) = 1/cn(u,m)
jacobi_nd (u, m) Jacobian function nd(u,m) = 1/dn(u,m)
jacobi_cs (u, m) Jacobian function cs(u,m) = 1/sc(u,m)
jacobi_ds (u, m) Jacobian function ds(u,m) = 1/sd(u,m)
jacobi_dc (u, m) Jacobian function dc(u,m) = 1/cd(u,m)
kelliptic (z) Complete elliptic integral of the first
kind (K)
expintegral_e (v,z) Exponential integral E
expintegral_e1 (z) Exponential integral E1
expintegral_ei (z) Exponential integral Ei
expintegral_li (z) Logarithmic integral Li
expintegral_si (z) Exponential integral Si
expintegral_ci (z) Exponential integral Ci
expintegral_shi (z) Exponential integral Shi
expintegral_chi (z) Exponential integral Chi
parabolic_cylinder_d (v,z) Parabolic cylinder D function
===== Tensores =====
demo(tensor)
==== itensor ====
==== ctensor ====
load(ctensor)
csetup()
dependencies; Muestra todas las dependencias
remove (r, dependencies); Elimina las dependencias
cdisplay(tensor); Muestra el tensor
Estructura de los tensores y funciones para calcularlos
lg -- ug
\ \
lcs -- mcs -- ric -- uric
\ \ \
\ tracer - ein -- lein
\
riem -- lriem -- weyl
\
uriem
csetup()
cmetric()
christof(false)
ricci(false)
urrici(false)
einstein(false)
leinstein(false)
riemann(false)
lriemann(false)
weyl(false)
uriemann(false)
Pasar los tensores a matrices
ric:matrix([ric[1,1],ric[1,2],ric[1,3],ric[1,4]],
[ric[2,1],ric[2,2],ric[2,3],ric[2,4]])
Se puede acceder a cada elemento usando la notación de índices de arriba
$\texttt{lg} = g_{\mu \nu},\: \texttt{ug} = g^{\mu \nu}$
$\texttt{lcs[i, j, k]} = \Gamma_{k i j},\: \texttt{mcs[i, j, k]} = \Gamma^{k}_{\:i j}$
$\texttt{ric} = R_{\rho \sigma},\: \texttt{uric} = R^{\rho \sigma}$
Para calcular el tensor de Riemann usa la siguiente convención:
$\texttt{riem} = R_{ijk}^{\:\:\:l} = \Gamma^{l}_{\:ij,\,k} - \Gamma^{l}_{\:ik,\,j} + \Gamma^{l}_{\:mk} \Gamma^{m}_{\:ij} - \Gamma^{l}_{\:mj} \Gamma^{m}_{\:ik}$
$\texttt{lriem} = R_{ijkl},\: \texttt{uriem} = R^{ijkl}$
$\texttt{ein} = G_i^{\:j},\: \texttt{lein} = G_{ij}$
$\texttt{weyl} = C_{abcd}$
[[http://maxima.sourceforge.net/docs/manual/maxima_26.html#SEC149|ctensor]]