找回密码
 注册
Simdroid-非首页
查看: 205|回复: 2

[基础概念] 坐标转换方程

[复制链接]
发表于 2008-7-5 01:41:49 | 显示全部楼层 |阅读模式 来自 美国
常常我们要进行一些坐标转换,有时比较复杂,这里用Mathematica简化这个过程。
基本的关系(见图):
Mathematica实现:
  1. cotransform[u_Symbol, var_List, relation_List] :=
  2.   Module[{h, hi, delu}, h = D[relation, {var}];
  3.    hi = Simplify[
  4.      Sqrt[h[[All, #]].h[[All, #]]] & /@ Range[Length[var]],
  5.      Assumptions -> {0 < var[[#]] < \[Pi] & /@ Range[Length[var]]}];
  6.    delu = 1/hi[[#]] D[u @@ var, var[[#]]] & /@ Range[Length[var]] //
  7.      Simplify;
  8.    Print["Gradient is ", delu // Total];
  9.    lapu = 1/Times @@ hi D[Times @@ hi/hi[[#]] delu[[#]], var[[#]]] & /@
  10.         Range[Length[var]] // Total // Simplify;
  11.    Print["Laplacian is ", lapu]; Return[{delu, lapu}];];
复制代码
例子:
  1. cotransform[f, {x, y, z}, {x, y, z}]
复制代码
结果:
  1. Gradient is f^(0,0,1)[x,y,z]+f^(0,1,0)[x,y,z]+f^(1,0,0)[x,y,z]
  2. Laplacian is f^(0,0,2)[x,y,z]+f^(0,2,0)[x,y,z]+f^(2,0,0)[x,y,z]
复制代码
柱坐标例子:
  1. cotransform[f, {r, \[Theta], z}, {r Cos[\[Theta]], r Sin[\[Theta]],
  2.   z}]
复制代码
结果:
  1. Gradient is \
  2. f^(0,0,1)[r,\[Theta],z]+f^(0,1,0)[r,\[Theta],z]/r+f^(1,0,0)[r,\[Theta]\
  3. ,z]
  4. Laplacian is \
  5. f^(0,0,2)[r,\[Theta],z]+f^(0,2,0)[r,\[Theta],z]/r^2+f^(1,0,0)[r,\
  6. \[Theta],z]/r+f^(2,0,0)[r,\[Theta],z]
复制代码

球坐标例子:
  1. cotransform[f, {r, \[Theta], \[Phi]}, {r Sin[\[Theta]] Cos[\[Phi]],
  2.   r Sin[\[Phi]] Sin[\[Theta]], r Cos[\[Theta]]}]
复制代码
结果:
  1. Gradient is (Csc[\[Theta]] \
  2. f^(0,0,1)[r,\[Theta],\[Phi]])/r+f^(0,1,0)[r,\[Theta],\[Phi]]/r+f^(1,0,\
  3. 0)[r,\[Theta],\[Phi]]
  4. Laplacian is 1/r^2(Csc[\[Theta]]^2 f^(0,0,2)[r,\[Theta],\[Phi]]+Cot[\
  5. \[Theta]] f^(0,1,0)[r,\[Theta],\[Phi]]+f^(0,2,0)[r,\[Theta],\[Phi]]+2 \
  6. r f^(1,0,0)[r,\[Theta],\[Phi]]+r^2 f^(2,0,0)[r,\[Theta],\[Phi]])
复制代码


验证和推导的网页:
http://mathworld.wolfram.com/Laplacian.html
http://en.wikipedia.org/wiki/Laplacian
以及:
http://planetmath.org/encyclopedia/%3Chttp://planetmath.org/?method=l2h&;from=collab&id=76&op=getobj

自己代换,自己玩玩。

[ 本帖最后由 smarten 于 2008-7-4 12:13 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
发表于 2008-7-5 18:05:14 | 显示全部楼层 来自 江苏无锡
Simdroid开发平台
Not bad, Make a dynamic demo.

Maybe add three axis and a random point coodinate ?
回复 不支持

使用道具 举报

发表于 2008-7-14 15:03:42 | 显示全部楼层 来自 山东东营
在mathematica6中有相关的命令啊,可以调用数据包vectoranalysis。
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2026-1-7 04:06 , Processed in 0.027159 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表