Maple

MAPLE是一個符號计算和數值計算軟體平臺 用戶能够直接使用傳統數學符號进行輸入，也可以定制个性化的界面。对于数值计算有额外的支持，能够扩展到任意精度，同时亦支持符號演算及可视化。符號演算的例子参见下文。Maple内建有一种动态的命令行风格的编程语言，该语言支持具有作用域的变量。同时亦有其他語言的接口（C、FORTRAN、Java、Matlab和Visual Basic）。还具有与Excel进行交互的接口。 Maple由一个很小的由C语言编写的内核提供Maple语言。许多功能由各种来源的函数库提供。许多数值计算由NAG数值计算库, ATLAS库, GNU多精度库提供。大部分库由Maple语言编写，并且可查看源代码。 Maple中不同的功能需要不同格式的数值数据。符号表达式在内存中以有向无环图的形式存储。标准界面和计算界面由Java语言编写。经典界面由C语言编写。 简单指令式程序的构造： myfac := proc(n::nonnegint) local out, i; out := 1; for i from 2 to n do out := out * i end do; out end proc; 一些简单的函数也可以使用直观的箭头表示法表示 myfac := n -> product( i, i=1..n ); evalf[100](2^1/12) 1.059463094359295264561825294946341700779204317494185628559208431458761646063255722383768376863945569 f:=x^2-63*x+99=0; solve(f,x); 63 2 + 3 2 ∗ ( 397 ) {\displaystyle {\frac {63}{2}}+{\frac {3}{2}}*{\sqrt {(}}397)} , 63 2 − 3 2 ∗ ( 397 ) {\displaystyle {\frac {63}{2}}-{\frac {3}{2}}*{\sqrt {(}}397)} f := x^7+3*x = 7; solve(f,x); RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index = 1), RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index = 2), RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index = 3), RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index = 4), RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index = 5), RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index = 5), RootOf( Z 7 + 3 Z − 7 {\displaystyle Z^{7}+3Z-7} , index =7), evalf(%); (1.1922047171828134), (0.8658388666792263) + (0.9230818802764879) I, (0.2099602786426775) + (1.3442579297631496) I, (1.2519809466279554) + (0.6424819505558892) I, (1.2519809466279554) - (0.6424819505558892) I, (0.2099602786426775) - (1.3442579297631496) I, (0.8658388666792263) - (0.9230818802764879) I f := sin(x)^3+5*cosh(x) = 0; s i n 3 ( x ) + 5 c o s h ( x ) = 0 {\displaystyle sin^{3}(x)+5cosh(x)=0} > solve(f, x); RootOf( s i n 3 ( Z ) − a r c c o s h ( − 1 5 s i n ( Z ) ) ) {\displaystyle sin^{3}(Z)-arccosh({\frac {-1}{5}}sin(Z)))} > evalf(%); 0.2873691672 - 1.111497506 I 根据 x − y > 6 {\displaystyle x-y>6} ，寻找 ( x + y ) 5 = 9 {\displaystyle (x+y)^{5}=9} 的所有实数解。 solve({x-y > 6, (x+y)^5 = 9}, [x, y])[]; 答案： [ x = 3 2 / 5 − y , y < 1 2 3 2 / 5 − 3 ] {\displaystyle [x=3^{2/5}-y,\quad y<{\frac {1}{2}}3^{2/5}-3]} 代数方程组 > p1 := x*y*z-x*y^2-z-x-y; p2 := x*z-x^2-z-y+x; p3 := z^2-x^2-y^2; > sys := {p1, p2, p3}; > var := {x, y, z}; > solve(sys, var); {x = 0, y = y, z = -y}, {x = 3, y = 4, z = 5}, {x = 1, y = 0, z = -1} 三角方程组 > f1 := cos(x)+sin(3*y)+tan(5*z) = 0; > f2 := cos(3*z)+tan(3*y^2)-sin(2*z^3) = 33; > f3 := tan(4*x+y)-sin(5*y-4*z) = 2*x; > sys1 := {f1, f2, f3}; > var1 := {x, y, z}; {x, y, z} > fsolve(sys1, var1); {x = -10.77771790, y = -2.397849343, z = -7.382158103} 计算矩阵的行列式。 M:= Matrix([[1,2,3]], [a,b,c], [[x,y,z]]); # 矩阵样例 [ 1 2 3 a b c x y z ] {\displaystyle {\begin{bmatrix}1&2&3\\a&b&c\\x&y&z\end{bmatrix}}} with(LinearAlgebra) m:=Determinant(M); 答案： b z − c y + 3 a y − 2 a z + 2 x c − 3 x b {\displaystyle bz-cy+3ay-2az+2xc-3xb} 朗斯基行列式 with(VectorCalculus); w:=Wronskian([1,x,x^3+x-1],x) Matrix(3, 3, {(1, 1) = 1, (1, 2) = x, (1, 3) = x^3+x-1, (2, 1) = 0, (2, 2) = 1, (2, 3) = 3*x^2+1, (3, 1) = 0, (3, 2) = 0, (3, 3) = 6*x}) d:=Determinant(w); 6x 雅可比矩阵 J := Jacobian([r*sin(t)), r^2*cosh(t)], [r, t]); m:=Matrix(2, 2, {(1, 1) = cos(t), (1, 2) = -r*sin(t), (2, 1) = sinh(t), (2, 2) = r*cosh(t)}) d:=Determinant(m); sin(t)*r^2*sinh(t)-2r^2cos(t)cosh(t) 海森矩阵 f := x^3+y*cos(x)+t*tan(y)) with(VectorCalculus); h:=hessian(f,[x,y,t]); [ 6 ∗ x − y ∗ c o s ( x ) − s i n ( x ) 0 − s i n ( x ) 2 ∗ t ∗ t a n ( y ) ∗ ( 1 + t a n ( y ) 2 ) 1 + t a n ( y ) 2 0 1 + t a n ( y ) 2 0 ] {\displaystyle {\begin{bmatrix}6*x-y*cos(x)&-sin(x)&0\\-sin(x)&2*t*tan(y)*(1+tan(y)^{2})&1+tan(y)^{2}\\0&1+tan(y)^{2}&0\end{bmatrix}}} 求 ∫ cos ⁡ ( x a ) d x {\displaystyle \int \cos \left({\frac {x}{a}}\right)dx} . int(cos(x/a), x); 答案： a sin ⁡ ( x a ) {\displaystyle a\sin \left({\frac {x}{a}}\right)} 求 ∫ sin ⁡ ( x a ) d x {\displaystyle \int \sin \left({\frac {x}{a}}\right)dx} . int(sin(x/a), x); 答案： − a cos ⁡ ( x a ) {\displaystyle -a\cos \left({\frac {x}{a}}\right)} 注意：Maple在积分时不提供常数项C，必须自行补上。 定积分 > int(cos(x/a), x = 1 .. 5); 16 a sin（1/a)* cos^4(1/a) - 12 a sin^2(1/a) 计算以下线性常微分方程的一个精确解 d 2 y d x 2 ( x ) − 3 y ( x ) = x {\displaystyle {\frac {d^{2}y}{dx^{2}}}(x)-3y(x)=x} 初始条件为 y ( 0 ) = 0 , d y d x | x = 0 = 2 {\displaystyle y(0)=0,\quad \left.{\frac {dy}{dx}}\right|_{x=0}=2} dsolve( {diff(y(x),x,x) - 3*y(x) = x, y(0)=0, D(y)(0)=2}, y(x) ); 答案： y ( x ) = 7 18 3 e 3 x − 7 18 3 e − 3 x − 1 3 x {\displaystyle y(x)={\frac {7}{18}}{\sqrt {3}}e^{{\sqrt {3}}x}-{\frac {7}{18}}{\sqrt {3}}e^{-{\sqrt {3}}x}-{\frac {1}{3}}x} dsolve(diff(y(x), x, x) = x^2*y(x)) 解： y ( x ) = C 1 ( x ) {\displaystyle y(x)=C_{1}{\sqrt {(}}x)} BesselI( 1 4 {\displaystyle 1 \over 4} , 1 2 {\displaystyle 1 \over 2} x 2 {\displaystyle x^{2}} ) + C 2 ( x ) {\displaystyle C_{2}{\sqrt {(}}x)} BesselK( 1 4 {\displaystyle 1 \over 4} , 1 2 {\displaystyle 1 \over 2} x 2 {\displaystyle x^{2}} ) series(tanh(x),x=0,15) x − 1 3 x 3 + 2 15 x 5 − 17 315 x 7 {\displaystyle x-{\frac {1}{3}}\,x^{3}+{\frac {2}{15}}\,x^{5}-{\frac {17}{315}}\,x^{7}} + 62 2835 x 9 − 1382 155925 x 11 + 21844 6081075 x 13 + O ( x 15 ) {\displaystyle +{\frac {62}{2835}}\,x^{9}-{\frac {1382}{155925}}\,x^{11}+{\frac {21844}{6081075}}\,x^{13}+{\mathcal {O}}(x^{15})} f:=int(exp^cosh(x),x) series(f,x=0,15); e x + 1 6 e x 3 + 1 30 e x 5 + 31 5040 e x 7 + 379 362880 e x 9 {\displaystyle ex+{\frac {1}{6}}ex^{3}+{\frac {1}{30}}ex^{5}+{\frac {31}{5040}}ex^{7}+{\frac {379}{362880}}ex^{9}} + 149 907200 e x 11 + 150349 6227020800 e x 13 + 4373461 1307674368000 e x 15 + O ( x 17 ) {\displaystyle +{\frac {149}{907200}}ex^{11}+{\frac {150349}{6227020800}}ex^{13}+{\frac {4373461}{1307674368000}}ex^{15}+{\mathcal {O}}(x^{17})} with(inttrans); 拉普拉斯变换 > f := (1+A*t+B*t^2)*exp(c*t); ( 1 + A ∗ t + B ∗ t 2 ) ∗ e c ∗ t {\displaystyle (1+A*t+B*t^{2})*e^{c*t}} > laplace(f, t, s); 1 s − c + A ( s − c ) 2 + 2 B ( s − c ) 3 {\displaystyle {\frac {1}{s-c}}+{\frac {A}{(s-c)^{2}}}+{\frac {2B}{(s-c)^{3}}}} 反拉普拉斯变换 invlaplace(1/(s-a),s,x) e a x {\displaystyle e^{ax}} z := y(t); y(t) f := diff(z, t, t)+a*(diff(z, t)) = b*z; d 2 d t 2 y ( t ) + a d d t y ( t ) = b y ( t ) {\displaystyle {\frac {d^{2}}{dt^{2}}}y(t)+a{\frac {d}{dt}}y(t)=by(t)} with(inttrans); g := laplace(f, t, s); s^2*laplace(y(t), t, s) - D(y)(0) - s y(0) + a s^2 laplace(y(t), t, s) - a y(0) = b laplace(y(t), t, s) invlaplace(g, s, t); d 2 d t 2 y ( t ) + a d d t y ( t ) = b y ( t ) {\displaystyle {\frac {d^{2}}{dt^{2}}}y(t)+a{\frac {d}{dt}}y(t)=by(t)} with(inttrans); fourier(sin(x),x,w) Π {\displaystyle \Pi } *(Dirac(w-1)+Dirac(w+1)) 绘制函数 y = x ⋅ sin ⁡ x {\displaystyle y=x\cdot \sin x} ， x ∈ ( − 10 , 10 ) {\displaystyle x\in (-10,10)} plot(x*sin(x),x=-10..10); 绘制函数 x 2 + y 2 {\displaystyle x^{2}+y^{2}} ， x {\displaystyle x} 和 y {\displaystyle y} 的范围为 -1到1 plot3d(x^2+y^2,x=-1..1,y=-1..1); 維基教科書中的相關電子教程：绘制函数动画图 二维动画 f := 2 ∗ k 2 / c o s h ( k ∗ ( x − 4 ∗ k 2 ∗ t ) ) 2 {\displaystyle f:=2*k^{2}/cosh(k*(x-4*k^{2}*t))^{2}} with(plots); animate(subs(k = .5, f), x = -30 .. 30, t = -10 .. 10, numpoints = 200, frames = 50, color = red, thickness = 3); 三维动画 with(plots) animate3d(cos(t*x)*sin(3*t*y), x = -Pi .. Pi, y = -Pi .. Pi, t = 1 .. 2) 求解偏微分方程组 ∂ ∂ x v ( x , t ) = − u ( x , t ) v ( x , t ) {\displaystyle {\frac {\partial }{\partial x}}v\left(x,t\right)=-u\left(x,t\right)v\left(x,t\right)} ∂ ∂ t v ( x , t ) = − v ( x , t ) ∂ ∂ x u ( x , t ) + v ( x , t ) ( u ( x , t ) ) 2 {\displaystyle {\frac {\partial }{\partial t}}v\left(x,t\right)=-v\left(x,t\right){\frac {\partial }{\partial x}}u\left(x,t\right)+v\left(x,t\right)\left(u\left(x,t\right)\right)^{2}} ∂ ∂ t u ( x , t ) + 2 u ( x , t ) ∂ ∂ x u ( x , t ) − ∂ 2 ∂ x 2 u ( x , t ) = 0 {\displaystyle {\frac {\partial }{\partial t}}u\left(x,t\right)+2\,u\left(x,t\right){\frac {\partial }{\partial x}}u\left(x,t\right)-{\frac {\partial ^{2}}{\partial {x}^{2}}}u\left(x,t\right)=0} 条件为 v ( x , t ) ≠ 0 {\displaystyle v(x,t)\neq 0} . eqn1:= diff(v(x, t), x) = -u(x,t)*v(x,t): eqn2:= diff(v(x, t), t) = -v(x,t)*(diff(u(x,t), x))+v(x,t)*u(x,t)^2: eqn3:= diff(u(x,t), t)+2*u(x,t)*(diff(u(x,t), x))-(diff(diff(u(x,t), x), x)) = 0: pdsolve({eqn1,eqn2,eqn3,v(x,t)<>0},[u,v]): op(%); 答案：  v ( x , t ) = e _ c 1 x _ C 3 e _ c 1 t _ C 1 + _ C 3 e _ c 1 t _ C 2 e _ c 1 x ,     u ( x , t ) = − _ c 1 ( _ C 1 ( e _ c 1 x ) 2 − _ C 2 ) _ C 1 ( e _ c 1 x ) 2 + _ C 2 {\displaystyle v\left(x,t\right)={e^{{\sqrt {{\it {\_c}}_{1}}}x}}{\it {\_C3}}\,{e^{{\it {\_c}}_{1}t}}{\it {\_C1}}+{\frac {{\it {\_C3}}\,{e^{{\it {\_c}}_{1}t}}{\it {\_C2}}}{e^{{\sqrt {{\it {\_c}}_{1}}}x}}},\ \ u\left(x,t\right)=-{\frac {{\sqrt {{\it {\_c}}_{1}}}\left({\it {\_C1}}\,\left({e^{{\sqrt {{\it {\_c}}_{1}}}x}}\right)^{2}-{\it {\_C2}}\right)}{{\it {\_C1}}\,\left({e^{{\sqrt {{\it {\_c}}_{1}}}x}}\right)^{2}+{\it {\_C2}}}}} 寻找函数 f {\displaystyle f} 满足积分方程 f ( x ) − 3 ∫ − 1 1 ( x y + x 2 y 2 ) f ( y ) d y = h ( x ) {\displaystyle f(x)-3\int _{-1}^{1}(xy+x^{2}y^{2})f(y)dy=h(x)} . eqn:= f(x)-3*Integrate((x*y+x^2*y^2)*f(y), y=-1..1) = h(x): intsolve(eqn,f(x)); 答案： f ( x ) = ∫ − 1 1 ( − 15 x 2 y 2 − 3 x y ) h ( y ) d y + h ( x ) {\displaystyle f\left(x\right)=\int _{-1}^{1}\!\left(-15\,{x}^{2}{y}^{2}-3\,xy\right)h\left(y\right){dy}+h\left(x\right)} 现在，MATLAB已改用MuPAD替代了matlab的Maple符号计算内核。 何青 王丽芬编著《Maple教程》 科学出版社 2010 ISBN 9787030177445 David Betounes, Partial Differential Equations for Computational Science: With Maple and Vector Analysis Springer, 1998 ISBN 9780387983004 George Articolo Partial Differential Equations & Boundary Value Problems with Maple V Academic Press 1998 ISBN 9780120644759 維基教科書中的相關電子教程：Maple 维基共享资源上的相关多媒体资源：Maple Maple Product History. [2020-03-20].  Maple主页 （页面存档备份，存于互联网档案馆） Maxima MATLAB GNU Octave Scilab Mathematica Template:分形软件