Quick guide to Mathematica

To get help, place the cursor on the function and press F1
To run all commands in one cell, place the cursor there and press Shift + Enter or Enter on the numerical keyboard.
Output of many commands is suppressed by ; at the end of the command. If you want to see the output, delete ;
Argument of functions must be in square brackets [...], braces {...} are for arrays, ranges etc., use double brackets [[...]] to access elements of arrays
expr /. {x -> a} means substitute a for x in expr, expr // function means apply function to expr, i.e. it is equivalent to function[expr].
D[f[x],x] = derivative of f[x] with respect to x.
To define a function of x one can use f[x_] := 1+(x^2), notice the underscore and the colon, or # nad & like in f := 1+((#)^2) &
N[expr] evaluates expr with machine precision, if you use the decimal point in the expression it will be also evaluated with machine precision
Special characters can be inserted by pressing Esc ... Esc, e.g. Esc p Esc gives π
Clear[...] is used to unset any variables which could have been assigned previously.
Some other useful commands: Simplify, Expand, Factor; Integrate, Series, Sum

Clear["Global`*"] (* unsets all used variables so far *)

Numerical solution of the stiff system of ordinary differential equations

Chemical kinetics - explicit linear multistep methods

sol1=DSolve[{D[u1[t],t]==-β1 u1[t],D[u2[t],t]==β1 u1[t]-β2 u2[t],D[u3[t],t]==β2 u2[t],u1[0]==c1,u2[0]==c2,u3[0]==c3},{u1[t],u2[t],u3[t]},t]//Simplify
sol2=DSolve[{D[u1[t],t]==-β1 u1[t],D[u2[t],t]==β1 u1[t]-β1 u2[t],D[u3[t],t]==β1 u2[t],u1[0]==c1,u2[0]==c2,u3[0]==c3},{u1[t],u2[t],u3[t]},t]//Simplify

Explicit linear multistep methods

b1=1.0; b2=10.0;
t0=0.0;
u0={1.0,0.0,0.0};
T=4.0;
f[u_,t_]:={-b1 u[[1]],b1 u[[1]]-b2 u[[2]],b2 u[[2]]};
k=0.01;
n=IntegerPart[T/k];
subs={β1->b1,β2->b2,c1->u0[[1]],c2->u0[[2]],c3->u0[[3]]};
order=4;
If[b1==b2,
inivals=Table[{u1[t],u2[t],u3[t]}/.Flatten[sol2]/.subs/.{t->t0+i k},{i,0,order-1}];
solution={u1[t],u2[t],u3[t]}/.Flatten[sol2]/.subs,
inivals=Table[{u1[t],u2[t],u3[t]}/.Flatten[sol1]/.subs/.{t->t0+i k},{i,0,order-1}];
solution={u1[t],u2[t],u3[t]}/.Flatten[sol1]/.subs
];
Print["Order ",order,", step ", k,", z = ",-N[Max[b1,b2] k]];
nsol[lmm_,ini_]:=MyODESolveUsingLMM[lmm,f,t0,ini,k,n];
{α,β}=MyGetLMMCoefficients["Adams-Bashforth",order];
data1=nsol[{α,β},inivals[[1;;order]]];
Print["Maximal absolute error = ",Max[Flatten[Table[Map[Abs,Part[Map[Flatten,data1],i+1,{2,3,4}]-solution/.{t->t0+i k}],{i,0,n}]]]
];
p1=ListPlot[Table[Part[Map[Flatten,data1],All,{1,i}],{i,2,4}],Joined->False,PlotStyle->{Blue,Red,Green}];
p2=Plot[solution,{t,t0,T},PlotStyle->{Blue,Red,Green},PlotRange->All];
GraphicsRow[{p1,p2},ImageSize->Full]

Implicit backward differentiation

b1=1.0; b2=10.0;
t0=0.0;
u0={1.0,0.0,0.0};
T=4.0;
subs={β1->b1,β2->b2,c1->u0[[1]],c2->u0[[2]],c3->u0[[3]]};
A={{-b1,0.0,0.0},{b1,-b2,0.0},{0.0,b2,0.0}}
k=0.1;
n=IntegerPart[T/k];
order=4;
If[b1==b2,
inivals=Table[{u1[t],u2[t],u3[t]}/.Flatten[sol2]/.subs/.{t->t0+i k},{i,0,order-1}];
solution={u1[t],u2[t],u3[t]}/.Flatten[sol2]/.subs,
inivals=Table[{u1[t],u2[t],u3[t]}/.Flatten[sol1]/.subs/.{t->t0+i k},{i,0,order-1}];
solution={u1[t],u2[t],u3[t]}/.Flatten[sol1]/.subs
];
Print["Order ",order,", step ", k,", z = ",-N[Max[b1,b2] k]];
nsol[lmm_,ini_]:=MyODESolveUsingBD[lmm,A,t0,ini,k,n];
{α,β}=MyGetLMMCoefficients["BD",order];
data1=nsol[{α,β},inivals[[1;;order]]];
Print["Maximal absolute error = ",Max[Flatten[Table[Map[Abs,Part[Map[Flatten,data1],i+1,{2,3,4}]-solution/.{t->t0+i k}],{i,0,n}]]]
];
p1=ListPlot[Table[Part[Map[Flatten,data1],All,{1,i}],{i,2,4}],Joined->False,PlotStyle->{Blue,Red,Green}];
p2=Plot[solution,{t,t0,T},PlotStyle->{Blue,Red,Green},PlotRange->All];
GraphicsRow[{p1,p2},ImageSize->Full]