Hypercomplex Math in Fractal Programming |
Like quaternion numbers, mathematicians have been aware of hypercomplex numbers since the early 19th century. It's only lately that interest in hypercomplex fractals have been provided a boost by the work of Clyde Davenport, among others. The Stone Soup Group has an excellent section on hypercomplex numbers in their Fractal Creations (Second Edition+) by Tim Wegner/Bert Tyler and the Waite Group. One final set of examples I provide are for squaring, multiplying and dividing. In hypercomplex numbers, the commutative law for multiplication holds, but division can be undefined if the divisor equals zero. Division is done the same as for complex numbers, multiplying the dividend by the multiplicative inverse of the divisor, if it exists. hcomplex sqrh(hcomplex *h) { hcomplex r; r.x=h->x*h->x-h->y*h->y-h->z*h->z+h->w*h->w; r.y=h->y*h->x+h->x*h->y-h->w*h->z-h->z*h->w; r.z=h->z*h->x-h->w*h->y+h->x*h->z-h->y*h->w; r.w=h->w*h->x+h->z*h->y+h->y*h->z+h->x*h->w; return(r); } hcomplex multh(hcomplex *h1, hcomplex *h2) { hcmplex r; r.x=h1->x*h2->x-h1->y*h2->y-h1->z*h2->z+h1->w*h2->w; r.y=h1->y*h2->x+h1->x*h2->y-h1->w*h2->z-h1->z*h2->w; r.z=h1->z*h2->x-h1->w*h2->y+h1->x*h2->z-h1->y*h2->w; r.w=h1->w*h2->x+h1->z*h2->y+h1->y*h2->z+h1->x*h2->w; return(r); } hcomplex reph(hcomplex *h) { cmplex c,d; hcomplex r; c=divz(1.0,0.0,h->x-h->w,h->y+h->z); d=divz(1.0,0.0,h->x+h->w,h->y-h->z); r.x=(c.x+d.x)/2.0; r.y=(c.y+d.y)/2.0; r.z=(c.y-d.y)/2.0; r.w=(d.x-c.x)/2.0; return(r1); } hcomplex divh(hcomplex *h1,hcomplex *h2) { hcomplex temp; temp=reph(h2); return(multh(h1,&temp)); } |
Copyright © 1989-2004 Mystic Fractal. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Mystic Fractal is prohibited. The name 'Mystic Fractal' and the Mystic Fractal logo are trademarks.