← ppnm

Exercise "complex"

Introduction

Tasks

  1. Calculate -1, i, ei, e, ii, ln(i), sin() and compare (using our "approx" function) with manually calculated results (check them please before using):

    -1 = ±i,
    ln(i) = ln(eiπ/2) = iπ/2,
    i = e½ln(i) = eiπ/4 = cos(π/4)+i sin(π/4) = 1/√2+i/√2 (and where is the second branch you think?)
    ii = ei ln(i) = e-π/2 ≈ 0.208, (ii is actually real – magic, isn't it?)
    
  2. Extra: add to our cmath-class the hyperbolic functions sinh, cosh of complex argument—and calculate sinh(i), cosh(i). Check that the results are correct.