showtime: true;

Rechnen mit Dezimalzahlen

(1.23+2.25)/3.67;

fpprec: 500; fpprintprec: 500;

bfloat(%pi);

set_display(ascii);

bfloat(%pi);

Rechnen mit ganzen Zahlen

100!;

set_display(xml);

2^64-1;

float(%);

100!/2^100;

sum(1/k,k,1,100);

float(%);

factor(100!);

2^256+1;

factor(2^256+1);

p:random(10^35);

q:random(10^35);

p*q;

factor(p*q);

primep(1234567);

ifactors(1234567);

my_next_prime(n):=
if primep(n+1) then n+1 
else my_next_prime(n+1);

my_next_prime(1234567);

next_prime(1234567);

primep(%);

mersenne:2^57885161-1 $

bfloat(mersenne);

Rechnen mit algebraischen Zahlen

x: sqrt(2)+sqrt(3);

1/x;

ratsimp(1/x);

rat(1/x), algebraic: true;

y: sqrt(3)-sqrt(2);

expand(x*y);

sin(%pi/6);

sin(%pi);

bfloat(%pi), fpprec: 100;

sin(%);

Rechnen mit Polynomen und rationalen Funktionen

kill(x,y)$

pol:x^2+2*x+1;

factor(pol);

expand(pol);

pol: (x+y)^10-(x-y)^10;

expand(pol);

factor(pol);

rat: (1-x^10)/(1-x^4);

ratsimp(rat);

factor(rat);

factor(x^4+1);

gfactor(x^4+1);

factor(x^4+1, a^2-2);

Rechnen mit Matrizen

listtomat(L):=block([i, M], 
  M:matrix(), 
  for i:1 thru length(L) do 
    M:addrow(M,L[i]),
  return(M)
)$

my_hilbert_matrix(n):=listtomat(makelist(makelist(1/(j+k-1),j,1,n),k,1,n));

H: my_hilbert_matrix(7);

invert(H);

determinant(H);

Lösen von Gleichungen

plot2d(x^2-3*x-1,[x,-3,5]);

s: solve(x^2-3*x-1=0,x);

plot2d(x^3-3*x-1,[x,-3,3]);

s: solve(x^3-3*x-1=0,x);

allroots(x^3-3*x-1);

plot2d(x^4-3*x-1,[x,-2,2]);

s: solve(x^4-3*x-1=0, x);

allroots(x^4-3*x-1);

plot2d(x^5-3*x-1,[x,-2,2]);

s: solve(x^5-3*x-1=0, x);

allroots(x^5-3*x-1);

Graphische Darstellungen

load(implicit_plot);

implicit_plot([x^2+y^2=1], 
    [x, -3, 3], [y, -3, 3]);

implicit_plot([x^2+y^2=1, -x^2+2*y^2+1=0], 
    [x, -3, 3], [y, -3, 3]);

solve([x^2+y^2=1, -x^2+2*y^2+1=0], [x,y]);

implicit_plot([x^2/4+y^2=1, -x^2+2*y^2+1=0], 
    [x, -3, 3], [y, -3, 3]);

solve([x^2/4+y^2=1, -x^2+2*y^2+1=0], 
    [x,y]);

plot2d([sin(x), cos(x), tan(x)],
    [x,-5,5], [y, -2, 2]);

plot_options;

plot3d(x^2-y^2,[x,-2,2],[y,-2,2]);

plot3d(x*y/(x^2-y^2),[x,-2,2],
[y,-2,2],[z,-2,1/2], 
    [grid, 60, 60]);

contour_plot(sin(x)*sin(y),[x,-3,3],[y,-3,3],
    [gnuplot_preamble, "set cntrparam levels 12"]);

Differential- und Integralrechnung

limit((exp(x)-1)/x,x,0);

taylor((exp(x)-1)/x,x,0,10);

ableitung: diff((exp(x)-1)/x,x);

integrate(ableitung,x);

integrate(ableitung,x), gamma_expand: true;

diff(%,x);

eingabe: (x^3+x^2+x-1)/(x^4+x^2+1);

plot2d(eingabe,[x,-5,5]);

integral: integrate(eingabe,x);

resultat: diff(integral,x);

resultat, ratsimp;