[Edu-sig] random appreciation
arthur.siegel@rsmi.com
arthur.siegel@rsmi.com
Thu, 14 Mar 2002 09:27:24 -0500
So the next phase of my Python powered efforts at
personal math re-education is to get some decent
handle on complex math - with, as usual,
a prejudice toward a visual approach.
The perfect book to get me there being Visual
Complex Analysis by Tristan Needham.
So I am in the introduction and realize I have my
hands full in trying to follow along.
Want to create a Python class to help. Struggling
until I remember the new ability to sub-class
builtins.
from cmath import *
from __future__ import division
class Complex(complex):
def __init__(self,real,imag):
complex.__init__(real,imag)
def arg(self):
return asin(self.imag/self.real)
def polar(self):
return e**complex(0,self.arg())
def mod(self):
return sqrt(self.real**2+self.imag**2)
Have no confidence yet that even that little ditty is
constructed and returning correctly.
Have great confidence that I am privileged to have
access to tools that will make this kind of effort realistic
for myself.
And yes, it *is* nice not to have to worry about where
self.imag/self.real might leave me.
Art