Josherich's Blog

HOME PROJECTS DRAWING ABOUT RSS

Euler's formula as power series

21 Mar 2019

is the points on unit circle, at angle , here is a visualization of how such circle is derived from the sum of power series:

Assume we have a function with the property of its derivative is equal to itself, just as , such function should have the form:

Expand to complex number :

Draw these complex numbers as vectors on complex plane, we have a end point for each , and a unit circle with all s

move mouse horizontally to draw the circle
function drawETheta(theta, iter, scale) {
  var itheta = new Complex(0, theta);
  var res = new Complex(1, 0).add(itheta);

  var path = new Path();
  path.strokeColor = 'black';

  path.add(origin);
  path.add(cord(new Complex(1, 0) * scale));

  var itheta_pow = new Complex(itheta);

  for (var i = 2; i < iter; i++) {
    path.add(cord(res * scale));
    itheta_pow = itheta_pow.multiply(itheta);
    res = res.add(itheta_pow.divide(factorial(i)));
    path.add(cord(res * scale));
  }
  return path;
}