Maxima
From Wikibooks, the open-content textbooks collection
(Redirected from Maxima (software))
This book shows how to use Maxima .
Contents |
[edit] Numbers
[edit] Complex numbers
[edit] Argument
Principial value of argument of complex number in turns carg produces results in the range (-pi, pi] . It can be mapped to [0, 2*pi) by adding 2*pi to the negative values
carg_t(z):= block( [t], t:carg(z)/(2*%pi), /* now in turns */ if t<0 then t:t+1, /* map from (-1/2,1/2] to [0, 1) */ return(t) )$
[edit] Square root
Square root of complex number : csqrt(x + y * i) = sqrt((r + x) / 2) + i * y / sqrt(2 * (r + x))
gives principal value of square root : -Pi <arg<Pi
csqrt(z):= block( [t,w,re,im], t:abs(z)+realpart(z), if t>0 then (re:sqrt(t/2), im:imagpart(z)/sqrt(2*t)) else (im:abs(z), re:0), w:re+im*%i, return(w) )$
[edit] Algorithms
[edit] Stack ( LIFO)
Stack implementation using list:
/* create stack */ stack:[1]; /* push on stack */ stack:endcons(2,stack); stack:endcons(3,stack); block ( loop, stack:delete(last(stack),stack), /* pop from stack */ disp(stack), /* display */ if is(not emptyp(stack)) then go(loop) ); stack;
[edit] Example programs
- Iteration of complex numbers, stack and drawing a list of points
Julia set using IIM
- Iteration of complex numbers, comparing complex numbers, finding period of cycle
- Drawing Julia set and critical orbit. Computing period
- drawing curves in 2D plane
- drawing points