1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
/*************** -*- Mode: MACSYMA; Package: MAXIMA -*- ******************/
/***************************************************************************
*** *****
*** Copyright (c) 1984 by William Schelter,University of Texas *****
*** All rights reserved *****
***************************************************************************/
kill(all);
done;
x^2*'diff(y,x,1)+3*x*y = sin(x)/x;
x^2*'diff(y,x,1)+3*x*y = sin(x)/x$
soln1:ode2(%,y,x);
y = (%c-cos(x))/x^3$
ic1(soln1,x = %pi,y = 0);
y = -((cos(x)+1)/x^3)$
'diff(y,x,2)+y*('diff(y,x,1))^3 = 0;
'diff(y,x,2)+y*('diff(y,x,1))^3 = 0$
soln2:ode2(%,y,x);
(y^3+6*%k1*y)/6 = x+%k2$
bc2(soln2,x = 0,y = 1,x = 1,y = 3);
(y^3-10*y)/6 = x-3/2$
exp:k^2*n^2+k^2*m^2*n^2-k^2*l^2*n^2-k^2*l^2*m^2*n^2;
-k^2*l^2*m^2*n^2+k^2*m^2*n^2-k^2*l^2*n^2+k^2*n^2$
eq1:k^2+l^2 = 1;
l^2+k^2 = 1$
eq2:n^2-m^2 = 1;
n^2-m^2 = 1$
scsimp(exp,eq1,eq2);
k^4*n^4$
exq:(k1*k4-k1*k2-k2*k3)/k3^2;
(k1*k4-k2*k3-k1*k2)/k3^2$
eq3:k1*k4-k2*k3 = 0;
k1*k4-k2*k3 = 0$
eq4:k1*k2+k3*k4 = 0;
k3*k4+k1*k2 = 0$
scsimp(exq,eq3,eq4);
k4/k3$
exp1:2*x^2+y*x+z;
z+x*y+2*x^2$
exp2:3*x+5*y-z-1;
-z+5*y+3*x-1$
exp3:z^2+x-y^2+5;
z^2-y^2+x+5$
eliminate([exp3,exp2,exp1],[y,z]);
[7425*x^8-1170*x^7+1299*x^6+12076*x^5+22887*x^4-5154*x^3-1291*x^2+7688*x+15376]$
eqn1:'diff(f(x),x) = 'diff(g(x),x)+sin(x);
'diff(f(x),x,1) = 'diff(g(x),x,1)+sin(x)$
eqn2:'diff(g(x),x,2) = 'diff(f(x),x)-cos(x);
'diff(g(x),x,2) = 'diff(f(x),x,1)-cos(x)$
atvalue('diff(g(x),x),x = 0,a);
a$
atvalue(f(x),x = 0,1);
1$
/* SF bug #4490: "error message when adding non-conformable matrices" */
(kill (a, b, c, d, u, v, x, y, z),
S: make_string_output_stream (),
with_stdout (S, block ([maperror: true], errcatch (matrix ([a, b], [c, d]) + [x, y, z]))));
[];
is (regex_match ("non-conformable list or matrix arguments", get_output_stream_string (S)) # false);
true;
(close (S),
S: make_string_output_stream (),
with_stdout (S, block ([maperror: true], errcatch (matrix ([a, b], [c, d]) + matrix ([x, y, z], [z, y, x])))));
[];
is (regex_match ("non-conformable list or matrix arguments", get_output_stream_string (S)) # false);
true;
(close (S),
S: make_string_output_stream (),
with_stdout (S, block ([maperror: true], errcatch ([a, b, c, d] + [x, y, z]))));
[];
is (regex_match ("non-conformable list or matrix arguments", get_output_stream_string (S)) # false);
true;
(close (S),
S: make_string_output_stream (),
with_stdout (S, block ([maperror: false, mapprint: true], matrix ([a, b], [c, d]) + [x, y, z])));
matrix ([a + x, b + x], [c + y, d + y]);
is (regex_match ("truncating one or more arguments", get_output_stream_string (S)) # false);
true;
(close (S),
S: make_string_output_stream (),
with_stdout (S, block ([maperror: false, mapprint: true], matrix ([a, b], [c, d]) + matrix ([x, y, z], [z, y, x]))));
matrix ([a + x, b + y], [c + z, d + y]);
is (regex_match ("truncating one or more arguments", get_output_stream_string (S)) # false);
true;
(close (S),
S: make_string_output_stream (),
with_stdout (S, block ([maperror: false, mapprint: true], [a, b, c, d] + [x, y, z])));
[a + x, b + y, c + z];
is (regex_match ("truncating one or more arguments", get_output_stream_string (S)) # false);
true;
(close (S), 0);
0;
/* verify that conformable lists/matrices didn't get messed up */
block ([listarith: true], [a, b, c] + [x, y, z]);
[a + x, b + y, c + z];
matrix ([a, b, c], [x, y, z]) + [u, v];
matrix ([a + u, b + u, c + u], [x + v, y + v, z + v]);
matrix ([a, b], [b, c], [c, d]) + matrix ([x, y], [y, z], [z, x]);
matrix ([a + x, b + y], [b + y, c + z], [c + z, d + x]);
|