Mathematica

Note: Here every line in the Mathematica is shown with a $ in the beginning of the line.


Capitalize functions and keywords

When given exact input the system doesn't make any approximations.  Sqrt[2]  Sqrt[2.]


 

$ ? Integrate     --> to get help on the keyword


Manipulate

Manipulate[ Expand[(1+x)^n],{n,0,100}]

Manipulate[ Expand[(1+x)^n],{n,0,100,1}]  //1 is the step

Manipulate[ Plot3D[ Sin[nxy],{x,0,3},{y,0,3}],{n,1,4}]


N

Numerical precision

N[Sqrt[2]]

N[Sqrt[2], 100]   //100 precision


==

1==2  --> False

Solve[x^2==9,x]

used for a set of equations


===

X === y  False, identity rather than mathematical equality


:=

Funtions are defined using this

F[x_] := x   //_ is required

x=.   or  Clear[w]

Clear the value assigned to x

/.

Transform a variable (temporary value assignment(not permanent))

(1 + x)^6    /.   x -> 3 - a

(4 - a)^6

s[t]  /.  {v -> 0, a -> g}  //temporarily assign parameters


%, %n or Out[n]

is a global object that is assigned to be the value produced on the n^(th) output line.% is the last output. %%%% is the fourth output before this line


Expand

Expands and expression.


NestList

Recursive call to a funtion for 0 to n times

NestList[Cos, Pi, 4]

Pi, Cos[Pi], Cos[Cos[Pi]], Cos[Cos[Cos[Pi]]], Cos[Cos[Cos[Cos[Pi]]]]

Last

The last element in a list or expr.

Last[{a,b,c}]  --> c

Last[{a,b},{c,d}, {e,f}]  --> {e,f}


Integrate

Integrate[f, x]

Integrate[f, {x, xmin, xmax}]

Integrate[Sin[xy], {x, 0, 1}, {y, 0, x}]    //Multiple integral with x integration outermost


D () (Partial Differential)

D[f, x] gives the partial derivative partialf/partialx.
D[f, {x, n}] gives the multiple derivative partial^nf/partialx^n.
D[f, x, y, ...] differentiates f successively with respect to x,y,....
D[f, {{x1, x2, ...}}] for a scalar f gives the vector derivative (partialf/partialx_1,partialf/partialx_2,...)

DSolve

DSolve[eqn, y, x] solves a differential equation for the function y, with independent variable x.

DSolve[{eqn1, eqn2, ...}, {y1, y2, ...}, x] solves a list of differential equations.

DSolve[eqn, y, {x1, x2, ...}] solves a partial differential equation.

















Subpages (1): Example1
Comments