Tutorial file 1. MA530

Arithmetic

12 + 30 - 55 + 13

25/2 - 3^3 + 10*2

N[25/2 - 3^3 + 10*2]

1/5 + 3/7

1/5 + 3/7 // N

4.1 10^35

Mathematical Functions

Sqrt[25]

Sqrt[-25]

Sin[Pi/4]

Cos[Pi/2]

Tan[Pi/4]

ArcTan[1]

ArcSin[1]

ArcCos[1]

10!

Abs[-2]

Exp[3]

N[Exp[3]]

Log[E^14*E^10]

Equations, Tests and Simplification

Sqrt[124] == 12

Sqrt[144] == 12

Solve[Sqrt[x] == 12, x]

x /. %

Solve[Exp[x] == x^2 + 3, x]

FindRoot[Exp[x] == x^2 + 3, {x, 2}]

x /. %

Simplify[(x^3 - y^3)^2/(x^2 - y^2)^2]

Limits, Derivatives, Integrals

Limit[x^2/Sin[x]^2, x -> 0]

Dt[Sin[x]^2 - 3  x^6 + 6  x^2 + 120, x]

D[Sin[x] Cos[y] + Exp[x*y], {x, 2}, {y, 3}]

Dt[Cos[x y]*Sin[x], x]

Integrate[Exp[x]*Cos[x]^2, x]

Integrate[x*Exp[-x^2], {x, 0, Infinity}]

Differential equations: DSolve and Simplest Plots

DSolve[y'[x] + x*y[x] == x (y[x])^2, y[x], x]

DSolve[(3  x - y[x] - 9)/(x + y[x] + 1) == y'[x], y[x], 
      x]

DSolve[{(3  x - y[x] - 9)/(x + y[x] + 1) == y'[x], 
        y[2] == 2}, y[x], x]

Plot[Evaluate[ y[x] /. % ], {x, -10, 40}];

An example where DSolve fails but equation can be integrated

DSolve[{(1 + E^y[x]) - 
            E^(2*y[x]) (Sin[x]^3) y'[x] == 0, 
        y[π/2] == 0}, y[x], x]

\(\(\(\(\(\(\(DSolve\ applied\ above\ does\ not\ work\ \((probably\ because\ this\ equation\ is\ "too non-linear")\), \ 
                so\ let\ us\ help\ to\ our\ computer, \ 
                let\ us\ 1\)\()\)\)\ separate\ variables, \ 
            2\)\()\)\)\ integrate, \ 
        and\ 3\)\()\)\)\ determine\ the\ constant\ C\ from\ the\ initial\ \(\(condition\)\(:\)\)\)

LeftHandSide[
        y_] = ∫((E^(2*y))/(1 + 
                  E^y)) \[DifferentialD]y

RightHandSide[
        x_] = ∫(1/((Sin[
                      x])^3)) \[DifferentialD]x

Const = 
      Replace[C, 
        Solve[LeftHandSide[0] == RightHandSide[π/2] + C, 
          C]]

Answer,  
    exactly as we have got analytically in the Homework1:

LeftHandSide[y] == RightHandSide[x] + Const[[1]]