Mathematica教程

210 阅读1分钟

参考:www.bilibili.com/video/BV1Es…

四条基本规则:
1.函数名首字母大写
2.[]----所要计算的内容
3.{}----列表或者范围
4.按下Shift+Enter;	单单按下Enter键就是换行

Integrate	:指的是积分
Plot:	画图	Plot[1/(1 - x^3), {x, -5, 5}]
Inverse[%]	//矩阵	%指上一个输出

创建函数

f[x_]:=x^2+x+1	//x_代表的是任意模式下,:=代表创建函数
Expand[%]	//Expand就是代表展开的意思	%代表上一次输出结果
Sove[f[b]-2 == 0,b]	//求解方程

N代表数字近似计算	NSolve	代表数字近似解


基本图形

=用的是链接服务器翻译成标准的语言,自由格式

ctrl 放大 缩小
shift

Plot[Tooltip[{Sin[x], Sin[x]/x}], {x, -10, 10}]	//Tooltip 可以是函数提示条

plot1 = Plot[x^2 + 3, {x, -5, 5}];
plot2 = Plot[x + 5, {x, -5, 5}];
Show[plot1, plot2]
Options[]	//可以查看任何函数的图形
比如:Options[Plot]

Plot[Sin[x]/x, {x, -5, 5}, Filling -> Axis]	//计算和填充
[]:计算内容	sin(x) sinx是需要计算sin	->x的
%数字	输出对应的内容

静态图形改成动态模型

Manipulate[]	
//Manipulate 里面空格代表* 	乘法运算

Manipulate[
 Plot[amp*fun[freq*x], {x, -10, 10}], {freq, 1, 5}, {amp, 1, 
  5}, {fun, {Sin, Cos, Tan}}]
  
  fun是可以选择函数

导入自己的数据

Import[]	//插入路径
ListPlot[%]	//列表图

变量都用小写字母表示

fitdatal = Fit[data1, {x, x}, x]	//数据拟合