搜档网
当前位置:搜档网 › Maple的函数.doc

Maple的函数.doc

Maple的函数_全文在线阅读分享到QQ空间新浪微博百度搜藏人人网腾讯微博开心网腾讯朋友百度空间豆瓣网搜狐微博百度新首页QQ收藏和讯微博我的淘宝百度贴吧更多...百度分享
返回主目录 请使用IE7或IE8预览本页,个别文件很大超过5M,请等几分钟后再下载!谢谢!

Maple的函数



-



-
Maple的内部常数
Pi 圆周率
exp(1)自然对数的底数e
I 虚数单位i
infinity无穷大
gamma 欧拉常数

 Maple的常用内部数学函数
指数函数exp(x)以e为底数
对数函数ln(x)或log(x)自然对数,即以e为底数的对数
log[10](x)
或log10(x)常用对数,即以10为底数的对数
log[a](x)以a为底数的x的对数
开方函数sqrt(x)表示x的算术平方根
绝对值函数abs(x)表示x的绝对值
三角函数
(自变量的单位为弧度)sin(x)正弦函数
cos(x)余弦函数
tan(x)正切函数
cot(x)余切函数
sec(x)正割函数
csc(x)余割函数
反三角函数
arcsin(x)反正弦函数
arccos(x)反余弦函数
arctan(x)反正切函数
arccot(x)反余切函数
arcsec(x)反正割函数
arccsc(x)反余割函数
双曲函数
sinh(x)双曲正弦函数
cosh(x)双曲余弦函数
tanh(x)双曲正切函数
coth(x)双曲余切函数
sech(x)双曲正割函数
csch(x)双曲余割函数
反双曲函数
arcsinh(x)反双曲正弦函数
arccosh(x)反双曲余弦函数
arctanh(x)反双曲正切函数
arccoth(x)反双曲余切函数
arcsech(x)反双曲正割函数
arccsch(x)反双曲余割函数
求角度函数arctan(y,x)以坐标原点为顶点,x轴正半轴为始边,从原点到点(x,y)的射线为终边的角,其单位为弧度,范围为( , ]
数论函数igcd(a,b,c,...)整数的最大公约数函数
ilcm(a,b,c,...)整数的最小公倍数函数
a mod b求a除以b的余数
modp(a,b)求a除以b的正余数
mods(a,b)以对称的方式求a除以b的余数
irem(a,b)求a除以b的余数
irem(a,b, 'q')求a除以b的余数,并将商存放在q中
iquo(a,b)求a除以b的商
iquo(a,b, 'r')求a除以b的商,并将余数存放在r中
ifactor(n)因数分解,即把整数n分解成质数的乘积
rand()产生12位的随机整数
rand(a..b) ()产生整数a到整数b之间的随机整数
ithprime(n)求第n个质数
nextprime(n)求比整数n大的最小质数
prevprime(n)求比整数n小的最大质数
isprime(n)判断整数n是否为质数,若是,则结果为true,否则结果为false
排列组合函数factorial(n)或n!阶乘函数,表示n的阶乘


复数函数
Re(z)实部函数
Im(z)虚部函数
abs(z)求复数z的模
argument(z)辐角函数,表示复数的z辐角, 其范围是( , ]
conjugate(z)求复数z的共轭复数
polar(z) 或
convert(z,polar)把复数z转换成极坐标的表示形式polar(r, ), 即三角形式
polar(r, )复数的极坐标表示法, 即三角形式表示法
exp(z)复数指数函数
csgn(z)
求整函数与截尾函数
ceil(x)表示大于或等于实数x的最小整数
floor(x)表示小于或等于实数x的最大整数
round(x)最接近x的整数
isqrt(x)最接近 的整数
iroot(x,n)最接近 的整数
trunc(x)表示实数x的整数部分
frac(x)表示实数x的小数部分
分数与浮点数运算函数evalf(num)把精确数num化成浮点数(默认10位有效数字)
evalf(num, n)把精确数num化成具有n个有效数字的浮点数
convert(a,rational)将浮点数a转换成近似分数,默认为10个位数的有效数字
convert(a,rational,n)将浮点数a转换成具有n个位数有效数字的近似分数
最大、最小函数max(a,b,c,...)求最大数
min(a,b,c,...)求最小数
符号函数
signum(x)

Maple中的数学运算符
a+b 加
a-b减
a*b乘
a/b 除
a^b 乘方
-a 负号

Maple的关系运算符
=等于
< 小于
> 大于
<=小于或等于
>=大于或等于
<> 不等于










函数的连续性
 
四大数学软件(mathcad,mathematica,maple,matlab)中,只有Maple才有判断函数连续性的命令,其命令如下:

先加载discont链接库:readlib(discont): (在maple7,maple8,maple9中不用加载)
discont(f(x),x); 找出函数f(x)在实轴上所有的不连续点


先加载iscont链接库:readlib(iscont): (在maple7,maple8,maple9中不用加载)
iscont(f(x),x=a .. b);
测试在开区间(a,b)上,函数f(x)是否连续,若连续,则返回true,若不连续,则返回false,若无法判断,则返回FAIL
iscont(f(x),x=a .. b,open);
测试在开区间(a,b)上,函数f(x)是否连续,若连续,则返回true,若不连续,则返回false,若无法判断,则返回FAIL
iscont(f(x),x=a .. b,closed);
测试在闭区间[a,b]上,函数f(x)是否连续,若连续,则返回true,若不连续,则返回false,若无法判断,则返回FAIL


如何用Maple求极限
(1) 极限:
limit(f(x),x=a)

(2) 单侧极限:
左极限:
limit(f(x),x=a,left)

右极限:
limit(f(x),x=a,right)

如何用Maple求导数
diff(f(x),x)

如何用Maple求高阶导数 
diff(f(x),x$n)

如何在Maple中求隐函数

的导数
implicitdiff(f(x,y)=0,y,x)

在Maple中,没有直接求参数方程确定的函数的导数的命令,只能根据参数方程确定的函数的求导公式


一步一步地进行推导;或者,干脆自己编一个小程序,应用起来会更加方便。
如何用Maple求不定积分 
int(f(x),x)

如何用Maple求定积分、广义积分
int(f(x),x=a..b)

如何用Maple进行换元积分的计算
先加载student函数库,加载方法为:with(student);
changevar( m(x)=p(u), Int(f(x),x) ) 把积分表达式中的m(x)代换成p(u)

如何用Maple进行分部积分的计算 
先加载student函数库,加载方法为:with(student);
intparts(Int(f(x),x),u) 指定u,用分部积分公式 进行计算

在Maple中,如何用矩形法、梯形法和辛普森法求近似积分 
在计算之前,首先要加载student函数库,加载方法为:with(student);
矩形法
leftbox(f(x),x=a..b,n,options) 绘出左接小矩形来逼近定积分
leftsum(f(x),x=a..b,n) 用左接小矩形的面积之和来近似表示定积分
rightbox(f(x),x=a..b,n,options) 绘出右接小矩形来逼近定积分
rightsum(f(x),x=a..b,n) 用右接小矩形的面积之和来近似表示定积分
middlebox(f(x),x=a..b,n,options) 绘出中点接合小矩形来逼近定积分
middlesum(f(x),x=a..b,n) 用中点接合小矩形的面积之和来近似表示定积分

梯形法
trapezoid(f(x),x=a..b,n) 用小梯形的面积之和来近似表示定积分

 

辛普森法
simpson(f(x),x=a..b,n) 用辛普森法求定积分的近似值

如何用Maple对数列和级数进行求和 
sum(f(n),n=a..b)

如何用Maple进行连乘
 product(f(n),n=a..b)

如何用Maple展开级数
 taylor(f(x),x,n)
taylor(f(x),x=a,n)
series(f(x),x,n)
series(f(x),x=a,n)

如何在Maple中进行积分变换
 在进行拉普拉斯变换及其逆变换、傅立叶变换及其逆变换、傅立叶正弦变换和傅立叶余弦变换时,必须要先加载积分变换函数库,加载方法为:with(inttrans),但在进行Z变换及其逆变换时,不用加载任何函数库。
laplace( f(t), t, s ) 拉普拉斯变换
invlaplace( F(s), s, t ) 拉普拉斯变换的逆变换

 
fourier( f(t), t, ω) 傅立叶变换
invfourier( F(ω), ω, t ) 傅立叶变换的逆变换

 
ztrans( f(n), n, z) Z变换
invztrans( F(z), z, n ) Z变换的逆变换

 
fouriersin( f(t), t, ω) 傅立叶正弦变换
fouriercos( f(

t), t, ω) 傅立叶余弦变换

如何用Maple解微分方程
dsolve(微分方程,y(x))
dsolve({微分方程,初始条件或边界条件},y(x))

如何用Maple解微分方程组
 dsolve({微分方程组},{y 1 (x), y 2 (x),…})
dsolve({微分方程组,初始条件或边界条件},{y 1 (x), y 2 (x),…})

如何用maple求多变量函数的极限
以两个变量为例说明,多于两个变量的函数极限可以依次类推。
limit(f(x,y),{x=a,y=b})计算极限


如何用maple求多元函数的偏导数
diff(f,x1,x2,…, xn)求偏导数

如何用maple求多变量函数的泰勒展开式
首先要加载mtaylor链接库,加载方法为:readlib(mtaylor)(在maple7、maple8、maple9中不用加载)
mtaylor(f,[x=x0,y=y0,...],n)在x=x0,y=y0 ,...处求函数f的泰勒展开式,其中n为展开的次数
mtaylor(f,[x,y,...],n)在x=0,y=0,...处求函数f的泰勒展开式,其中n为展开的次数

如何用maple求重积分

可以利用数个int()指令的组合来完成。对于二重积分和三重积分,也可利用student链接库里的Doubleint()和Tripleint()指令来完成。格式如下:
首先要加载student链接库,加载方法为:with(student)
Doubleint(f(x, y), x, y)
Doubleint(f(x, y), x=a . . b , y=c . . d)
Tripleint(f(x, y, z), x, y, z)
Tripleint(f(x, y, z), x=a . . b , y=c . . d, z=m . . n)

注意:Doubleint()和Tripleint()指令只保留原积分式,并没有求值,如果要求值,必须用value()指令来完成。
如何用maple求梯度、散度、旋度
 首先要加载软件包VectorCalculus,加载方法为:
with(VectorCalculus)
Gradient(f, [x,y,z] )在当前坐标系中求纯量函数f的梯度,其中x,y,z为坐标变量,
在使用前,可以先设定坐标系,设定方法为:
SetCoordinates(’cartesian’[x,y,z])(直角坐标系)
SetCoordinates(’cylindrical’[x,y,z])(圆柱坐标系)
SetCoordinates(’spherical’[x,y,z])(球面坐标系)
Gradient(f, ‘cartesian’[x,y,z] )在直角坐标系中求纯量函数f的梯度,其中x,y,z为坐标变量,
若把cartesian换为cylindrical或spherical,则表示在圆柱坐标系或球面坐标系中进行计算。
Divergence(f)在当前坐标系中求向量函数f的散度, f的格式为:
(x,y,z)->(u, v, w), 这里u、v、w是关于x、y、z的表达式。注意:在使用前,首先要设定坐标系,设定方法为:
SetCoordinates(’cartesian’[x,y,z])(直角坐标系)
SetCoordinates(’cylindrical’[x,y,z])(圆柱坐标系)
SetCoordinates(’spherical’[x,y,z])(球面坐标系)
Curl(f )在当前坐标

系中求向量函数f的旋度, f的格式为:
(x,y,z)->(u, v, w), 这里u、v、w是关于x、y、z的表达式。注意:在使用前,首先要设定坐标系,设定方法为:
SetCoordinates(’cartesian’[x,y,z])(直角坐标系)
SetCoordinates(’cylindrical’[x,y,z])(圆柱坐标系)
SetCoordinates(’spherical’[x,y,z])(球面坐标系)








Maple Examples
Below are some examples to help get you started using Maple. The best way to
learn is to try things out on your computer. Table of Contents
Graphs
Plotting a single function
Plotting two functions at once
Plotting a surface
Solving Equations
One unknown
Two unknowns
Computations
Arithmetic
Algebra
Trigonometry
Functions
Calculus
Matrices
Help
Back to Maple



Plotting a single function
To graph the function y = x^2 on the interval from -1 to 1, write this in Maple:

plot( x^2, x = -1..1 );
Table of contents



Plotting two functions at once
We can plot more than one function at a time:
plot( { sin(x), (1/3)*x }, x = -Pi..Pi );By looking at the graph we can solve the equation sin(x) = x/3. The roots are
determined by the places where the two curves cross.

Table of contents



Graphing surfaces
We can graph surfaces using the plot3d command. For example, to graph z = xy,
where x and y run from -1 to 1, we do this:
plot3d( x*y, x=-1..1, y=-1..1, axes = BOXED, style = PATCH);
For more information use the ?plot3d command. No semicolon needed for this one.
Table of contents



Equations in one unknown
To solve the equation x^3 + x = 27, do this:
solve(x^3 = 27); 1/2 1/2 3, - 3/2 + 3/2 I 3 , - 3/2 - 3/2 I 3Note that there are three solutions, two of which are complex. Now let's try
something more complicated:
solve(x^3 + 1.5*x = 27); 2.83, - 1.42 + 2.74 I, - 1.42 - 2.74 INote: There is a good reason why we wrote "1.5 " instead of "(3/2)" as the
coefficient of x in the last equation. If one of the numbers in the equation is
in decimal form, then Maple tries to find an approximate solution in decimal
form. If none of the numbers are in decimal form, as in the first example, then
Maple tries to find an exact solution. This may fail, since there is no
algebraic formula for the roots polynomial equations of degree five or more (
Galois ).
Table of contents



Equations in two unknowns
We can also solve systems of equations:
solve( { 2*x + 3*y = 1, 3*x + 5*y = 1} ); {y = -1, x = 2} These can contain literal as well as numerical coefficients:
solve( { a*x + 5*y = 1, 3*x + b*y = c}, { x, y } ); - 3 + a c - b + 5 c {y = ----------, x = - ----------}

- 15 + a b - 15 + a bIn the second example we have to tell Maple that x and y are the variables to be
solved for. Otherwise it wouldn't know.
You can solve systems of two equations in two unknowns of the form f(x) = 0,
g(x) = 0 by graphing the functions f(x) and g(x) and seeing where the curves
cross.
Table of contents



Arithmetic
Maple does arithmetic pretty much as you would expect it to:
3*(1.3 + 1.7)^2/2 - 0.1; 13.400000000 It has built-in commands which can do a lot of work quickly. For example, to add
up the numbers 1, 1/2, 1/3, ... 1/10, we do this:
> sum(1/n, n= 1..10); 7381 ---- 2520Note that Maple gave us the exact answer as a fraction in lowest terms. For an
approximate answer in decimal form, do this:
> sum(1.0/n, n= 1..10); 2.928968254The only difference was the 1.0 in place of 1 . Note the decimal point. We can
also things like factor numbers:
> ifactor(123456789); 2 (3) (3803) (3607)Table of contents



Algebra
Maple can do algebra:
> p := (a+b)^2; # define p to be the square of (a + b) 2 p := (a + b) > expand(p); # expand it 2 2 a + 2 a b + b > factor(a^2 + 2*a*b + b^2); 2 (a + b) > a := 1; # define a to be 1 a := 1 > p; # re-evaluate p 2 (1 + b) > a := 'a'; # define a to be a again a := a > p; # check it out 2 (a + b) Table of contents



Trigonometry
Maple does trigometry using radian measure:
> sin(Pi/2); 1 > arcsin(1); 1/2 PiWe can set things up for conversions like this:
> deg := evalf(Pi/180); # use evalf to convert to decimal form deg := .01745329252 > rad := 1/deg; rad := 57.29577951 > sin(90*deg); 1. > arcsin(1)*rad; 28.64788976 Pi > evalf("); # " stands for the result of the preceding computation 90.00000002 Note two things. Sometimes we need to use the evalf function to convert results
from exact to floating point (decimal) form. Sometimes it is convenient to use
the quote(") sign: it stands for the result of the preceding computation.
Table of contents



Func

tions
You can define your own functions in Maple:
> f := x -> sqrt( 1 + x^2 ); 2 f := x -> sqrt(1 + x ) > f(1); 1/2 2 > f(a+3); 2 1/2 (10 + a + 6 a) These can have more than one variable:
> g := (x,y) -> sqrt(x^2 + y^2); 2 2 g := (x,y) -> sqrt(x + y ) > g(3,4); 5Table of contents



Calculus
Maple can differentiate an expression:
> diff( sin(cos(x)) + x^3 + 1, x ); 2 - cos(cos(x)) sin(x) + 3 xIt can do both definite and indefinite integrals:
> int( x^2, x ); 3 1/3 x > int( x^2, x = 0..1); 1/3 > evalf( int( sqrt( 1 + x^3 ), x = 0..1 ) ); 1.111447971The last computation deserves comment. Suppose we just do the obvious thing (try
it!).
> int( sqrt( 1 + x^3 ), x = 0..1 ):Maple does not give us a numerical answer because the integral of this function
cannot be expressed in terms of elementary functions. In particular it cannot be
integrated by the usual techniques. However, note that we have surrounded our
computation with evalf( ... ). This forces Maple to evaluate the integral
numerically: evalf stands for evaluate in floating point form
Table of contents



Matrices
Here are some examples of matrix calculations. Be sure to use with(linalg)
before doing them. Also be sure to try these out to see how they work!
> with(linalg): > a := matrix([ [1, 2], [3, 4] ]); matrix is displayed ........ > b := matrix([ [0, 1], [1, 0] ]); ........ > multiply( a, b ); ........ > multiply( b, a ); ........ > evalm( b &* a ); # another way of computing ba .......... > ?evalm # consult help on evalm > aa := inverse( a ); ........ > c := randmatrix(2,2); # 2x2 random matrix > evalm( 1/c ); # invert it > print( aa ); # redisplay aa ........Did you notice the difference between the product ab and the product ba?
Table of contents



Help
For information and examples on a particular Maple " function", use the "?"
command. For example,
> ?solvegives information on the solve command. Often it is helpful to scroll to the end
of the help window and look at the examples, bypassing the technical discussion
that precedes it. You can also try the command with no keyword:
> ?This gives additonal information on how to use the help system.
Maple Help
Try also Maple's help command, which is gotten by typing ? followed by what

you
want help on. Example:
> ?fsolve > ?plot > ?


返回主目录
-
-

相关主题