Windows installer: Update texinfo.
[maxima.git] / demo / demo.dem
blobbd3377bc8dfcc9ad568b95ebf8f6b319aede7d9b
2 title(exp):=disp(dpart(exp))$
3 (title("a classical textbook example of differentiation"))$
4 x^x^x;
5 diff(%,x);
6 (title("differentiation of a nested function"))$
7 erf(tan(acos(log(x))));
8 diff(%,x);
9 title("expanding and factorizing a univariate polynomial")$
10 (x-1)*(2*x-1)*(3*x-1)^7;
11 expand(%);
12 factor(%);
13 title("factorization of cyclotomic polynomials - which form of an expression is more simple?")$
14 x^600-1;
15 factor(%);
16 title("factorization of a multivariate polynomial")$
17 (y^3-x^2)^4*(x+y+z)^2;
18 expand(%);
19 factor(%);
20 title(" algebraic simplification example")$
21 (sqrt(r^2+a^2)+a)*(sqrt(r^2+b^2)+b)/r^2
22  -(sqrt(r^2+b^2)+sqrt(r^2+a^2)+b+a)/(sqrt(r^2+b^2)+sqrt(r^2+a^2)-b-a);
23 ratsimp(%);
24 title(" algebraic simplification example")$
25 (z^5-y*z^4+x*z^4-2*y*z^3-6*x*z^3+2*y^2*z^2+4*x*y*z^2-6*x^2*z^2+y^2*z+
26 6*x*y*z+9*x^2*z-y^3-5*x*y^2-3*x^2*y+9*x^3)/(-z^2+y+3*x)^2;
27 ratsimp(%);
28 title("integration of a non-tabulated function")$
29 1/(x^3+a*x^2+x);
30 integrate(%,x);
31 diff(%,x),ratsimp;
32 title("logarithmic subcase of risch's integration algorithm")$
33 (log(x)-1)/(log(x)^2-x^2);
34 integrate(%,x);  
35 title("taylor series example")$
36 sin(x+a*x^3);   
37 taylor(%,x,0,19);
38 title("taylor series example - puiseux")$
39 sqrt(log(1+x)+sin(x));
40 taylor(%,x,0,17); 
41 title("macsyma to fortran conversion - optimized routine not yet available")$
42 exp:-gamma^5+delta*gamma^4+2*delta^2*gamma^3-alpha^3*gamma^3-3*alpha^2*gamma^3
43 -3*alpha*gamma^3-gamma^3-2*delta^3*gamma^2+3*alpha^3*delta*gamma^2
44 +9*alpha^2*delta*gamma^2+9*alpha*delta*gamma^2+3*delta*gamma^2
45 +alpha^2*gamma^2-2*alpha*gamma^2+gamma^2-delta^4*gamma-3*alpha^3*delta^2*gamma
46 -9*alpha^2*delta^2*gamma-9*alpha*delta^2*gamma-3*delta^2*gamma
47 +2*alpha^2*delta*gamma-4*alpha*delta*gamma+2*delta*gamma+delta^5
48 +alpha^3*delta^3+3*alpha^2*delta^3+3*alpha*delta^3+delta^3+alpha^2*delta^2
49 -2*alpha*delta^2+delta^2+alpha^5+alpha^4-2*alpha^3-2*alpha^2+alpha+1;
50 fortran(%);
51 factorsum(exp);
52 fortran(%);
53 title("bignum arithmetic and arbitrary precision floating point arithmetic")$
54 6427752177035961102167848369364650410088811975131171341205503;
55 %^5;
56 2535301200456458802993406410751;
57 %th(3)/%;
58 sqrt(%pi),numer;
59 fpprec:50;
60 bfloat(sqrt(%pi));
61 title("large numbers - the largest known prime number")$
62 2^(44497)-1;
63 title("vandermond's matrix")$
64 mat1:matrix([1,x,x^2,x^3],[1,y,y^2,y^3],[1,z,z^2,z^3],[1,w,w^2,w^3]);
65 factor(determinant(mat1));
66 minor(mat1,4,4);
67 %^^-1,factor;
68 title("solving algebraic equations")$
69 q^2*x^2+p^2*q*x-p*q*x-p^3=0;
70 solve(%,x);
71 title("application of cubic formula")$
72 (breakup:false,eq:4*x^3+a*x+10*b= 0);
73 h:solve(eq,x)$
74 first_root:first(h);
75 second_root:part(h,2);
76 third_root:last(h);
77 title("solution of set of simultaneous linear equations")$
78 [3*a+5*b+7*c+11*d+13*e=17*r,19*a+23*b+29*c+31*d+37*e=41*s,43*a+47*b+53*c+59*d+61*e=67*t,
79 71*a+73*b+79*c+83*d+89*e=97*x,101*a+103*b+107*c+109*d+113*e=127*y];
80 solve(%,[a,b,c,d,e]);
81 title("solution of set of simultaneous non-linear equations")$
82 [x*y*z = 42,-z+y+x = -2,-3*z+2*y+3*x = -9];
83 solve(%);
84 title("finding eigenvalues")$
85 matrix([0,6,-10,-8],[6,0,8,10],[-10,8,15*a,6],[-8,10,6,15*a]);
86 solve(charpoly(%,l),l);
87 title("two dimensional plot")$ 
88 plotnum:100$
89 plot(x*sin(x^2),x,0,4,plot(x*sin(x^2),x,0,4));
90 title("two dimensional parametric plot")$
91 plotnum:400;
92 paramplot(s*sin(s),s*cos(s),s,0,80,paramplot(s*sin(s),s*cos(s),s,0,80));
93 title("three dimensional cartesian plot of a bessel function")$
94 plotnum:20$
95 plot3d(j0(sqrt(x^2+y^2)),x,-12,12,y,-12,12,plot3d(j0(sqrt(x^2+y^2)),x,-12,12,y,-12,12));
96 title("three dimensional polar plot of the same bessel function")$
97 plot3d(j0(r),th,0,2*%pi,r,0,12,polar,plot3d(j0(r),th,0,2*%pi,r,0,12,polar));
98 title("three dimensional plot of x*exp(-x^2-y^2)")$
99 plot3d(x*exp(-x^2-y^2),x,-2,2,y,-2,2,plot3d(x*exp(-x^2-y^2),x,-2,2,y,-2,2));