Mathematica命令快速参考

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Factor[expr] (reduce to a product of factors) Cancel[expr] (cancel common factors) Simplify[expr] (find simplist form) Apart[expr] (write expr as a sum of terms) Exponent[expr,x] (max power of x in expr) DSolve[eqn,y [x],x] (solve differential equation) Eliminate[eqn, e] (eliminate variable e) n. m (matrix multiply) Det[m] (determinant) LinearSolve[m, b] (solve mx = b) Eigensystem[m] (value & vector)
Arbitrary-Precision Calculation expr//N or N[expr] (numerical value of expr) Rationalize[x] (rational number approximation) Defining Variables, Functions, and Rules x = value (assign a value to symbol x) x := expr (delayed assignment) x = . or Clear[x] (remove value assigned to x) (define a function f (x)) f [ x ] := expr Algebraic Calculations Expand[expr] Together[expr] Expand[expr,Trig->True] Factor[expr,Trig->True] Coefficient[expr,x] Solve[lhs==rhs, x] (solve Reduce[eqn, x] (multiply out products) (common denominator) (sin2 x → sin 2x, etc.) (sin 2x → sin2 x, etc.) (coefficient of x in expr) algebraic equation for x) (reduce equations)
Log[x] (ln x) Tan[x] (tan x) Sinh[x] (sinh x) n! (factorial) Min[x, y , . . .] (min) Conjugate[z ] (¯ z) LaguerreL[n,a,x] (La n (x)) Zeta[s] (Riemann ζ (s)) I (i = √ −1)
Mathematica Quick Reference
Run Mathematica mathematica (evoke Mathematica frontend) Quit[ ] or Exit[ ] (ax2 + 2x − 3/5) (exit Mathematica) n^^digits base n number
Programming Module[{a, b, . . . }, expr1 ; expr2 ; . . . ] (a procedure/w local variables a, b, . . ., return value of last expr) Table[expr,{i, max}] (make a list of values of expr with i from 1 to max) Do[expr,{i, min, max, di}] (evaluate expr with i run from min to max in steps of di) While[test, body ] (evaluate body repetitively, so long as test is True) For[start, test, inc, body ] (evaluate start, then repetitively evaluate body and inc, until test fails) If[test, then, else] (evaluate then if test is True, and else if it is False) Which[test1, value1 , test2 , . . . ] (give the value associated with the first test that is True) Switch[expr, f orm1 , value1 , f orm2 , . . . ] (give the value associated with first f orm matching expr) Function[x, body ] or body & (specify a pure function) Nest[f , x, n] (apply the function f nested n times to x) NestList[f , x, n] (generate list {x, f (x), f (f (x)), . . .} nested up to n deep) Fold[f , x, {a, b, c}] (produce f f (f (x, a), b), c ) FixedPoint[f , x] (apply the function f repeated until the result no longer changes) Apply[f , {a, b, c}] or f @@ expr (produce f (a, b, c)) Map[f , {a, b, c}] or f /@ expr (apply f to each elements, {f (a), f (b), f (c)} ) i++ (post-increment) i-(post-decrement) ++i (pre-increment) --i (pre-decrement) (* text *) (comment) f ::usage="text" (info) Iterators in Do, Table, Sum, etc. {max} (iterate max times) {i, min, max} (i from min to max in steps of 1) Logical Operators == (equal) < (less than) > (greater than) != <= >= (unequal) (less or equal) (greater or equal) i += di (add di to i) i -= di (subtract di) Timing[expr] (time) x *= c (multiply x by c) x /= c (divide x by c) MemoryInUse[] (space)
Log[b, x] (logb x) ArcSin[x] (sin−1 x) Cosh[x] (cosh x) Abs[x] (|x|) n Binomial[n, m] (Cm ) Arg[z ] (argument) BesselJ[n, z ] (Jn (z )) Random[] (number) Infinity (∞)
e.g. a*x^2 + 2 x - 3/5
Exp[x] or E^x (ex ) Cos[x] (cos x) ArcTan[x] (tan−1 x) ArcSinh[x] (sinh−1 x) Max[x, y , . . .] (max) Im[z ] (imaginery part) HermiteH[n,x] (Hn (x)) Gamma[z ] (Euler Γ(z )) E (e ≈ 2.71828)
Arithmetic +, -, * (or a space ), /, ^ (power), Mathematical Functions √ Sqrt[x] ( x) Sin[x] (sin x) ArcCos[x] (cos−1 x) Tanh[x] (tanh x) Mod[n, m] (n mod m) Re[z ] (real part) LegendreP[n,x] (Pn (x)) x −t2 2 e dt) Erf[x] (√ π 0 Mathematical Constants Pi (π ≈ 3.14159)
Data Objects 123 (integer) 3/7 (rational) 1.0 {a, b, . . . } (list with elements a, b, . . .) expr[[i]] (i-th element of the expression expr)
(real) 2 + 8I (complex) "text" (string) h[a, b, . . .] (expression/w head h, elements a, b, . . .) a[ i ] (indexed object) N[expr, n] (value of expr with n-digit precision) Precision[x] (significant decimal digits in x) expr /. x -> a expr //. x -> a lhs :> rhs /; test lhs := rhs /; test (replace x by a in expr) (replace repeatedly) (apply rule if test is True) (assign if test is True)
Fra Baidu bibliotek
Calculus D[f , x] (∂f /∂x) Integrate[f , x] ( f dx) Series[f ,{x,a,n}] (expand at a) b n n D[f , {x, n}] (∂ f /∂x ) Integrate[f , {x, a, b}] ( a f dx) Limit[f , x->a] (limx→a f ) n m Dt[f ] (df ) Sum[f , {i, m, n}] ( i=m f ) Product[f , {i, m, n}] ( i=n f ) NIntegrate, NSum, NProduct, NSolve, NDSolve, FindRoot (numerical integration, summation, etc.) Graphics Plot[f , {x, a, b}, option->value] (plot f as a function of x from a to b) Show[plot, plot , . . .] (redraw plots) Plot3D[f , {x, a, b}, {y , c, d}] (three-dimensional plot of f as a function of x and y ) ListPlot[{{x1 , y1 },{x2 , y2 }, . . . }] (plot points (x1 , y1 ) . . .) ParametricPlot[{x, y }, {t, a, b}] (plot curve x(t), y (t) ) Plot options: AspectRatio (height-to-width ratio) AxesLabel->{"x","y "} (add labels) Frame -> True (draw frame) 1
Linear Algebra {a, b, c } (vector) Inverse[m] (inverse of matrix) MatrixPower[m, n] (mn ) Eigenvalues[m] (eigenvalues)
{{a, b}, {c, d}} (2×2 matrix) Transpose[m] (transpose) MatrixExp[m] (em ) Eigenvectors[m] (eigenvectors)
相关文档
最新文档