收藏本站 
网站首页 
网站地图 
>> 我们从网络和杂志上收集了近100000余篇各类电脑技术、网络技术、软件技术等方面的文章教程,我们的收录原则:不是精华拒不收录!
先飞电脑技术网技术文章
Matlab 利用MAPLE的深层符号计算资源
[ 作者:佚名    转贴自:网络转载    阅读次数:94    更新时间:2006-4-3 9:29:00   录入:刘光勇 ]         

 6.7 利用MAPLE的深层符号计算资源
6.7.2 MAPLE库函数在线帮助的检索树

(1)翻阅Maple在线帮助的索引类目的指令是mhelp index
mhelp index % 查看 Maple 在线帮助的索引类目
Index of help descriptions
Calling Sequence:
?index[category] or help(index, category);
Description:
- The following categories of topics are available in the help subsystem:
index[expression]##expression operators for forming expressions
index[function]##function list of Maple functions
index[misc]##misc miscellaneous facilities
index[package]##packages descriptions of library packages
index[procedure]##procedure topics related to procedures and programming
index[statement]##statement list of Maple statements
To access these help pages, you must prefix the category with index, thus ?
index[category].

(2) 深入Maple的具体分类目录的指令格式是mhelp index[category]
mhelp index[function]
Index of descriptions for standard library functions
Description:
- The following are the names of Maple's standard library functions. For more information, see ?f where f is any of
these functions.
AFactor##AFactor AFactors##Afactors
AiryZeros##AiriAiZeros AiryZeros##AiriBiYZeros
Airy##AiryAi Airy##AiryBi
AngerJ##AngerJ Berlekamp##Berlekamp
Bessel##BesselI Bessel##BesselJ
...... ......
...... ......
hattype##whattype with##with
worksheet##worksheet writebytes##writebytes
writedata##writedata writeline##writeline
writestat##writestat writeto##writeto
zip##zip ztrans##ztrans

See Also:
readlib##readlib, libname##libname, index[package]##index[package]

(3)获取具体函数使用方法说明的指令格式是mhelp fun_name


6.7.3 发挥MAPLE的计算潜力
6.7.3.1 调用MAPLE函数

【 * 例 6.7.3 .1-1 】求递推方程 的通解。
(1)调用格式一
gs1=maple('rsolve(f(n)=-3*f(n-1)-2*f(n-2),f(k));')
gs1 =
(2*f(0)+f(1))*(-1)^k+(-f(0)-f(1))*(-2)^k

(2)调用格式二
gs2=maple('rsolve','f(n)=-3*f(n-1)-2*f(n-2)','f(k)')
gs2 =
(2*f(0)+f(1))*(-1)^k+(-f(0)-f(1))*(-2)^k

【 * 例 6.7.3 .1-2 】求 的 Hessian 矩阵。
(1)调用格式一
FH1=maple('hessian(x*y*z,[x,y,z]);')
FH1 =
matrix([[0, z, y], [z, 0, x], [y, x, 0]])

(2)调用格式二
FH2=maple('hessian','x*y*z','[x,y,z]')
FH2 =
matrix([[0, z, y], [z, 0, x], [y, x, 0]])

(3)把以上输出变成“符号”类
FH=sym(FH2)
FH =
[ 0, z, y]
[ z, 0, x]
[ y, x, 0]

【 * 例 6.7.3 .1-3 】求 处展开的截断 8 阶小量的台劳近似式。
(1)直接运行 mtaylor , 展开失败。
TL1=maple('mtaylor(sin(x^2+y^2),[x=0,y=0],8)')
TL1 =
mtaylor(sin(x^2+y^2),[x = 0, y = 0],8)

(2)必须先“读库”,才能得到正确展开结果。
maple('readlib(mtaylor);');
TL2=maple('mtaylor(sin(x^2+y^2),[x=0,y=0],8)');
pretty(sym(TL2))
2 2 6 2 4 4 2 6
x~ + y - 1/6 x~ - 1/2 y x~ - 1/2 y x~ - 1/6 y


6.7.3.2 运行MAPLE程序

【 * 例 6.7.3 .2-1 】目标:设计求取一般隐函数

的导数 解析解的程序,并要求:该程序能象 MAPLE 原有函数一样可被永久调用。
(1)编写求一般隐函数导数的文件 DYDZZY.src ,把它存放在 MATLAB 的搜索路径上。
[DYDZZY.src]
DYDZZY:=proc(f)
# DYDZZY(f) is used to get the derivate of
# an implicit function
local Eq,deq,imderiv;
Eq:='Eq';
Eq:=f;
deq:=diff(Eq,x);
readlib(isolate);
imderiv:=isolate(deq,diff(y(x),x));
end;

(2)运行以下指令把 DYDZZY.src 安装进 MAPLE 工作空间
procread('DYDZZY.src') % 转换 SRC 文件为内码,并送入 MAPLE 空间
ans =
DYDZZY := proc (f) local Eq, deq, imderiv; Eq := 'Eq'; Eq := f; deq := diff(Eq,x); readlib(isolate); imderiv := isolate(deq,diff(y(x),x)) end

(3)按 maple 指令调用该新建 MAPLE 函数去计算 3 个隐函数的导函数
s1=maple('DYDZZY(x=log(x+y(x)));')
s2=maple('DYDZZY(x^2*y(x)-exp(2*x)=sin(y(x)))')
s3=maple('DYDZZY','cos(x+sin(y(x)))=sin(y(x))')

s1 =
diff(y(x),x)=x+y(x)-1
s2 =
diff(y(x),x)=(-2*x*y(x)+2*exp(2*x))/(x^2-cos(y(x)))
s3 =
diff(y(x),x)=sin(x+sin(y(x)))/(-sin(x+sin(y(x)))*cos(y(x))-cos(y(x)))

(4)把 DYDZZY.src 进行预编辑,使之成为 MAPLE 内码文件登录在 bin 目录上。
clear maplemex
procread('DYDZZY.src');
maple('save(`DYDZZY.m`)');

(5)调用自建的 MAPLE 内码文件 DYDZZY.m
maple('read','`DYDZZY.m`'); % 把内码文件送入 MAPLE 空间
ss2=maple('DYDZZY(x^2*y(x)-exp(2*x)=sin(y(x)))')
ss2 =
diff(y(x),x) = (-2*x*y(x)+2*exp(2*x))/(x^2-cos(y(x)))

上一篇:MATLAB 数组运算和矩阵运算  下一篇: MATLAB 高维数组