目录
1. 下载Mathematica软件
下载教程:https://mp.weixin.qq.com/s/qyFb4Lm0TeEJ8zZuQRR1_g
2. Mathematica教程
Mathematica教程:https://zhuanlan.zhihu.com/p/78292797
Mathematica基础教程:https://blog.csdn.net/limiyudianzi/article/details/88061833
初步了解Mathematica:https://zhuanlan.zhihu.com/p/396265688
Wolfram Mathematica Tutorial Collection: Advanced Numerical Integration in Mathematica:https://library.wolfram.com/infocenter/Books/8504/#:~:text=The%20Mathematica%20function%20NIntegrate%20is%20a%20general%20numerical,estimates%20that%20satisfy%20user-specified%20precision%20or%20accuracy%20goals.
网站有很多学习资料。
学习笔记:
(1)定义函数
在 Wolfram 语言中,申明函数时参数名称后紧随下划线。
官网参考资料:https://www.wolfram.com/language/fast-introduction-for-programmers/zh/function-definitions/?compare=python
(2)if判断语句
语法1:If[ condition , t , f ]
如果 condition 计算为 True 给出 t,如果它计算为 False 给出 f。
语法2:If [ condition , t , f , u ]
如果 condition 计算既不为 True 也不为 False 给出 u。
(3)Monitor
Monitor[expr,mon]:将产生一个临时监控单元,在计算 expr 的过程中,此监控单元将显示 mon 的连续更新值。
图片来源:https://reference.wolfram.com/language/ref/Monitor.html
(4)Table
图片来源:https://reference.wolfram.com/language/ref/Table.html
(5)表达式的运算
https://reference.wolfram.com/language/tutorial/EvaluationOfExpressions.html#16334
(6)Heaviside Step Function
https://mathworld.wolfram.com/HeavisideStepFunction.html
海维赛德阶跃函数又称单位阶跃函数,是一个不连续函数。
定义:
3. 将Mathematica中的nb文件转换成matlab文件
把Mathematica推导出的公式转成matlab表达式的方法:https://www.douban.com/group/topic/77254450/?type=like&_i=2906475Y0wZziW
(1)先下载两个文件:
https://library.wolfram.com/infocenter/MathSource/577/
下载文件至安装软件目录下,比如:D:\Program Files\Wolfram Research\Mathematica\8.0\AddOns\Packages
(2)测试1:
输入:
Import["ToMatlab.m", "Package"]
ToMatlab[-B + Sin[x]]
toMATLAB语法:
测试2:
转换过程:
4. Mathematica导入matlab文件
https://reference.wolfram.com/language/ref/format/MAT.html
图片来源:http://matlink.org/#scripts-functions
5.利用 MATLink 实现两者的互通
参考:https://blog.sciencenet.cn/home.php?mod=space&uid=241374&do=blog&id=1047417
MATLink :http://matlink.org/
MATLink实例:http://matlink.org/examples/
MATLink官网文档:http://matlink.org/documentation/
Mathematica转matlab:
图片来源:http://matlink.org/documentation/