Author: Paul Zimmermann Date : 03. Mar. 1996 Format: dvi, postscript
We describe in this paper the problems that can be solved with MuPAD
1.3, and how to solve them. The problems marked as
are solved using new funcionalities
of the version 1.3 with respect to 1.2.2.
- [Summary]
>> fact(50); 30414093201713378043612608166064768844377641568960512000000000000
>> ifactor(fact(50)); [1, 2, 47, 3, 22, 5, 12, 7, 8, 11, 4, 13, 3, 17, 2, 19, 2, 23, 2, 29, 1, 31, 1, 37, 1, 41, 1, 43, 1, 47, 1]The function ifactor(n) returns a list [ e, p1, a1, ... , pk, ak ], where e is 1 or -1 and n = e * p1^a1 *...* pk^ak.
>> _plus(1/i$i=2..10); 4861/2520In MuPAD each arithmetic operator has a functional form, here _plus for addition, so for example _plus(a,b) is the same as a+b.
>> DIGITS:=50: float(exp(PI*sqrt(163))); 2.6253741264076874399999999999925007259719818568887e17The floating-point numbers are output in scientific notation. This notation can be used as input too.
>> besselJ(2,1.0+I); 0.4157988694e-1 + 0.2473976415 IPlease note that floating-point numbers are ``contagious'': no float instruction is needed here.
>> export(numlib): >> decimal(1/7); 0, [1, 4, 2, 8, 5, 7]This result means that the decimal expansion of 1/7 is 0.142857142857142.... Then export(numlib) exports the functions of this package, i.e. enables one to call them with a short name (otherwise we should write numlib::decimal).
>> contfrac(PI,5); 1 ---------------------- + 3 1 ------------------ + 7 1 ------------- + 15 1 --------- + 1 1 --- + 292 ...The second (optional) argument of contfrac specifies the number of digits to be taken into account before computing the continued fraction.
>> radsimp(sqrt(2*sqrt(3)+4)); 1/2 3 + 1
>> radsimp(sqrt(14 + 3*sqrt(3 + 2*sqrt(5 - 12*sqrt(3 - 2*sqrt(2)))))); 1/2 2 + 3
>> 2*infinity-3; infinityThe symbol infinity is implemented as a domain in MuPAD. This allows the overloading of the basic arithmetic operations, together with the comparisons. For example we can write in a MuPAD program if a < infinity then ... end_if.
>> stats::stdev([1,2,3,4,5],Sample); 1/2 1/2 2 5 --------- 2Here we have shown the other way to call package functions, without exporting them.
>> l:=[ 1, -2, 3, -4, 5, -6, 7, -8, 9, 10 ]: >> stats::meanTest(l,5); / / 1/2 \ \ | | 7 10 | | | 105 atan| - ------------ | | | 1/2 | 1/2 1/2 | | | 105 PI 2416017695 10 \ 5 2 29 / | 128 | ------ - --------------------- + -------------------------- | | 256 1/2 1/2 128 | \ 1416468496 2 29 / ------------------------------------------------------------------- 105 PI >> float(%); 0.05756660091
>> l:=[ 1, -2, 3, -4, 5, -6, 7, -8, 9, 10 ]: >> stats::meanTest(l,5,stats::normal); / 1/2 \ | 21 10 | erf| -------- | | 1/2 | \ 10 29 / - --------------- + 1/2 2 >> float(%); 0.04058346175
>> normal((x^2 - 4)/(x^2 + 4*x + 4)); x - 2 ----- x + 2
>> simplify((exp(x)-1)/(exp(x/2)+1),exp); / x \ exp | - | - 1 \ 2 /
>> Factor(diff(expand((x + 1)^20),x)); 19 20 (x + 1)MuPAD provides two factorization functions: the toplevel function Factor returns an expression, and the library function factor returns a list [ e, p1, a1, ... , pk, ak ] where e is a scalar, the pi are irreducible polynomials and the ai are the corresponding powers. In the above example, factor would return [ 20, x + 1, 19 ].
>> Factor(x^100-1); / 2 \ / 2 3 4 \ / 2 3 4 (x + 1) (x - 1) \ x + 1 / \ x + x + x + x + 1 / \ - x + x - x + x + \ / 2 4 6 8 \ / 5 10 15 20 \ / 5 1 / \ - x + x - x + x + 1 / \ x + x + x + x + 1 / \ - x + x 10 15 20 \ / 10 20 30 40 \ - x + x + 1 / \ - x + x - x + x + 1 /
>> Qphi:= AlgebraicExtension( Rational, X^2-X-1, phi ): >> Qphi::name := "Qphi"; >> Factor( poly(x^4-3*x+1, Qphi) ); poly(x + phi, [x], Qphi) poly(x + phi - 1, [x], Qphi) poly(x + phi + 1, [x], Qphi) poly(x - phi, [x], Qphi)We have first defined the algebraic extension Qphi of the rationals with the polynomial X^2-X-1, with phi being an alias for the roots of this polynomial. The command Qphi::name:="Qphi" was only used to have a simpler output for the algebraic extension name.
>> factor(poly(x^4 - 3*x^2 + 1,[x],IntMod(5))); [1, poly(x - 2, [x], IntMod(5)), 2, poly(x + 2, [x], IntMod(5)), 2]This result means that x^4 - 3x^2 + 1 factors into (x-2)^2 (x+2)^2 modulo 5. MuPAD provides a special representation poly for polynomials, that enables the user to specify the variables and the coefficient field.
>> partfrac((x^2+2*x+3)/(x^3+4*x^2+5*x+2)); 2 3 - 2 - ----- + ----- + 2 (x + 1) x + 1 x + 2
>> solve( abs(x-1) > 2, x ); {[-infinity <= x, x < -1], [3 < x, x <= infinity]}
>> solve( expand((x-1)*(x-2)*(x-3)*(x-4)*(x-5)) < 0, x ); {[2 < x, x < 3], [-infinity <= x, x < 1], [4 < x, x < 5]}
>> expand(cos(3*x)/cos(x)); 2 4 cos(x) - 3
>> combine(expand(cos(3*x)/cos(x)),sincos); 2 cos(2 x) - 1
>> sqrt(997)-(997^3)^(1/6); 1/6 1/2 - 991026973 + 997 >> simplify(%); 0
>> sqrt(999983)-(999983^3)^(1/6); 1/2 1/6 999983 - 999949000866995087 >> simplify(%); 0
>> simplify(expand((2^(1/3)+4^(1/3))^3-6*(2^(1/3)+4^(1/3))-6)); 0
>> f := ln(tan(x/2+PI/4))-asinh(tan(x)): >> float(subs(f,x=-2)); - 3.046904887 + 3.141592653 Iand whence it is not possible to achieve it in MuPAD.
>> f := ln(tan(1/2*x + PI/4)) - asinh(tan(x)): >> eval(subs(f,x=0)); 0 >> combine(normal(combine(normal(expand(diff(f,x))),sincos)),sincos); 0 >> combine(normal(expand(diff(f,x))),sincos); / 1 \1/2 - cos(x) | ------- | + 1 | 2 | \ cos(x) / --------------------------- cos(x)As said previously, the function f is not zero everywhere in the complex plane. The above expression tells us that the derivative vanishes when the real part of cos x is positive, i.e. we can conclude that f(x) is really zero when -Pi/2 < Re(x) < Pi/2.
>> simplify(ln((2*sqrt(r)+1)/sqrt(4*r+4*sqrt(r)+1))); 0
>> e:=(4*r+4*sqrt(r)+1)^(sqrt(r)/(2*sqrt(r)+1)) *(2*sqrt(r)+1)^(1/(2*sqrt(r)+1))-2*sqrt(r)-1: >> assume(r>0): >> simplify(e); 0Without the assumption r>0, MuPAD cannot simplify the expression because the transformation (z^a)^b --> x^ab is not true in general for z complex (here we have z=2 sqrt(r)+1, a=2, and b=sqrt(r)/(2 sqrt(r)+1).
>> rectform(ln(3+4*I)); ln(5) + I atan(4/3)The real and imaginary part are obtained with Re(..) and Im(..) respectively.
>> rectform(tan(x+I*y),{x,y}); sin(2 x) I sinh(2 y) -------------------- + -------------------- cos(2 x) + cosh(2 y) cos(2 x) + cosh(2 y)Here the set {x,y} given as second argument specifies that the variables x and y are real. By default all variables are considered as complex.
>> sqrt(x*y*abs(z) / (sqrt(x)*abs(z)); -1/2 1/2 x (x y)
>> sqrt(exp(z))-exp(z/2); / z \ 1/2 - exp | - | + exp(z) \ 2 /
>> sqrt(exp(6*I)); -exp(3 I)
>> simplify(ln(exp(z))); ln(exp(z)) >> assume(x,Type::RealNum): ln(exp(x)); x
>> ln(exp(10*I)); (- 4 I) PI + 10 I
>> e:=(x*y)^(1/n)-x^(1/n)*y^(1/n): simplify(e); 1 1 1 - - - n n n (x y) - x y >> assume(x>0): simplify(e); 0 >> unassume(x): assume(y>0): simplify(e); 0Here the command unassume(x) deletes all assumptions about the variable x.
>> atan(tan(z)); atan(tan(z)) >> assume(x>-PI/2): assume(x<=PI/2): atan(tan(x)); x
>> atan(tan(4)); - PI + 4
>> simplify( (x=0)/2+1, relation ); x - + 1 = 1 2
>> s:=solve( 3*x^3-18*x^2+33*x-19 ): >> simplify( rectform(s[i])) $ i=1..3; 1/2 / PI \ 1/2 / PI \ 2 3 cos| -- | 3 cos| -- | \ 18 / / PI \ \ 18 / ---------------- + 2, - sin| -- | - -------------- + 2, 3 \ 18 / 3 1/2 / PI \ 3 cos| -- | / PI \ \ 18 / sin| -- | - -------------- + 2 \ 18 / 3
>> p:=x^4+x^3+x^2+x+1: s:=solve(p,x); { / 1/2 \1/2 / 1/2 \1/2 { | 5 | | 5 | { 1/2 | - ---- - 5/2 | 1/2 | - ---- - 5/2 | { 5 \ 2 / 5 \ 2 / { ---- - ------------------- - 1/4, ---- + ------------------- - 1/4, { 4 2 4 2 / 1/2 \1/2 / 1/2 \1/2 } | 5 | | 5 | } 1/2 | ---- - 5/2 | 1/2 | ---- - 5/2 | } 5 \ 2 / 5 \ 2 / } - ---- - ----------------- - 1/4, - ---- + ----------------- - 1/4 } 4 2 4 2 }
>> expand(simplify(expand(subs(p,x=s[1])))); 0
>> solve(exp(2*x)+2*exp(x)+1=z,x); 1/2 {(- 2 I) PI (0, 1, -1, ...) + ln(z - 1), 1/2 (- 2 I) PI (0, 1, -1, ...) + ln(- z - 1)}
>> solve( (x+1)*(sin(x)^2*cos(3*x)^3) = 0, x ); { { I asinh(1) + 2 PI (0, 1, -1, ...), (- I) asinh(1) + 2 PI (0, 1, -1, ...), -1, { PI PI (0, 1, -1, ...) -- + ------------------, PI + (- I) asinh(1) + 2 PI (0, 1, -1, ...), 6 3 } PI + I asinh(1) + 2 PI (0, 1, -1, ...) } }
>> solve( exp(z) = 1, z ); {(- 2 I) PI (0, 1, -1, ...)} Here again the variable k1 represents an arbitrary integer.
>> solve( sin(x) = cos(x), x ); { PI 3 PI } { -- + 2 PI (0, 1, -1, ...), - ---- + 2 PI (0, 1, -1, ...) } { 4 4 }
>> solve( tan(x) = 1, x ); { PI } { -- + PI (0, 1, -1, ...) } { 4 }
>> solve(sin(x)=tan(x),x); {PI (0, 1, -1, ...), 2 PI (0, 1, -1, ...)}
>> solve(sqrt(x^2+1)=x-2,x); {}The function sqrt in MuPAD represents the principal square root, and the possible solution x=3/4 does not correspond to a principal square root.
>> solve(exp(2-x^2)=exp(-x),x); { 1/2 1/2 } { (8 I PI (0, 1, -1, ...) + 9) (8 I PI (0, 1, -1, ...) + 9) } { ------------------------------- + 1/2, - ------------------------------- + 1/2 } { 2 2 } >> assume(x,Type::RealNum): >> solve(exp(2-x^2)=exp(-x),x); {-1, 2}The first solution assumes that x represents any complex number, whereas in the second call MuPAD was asked to return only real solutions, which correspond to the index 0 of the general solution.
>> solve(sqrt(ln(x))=ln(sqrt(x)),x); {1, exp(4)}The above answer is returned without any assumption about x, therefore 1 and e^4 are the only roots in the whole complex plane.
>> solve( abs(x-1)=2, x ); [3, -1]
>> linsolve({x+y+z=6,2*x+y+2*z=10,x+3*y+z=10},{x,y,z}); [{y = 2, x = - z + 4 }]
>> s:=solve({ x^2*y + 3*y*z - 4, -3*x^2*z + 2*y^2 + 1, 2*y*z^2 - z^2 - 1}): -- -- 2 4 | | 5 z 21 z 5 6 | | y = - ---- - ----- + 24 z - 9 z - 1, -- -- 2 2 2 2 3 4 5 6 7 x = RootOf(19 z + 6 x - 48 z + 2 z + 48 z + 3 z - 48 z + 18 z , x) -- -- 2 4 6 7 8 | | , z = RootOf(3 z + 5 z + 21 z - 48 z + 18 z + 1) | | -- --Here the solution is expressed with the help of the RootOf notation. There are 8 solutions, each one corresponding to z being one of the roots of the polynomial 18z^8-48z^7+21z^6+5z^4+3z^2+1, y is a polynomial in z as shown above, and x being one root of a degree two polynomial dependent on z.
>> export(Dom): export(linalg): >> M := Matrix( ExpressionField(normal) ): >> m := M( [[a,b],[1,a*b]] ): >> 1/m; +- -+ | a 1 | | ------ , --------- | | 2 2 | | a - 1 - a + 1 | | | | 1 a | | -------- , ----------- | | 2 2 | | b - a b - b + a b | +- -+Here we first export the necessary packages, then we define the domain M of matrices whose coefficients are in the domain ExpressionField(normal), which means the set of all MuPAD expressions after simplification by normal. We could have written as well Matrix( ExpressionField ) if we do not want the expressions to be normalized. Please note that no special command is necessary to invert the matrix: we can use the standard arithmetic operators due to the overloading mechanism of MuPAD.
>> M := Dom::SquareMatrix(4): >> m := M([[1,1,1,1],[w,x,y,z],[w^2,x^2,y^2,z^2],[w^3,x^3,y^3,z^3]]): >> Factor(det(m)); (w - x) (w - z) (x - z) (x - y) (w - y) (y - z)
>> m := Dom::SquareMatrix(3)([[5, -3, -7],[-2, 1, 2],[ 2, -3, -4]]): >> linalg::eigenValues(m); [1, 3, - 2]
>> Factor(sum(k^3,k=1..n)); 2 2 1/4 n (n + 1)
>> sum(1/k^2+1/k^3,k=1..infinity); 2 PI zeta(3) + --- 6
>> misc::freeze(sum)(1/k^2+1/k^3,k=1..infinity); / 1 1 \ | -- + --, k = 1..infinity | sum| 2 3 | \ k k / >> float(%); 2.84699097The function misc::freeze enables one to make a MuPAD function like sum or int inert, but the attributes of the function (here the float attribute) are loaded. Here MuPAD uses Euler-Maclaurin formula.
>> product(K, k=1..n); gamma(n + 1)The command rewrite(%,fact) enables one to rewrite the answer in terms of the factorial function.
>> limit((1+1/n)^n,n=infinity); E >> limit((1-cos(x))/x^2,x=0); 1/2It should be noted that the limit functions of MuPAD implements the best known algorithm to this date. It is based on the concept of most-rapidly-varying subexpressions (MRV), and a comparison made by Dominik Gruntz on 19 exp-log expressions Gruntz95 showed that the algorithms implemented in other computer algebra systems (except Maple and MuPAD) fail on many examples, and even return wrong values !
>> diff(y(x(t)),t$2); 2 D(D(x))(t) D(y)(x(t)) + D(x)(t) D(D(y))(x(t))
>> int(1/(x^3+2),x); / / 3 \ \ sum \ X2 ln(x + 6 X2), X2 = RootOf \ 108 X3 - 1, X3 / / >> diff(%,x); 1 ------ 3 x + 2The output from int means that an antiderivative of 1/(x^3+2) is the sum of the three functions ai*ln(x+6*ai), where ai is one of the roots of the polynomial 108 X^3-1. The sum expression can be differentiated, and the result is a sum of three rational functions, namely ai/(x+6*ai), which is automatically normalized. More generally, the sum of any rational function over the roots of a polynomial simplifies to an expression involving the polynomial coefficients. The MuPAD syntax for this is sum(f,t=RootOf(..)); for example sum(t^2,t=RootOf(x^3+a*x^2+b*x+c,x)) returns a^2-2*b.
>> assume(a^2<b^2): >> int(1/(a+b*cos(x)),x); 2 2 2 2 1/2 2 2 1/2 ln((I a + (- I) b + a (- a + b ) + b cos(x) (- a + b ) + 2 2 1/2 2 2 1/2 2 (- I) b sin(x) (- a + b ) ) / b) / (- a + b ) - ln(((- I) a + 2 2 2 1/2 2 2 1/2 I b + a (- a + b ) + b cos(x) (- a + b ) + 2 2 1/2 2 2 1/2 (- I) b sin(x) (- a + b ) ) / b) / (- a + b )
>> normal(expand(combine(normal(diff(%,x)),sincos))); 1 ------------ a + b cos(x)
>> diff(abs(x),x); sign(x)The extension of the functionality of MuPAD by such rules is very easy. For example to ``teach'' to MuPAD that the derivative of sin(f) with respect to x is cos(f) f', we simply write:
>> sin := funcattr(sin,"diff",proc(f,x) begin cos(f)*diff(f,x) end_proc);
>> int(abs(x),x); x abs(x) -------- 2
>> a:=proc(x) begin if x < 0 then -x else x end_if end_proc: >> D(a); proc(x) name a; begin if x < 0 then -1 else 1 end_if end_proc
>> a:=proc(x) begin if x < 0 then -x else x end_if end_proc: >> int(a); proc(x) name a; begin if x < 0 then x^2*(-1/2) else x^2*1/2 end_if end_proc
>> int(x/(sqrt(1 + x) + sqrt(1 - x)), x); / ln(x + 1) \ / x \ / ln(- x + 1 ) \ / x \ exp | --------- | | - + 1/3 | + exp | ------------ | | - - + 1/3 | \ 2 / \ 3 / \ 2 / \ 3 /The result can be simplified using the expand command.
>> int((sqrt(1 + x) - sqrt(1 - x))/2, x); / ln(x + 1) \ / x \ / ln(- x + 1 ) \ / x \ exp | --------- | | - + 1/3 | + exp | ------------ | | - - + 1/3 | \ 2 / \ 3 / \ 2 / \ 3 /MuPAD 1.2.1 was already able to solve these two examples, but you had to explicitly load the intlib package and to call intlib::int. Now there is a ``toplevel'' function int for definite and indefinite integration.
>> int(1/(x-a),x=a-1..a+1), int(1/(x-a),x=a-1..a+1,PrincipalValue); undefined, 0
>> int(1/(x-a)^2,x=a-1..a+1); infinity
>> int(sqrt(x+1/x-2),x=0..1); 4/3
>> int(sqrt(x+1/x-2),x=1..2); (1/2) 2 2 - -------- + 4/3 3
>> int(sqrt(x+1/x-2),x=0..2); (1/2) 2 2 - -------- + 8/3 3
>> sign(a):=1: int( cos(x)/(x^2+a^2), x=-infinity..infinity ); PI exp(-a) ---------- a
>> assume(Re(a)>0): assume(Re(a)<1): >> int(t^(a-1)/(1+t),t=0..infinity); gamma(a) gamma(- a + 1)
>> int(int(int(1,z=0..c*(1-x/a-y/b)),y=0..b*(1-x/a)),x=0..a); a b c ----- 6
>> series(1/sqrt(1-(v/c)^2),v=0); - 2 2 - 4 4 c v 3 c v / 6 \ ------- + --------- + 1 + O \ v / 2 8
>> 1/%^2; - 2 2 / 6 \ - c v + 1 + O \ v /This is possible in MuPAD because of the domain facility, and the fact that standard arithmetic operations can be overloaded for domain elements. This allows to get O(x) as the result of O(x)-O(x), whereas for example Maple gives 0.
>> series(sin(x),x)/series(cos(x),x)=series(tan(x),x); 3 5 3 5 x 2 x / 6 \ x 2 x / 6 \ x + -- + ---- + O \ x / = x + -- + ---- + O \ x / 3 15 3 15 >> bool(%); TRUEHere again, the results of a series command can be combined with any arithmetic operation.
>> series(ln(sinh(z))+ln(cosh(z+w)),z,3); z sinh(w) / 2 \ ln(z) + ln(cosh(w)) + --------- + O \ z / cosh(w)
>> %-series(ln(sinh(z)*cosh(z+w)),z,3); / 2 \ O \ z /
>> series(ln(sin(x)/x),x); 2 4 x x / 5 \ - -- - --- + O \ x / 6 180
>> series(exp(-x)*sin(x),x,infinity); / n n 1/2 / 3 n PI \ \ | x (2 ) sin| ------ | | sum| \ 4 / | | ------------------------, n = 0..infinity | \ fact(n) /
>> s:=series(sin(y)+cos(y),y=0); 2 3 4 5 y y y y / 6 \ y - -- - -- + -- + --- + 1 + O \ y / 2 6 24 120 >> t:=revert(s); 2 3 5 (y - 1) 2 (y - 1) 4 17 (y - 1) / 6 \ y + -------- + ---------- + (y - 1) + ----------- - 1 + O \ (y - 1) / 2 3 10We can check the result by asking for s @ t that computes the composition of s and t.
>> Dom::Pade(exp(-x),x,3); - x + 2 ------- x + 2The above fraction has the same Taylor expansion as exp(-x) up to order 2. The order given to
>> laplace( cos((w-1)*t), t, s ); s ------------- 2 2 s + (w - 1)
>> ilaplace( %, s, t ); cos(t (w - 1))
>> ode({diff(f(t),t,t)+4*f(t)=sin(2*t),f(0)=0,D(f)(0)=0},f(t)); ode({D(f)(0) = 0, f(0) = 0, 4 f(t) + diff(f(t), t, t) = sin(2 t)}, f(t)) >> solve(%); -- sin(2 t) t cos(2 t) -- | -------- - ---------- | -- 8 4 --Here we first define the equation with the ode command, and simply call solve on this equation.
>> laplace( diff(f(t),t,t)+4*f(t)=sin(2*t), t, s); 2 4 laplace(f(t), t, s) - D(f)(0) + s (s laplace(f(t), t, s) - f(0)) = ------ 2 s + 4 >> solve( subs(%,f(0)=0,D(f)(0)=0), laplace(f(t), t, s) ); -- 2 -- | --------- | | 2 2 | -- (s + 4) -- >> ilaplace( op(%),s,t ); / sin(2 t) t cos(2 t) \ 2 | -------- - ---------- | \ 16 8 /
>> solve(ode(x^2*diff(y(x),x)+3*x*y(x)=sin(x)/x,y(x))); -- - 3 - 3 -- | C3 x - x cos(x) | -- --
>> solve(ode(diff(y(x),x,x)+y(x)*diff(y(x),x)^3=0,y(x))); -- / 3 \ -- | C5, RootOf \ 6 x + 6 C6 + 6 C4 y - y , y / | -- --This result says that the solution is either a constant function y(x)=C5, or an algebraic function satisfying the equation y(x)^3 = 6 C4 y(x)+6x+6 C6 where C4 and C6 are arbitrary constants.
>> solve(ode(diff(y(x,a),x)=a*y(x,a),y(x,a))); [C1 exp(a x)]MuPAD recognizes equations with only one differential variable as ordinary differential equations.
>> solve(ode({diff(y(x),x,x)+k^2*y(x),y(0)=0,D(y)(1)=0},y(x))); {0} >> solve(ode({diff(y(x),x,x)+(PI/2)^2*y(x),y(0)=0,D(y)(1)=0},y(x))); {- C19 exp(1/2 I x PI) + C19 exp((- 1/2 I) x PI)}The general equation has no solution valid for all values of k. For k of the form Pi/2 + n*Pi where n is an integer, it has solutions that MuPAD finds.
>> sys := {diff(x(t),t)-x(t)+y(t)=0,diff(y(t),t)-x(t)-y(t)=0}: >> solve(ode(sys, {x(t),y(t)})); [x(t) = (I) C5 exp((1 + I) t) + (- I) C6 exp((1 - I) t), y(t) = C5 exp(( 1 + I) t) + C6 exp((1 - I) t)]
>> eval(subs([op(sys)],op(%))); [0 = 0, 0 = 0]
>> solve( ode({diff(x(t),t)=x(t)*(1+cos(t)/(2+sin(t))), diff(y(t),t)=x(t)-y(t)}, {x(t),y(t)}) ); { { C1 cos(t) exp(t) 2 C1 sin(t) exp(t) { { y(t) = C1 exp(t) + C2 exp(-t) - ---------------- + ------------------, { { 5 5 } } x(t) = C1 exp(t) (sin(t) + 2) } } } }
>> solve( ode(diff(x(t),t)=x(t)*(1+cos(t)/(2+sin(t))),x(t)) ); {C3 exp(t) (sin(t) + 2)} >> solve( ode(diff(y(t),t)=op(%)-y(t),y(t)) ); { C1 cos(t) exp(t) 2 C1 sin(t) exp(t) } { C1 exp(t) + C2 exp(-t) - ---------------- + ------------------ } { 5 5 }
>> L := (D-id) @ (D+2*id); (- id + D )@(2 id + D)In MuPAD, id stand for the identity, and @ is the composition operator.
>> L(f); - 2 f + D(f) + D(D(f))
>> L(g)(y); - 2 g(y) + D(g)(y) + D(D(g))(y)
>> h:= func( A*sin(z^2), z ): >> L(h)(z); 2 2 2 2 2 2 A cos(z ) - 2 A sin(z ) + 2 A cos(z ) - 4 A z sin(z )
>> T:=proc(f) begin &> eval(subsop(hold(func(f,x,a)), &> 1=_plus(f(a),_fconcat(D$k)(f)(a)/fact(k)*(x-a)^k$k=1..2))) &> end_proc:
>> T(f); func(f(a) + (-a + x)*D(f)(a) + (-a + x)^2*D(D(f))(a)*1/2, x, a)
>> T(g)(y,b); 2 D(D(g))(b) (- b + y ) g(b) + D(g)(b) (- b + y ) + ---------------------- 2
>> T(sin)(z,c); 2 sin(c) (- c + z ) sin(c) + cos(c) (- c + z ) - ------------------ 2
>> p:= proc(n, x) begin if n = 0 then 1 else normal(1/(2^n*fact(n)) * diff((x^2 - 1)^n, x$n)) end_if end_proc: >> p(i,x) $ i=0..4; 2 3 2 4 3 x 3 x 5 x 15 x 35 x 1, x, ---- - 1/2, - --- + ---- , - ----- + ----- + 3/8 2 2 2 4 8
>> pp:= proc(n, x) option remember; begin if n=0 then 1 elif n=1 then x else normal(((2*n - 1)*x*pp(n - 1, x) - (n - 1)*pp(n - 2, x))/n) end_if end_proc: >> pp(i,x) $ i=0..4; 2 3 2 4 3 x 3 x 5 x 15 x 35 x 1, x, ---- - 1/2, - --- + ---- , - ----- + ----- + 3/8 2 2 2 4 8
>> pp(4,1); 1The Legendre polynomials are already defined in the orthpoly package, whence one can write orthpoly::legendre(4,1) too.
>> p:= poly(_plus(a.i * x^i $ i=1..5), [x]); / 2 3 4 5 \ poly \ x a1 + x a2 + x a3 + x a4 + x a5, [x] /
>> p(x); x (a1 + x (a2 + x (a3 + x (a4 + x a5))))
>> generate::fortran(hold(p)=%); p = x*(a(1)+x*(a(2)+x*(a(3)+x*(a(4)+x*a(5)))))
>> TRUE and FALSE; FALSE
>> x or (not x); TRUE
>> simplify( x or y or (x and y), logic ); x or y
Reduce can solve 65 problems,
Axiom can solve 75 problems,
Derive can solve 88 problems,
Mathematica can solve 102 problems,
Maple can solve 110 problems and
PC Macsyma 2.1 can solve 122 problems.
But none of these systems is public domain !
You can get MuPAD by anonymous ftp from math-ftp.uni-paderborn.de:/MuPAD (main site) and also from ftp.inria.fr/lang/MuPAD and some other sites.
Also refer to http://math-www.uni-paderborn.de/MuPAD/ for further information about new releases, news & infos, FAQ's, a bibliography and more ...
Acknowledgement: Many thanks to Michael Wester for his very detailed comments on a first version of this paper.