Sujet : Re: New way of dealing with complex numbers
De : chris.m.thomasson.1 (at) *nospam* gmail.com (Chris M. Thomasson)
Groupes : sci.mathDate : 08. Mar 2025, 07:28:34
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vqgo2i$tiv$3@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 3/7/2025 10:17 PM, Chris M. Thomasson wrote:
On 3/7/2025 3:34 PM, Richard Hachel wrote:
[...]
Try to start small. Create a Mandelbrot using traditional complex numbers first. Then... Create another plot using your new version. Fwiw, perhaps, my code can help you here. Can you run it on your end? Thanks:
https://fractallife247.com/
If so, be sure to click around... :^)
Does it work for you? ;^o
My vector math for this experiment:
___________________
// Vector Math
//__________________________________________
function ct_vec2_add(v0, v1) {
return [v0[0] + v1[0], v0[1] + v1[1]];
}
function ct_vec2_sub(v0, v1) {
return [v0[0] - v1[0], v0[1] - v1[1]];
}
function ct_vec2_mul(v0, v1) {
return [v0[0] * v1[0], v0[1] * v1[1]];
}
function ct_vec2_mul_float(v0, v1) {
return [v0[0] * v1, v0[1] * v1];
}
function ct_vec2_length(v0) {
return Math.sqrt(v0[0] * v0[0] + v0[1] * v0[1]);
}
function ct_vec2_normal(v0) {
var length = ct_vec2_length(v0);
if (length == 0) return [0, 0];
return [v0[0] / length, v0[1] / length];
}
function ct_vec2_copy(v0, v1) {
v0[0] = v1[0];
v0[1] = v1[1];
}
function ct_vec2_complex_mul(v0, v1) {
var x = v0[0] * v1[0] - v0[1] * v1[1];
var y = v0[0] * v1[1] + v0[1] * v1[0];
return [x, y];
}
function ct_vec2_complex_abs(v0) {
return ct_vec2_length(v0);
}
___________________
Notice the *_complex_* aspects?