# Why is this happening to my points?

I am very very bad at coding. I started a few months ago and I’ve been picking it up as I went along. I’ve been coding up some newton fractals when I discovered I could use point functions for the complex numbers (whatever they’re called).

I used the functions in a for loop and tried to iterate it when I noticed that it only counted the first iteration. I believe the problem is that I’m using the “point” thing before it. So normally in the loop, when I’m making fractals with floats, I go `x = xx+yy;` or something, but with these points, I seemingly have to add “point” at the beginning, which, i think, counts the point variable as different once it goes through. (or whatever, i really dunno if i’m using the right terminology)

``````point z0 = P,
point z1 = P,
point z2 = P,
point z3 = P,
float iterations = 0,
output point fractalvector = 0,
){

point mult(point A, point B)
{
return point(((A[0]*B[1])+(A[1]*B[0])), ((A[0]*B[0])-(A[1]*B[1])), 0);
}
point div(point A, point B)
{
return point(((A[0]*B[0])+(A[1]*B[1]))/((B[0]*B[0])+(B[1]*B[1])), ((A[0]*B[1])-(A[1]*B[0]))/((B[0]*B[0])+(B[1]*B[1])), 0);
}
{
return point(A[0] + B[0], A[1] + B[1], 0);
}
point sub(point A, point B)
{
return point(A[0] - B[0], A[1] - B[1], 0);
}
for(float i = 0; i < iterations; i++){
point z4 = mult(mult(sub(z0, z1), sub(z0, z2)), sub(z0, z3));
point z5 = add(add(mult(sub(z0, z2), sub(z0, z3)), mult(sub(z0, z1), sub(z0, z3))), mult(sub(z0, z1), sub(z0, z2)));
point z0 = sub(z0, div(z4, z5));
fractalvector = z0;
}
}
``````

I am also very new to this website and I don’t know if people should be pasting the code in here or whatever, sorry if I got it wrong. ):

Also if my code is in anyway… terrible, please feel free to fix it.

Also also, from reading the other messages, this all just sounds like gibberish. I barely understand my own code, I don’t expect to understand a 99+ level osl god who wrote their master’s thesis in osl. I am an absolute dummy. Treat me as if I have no base knowledge of osl and start from there.
Thank you! (:

This is how you can format code in posts:

Hit the button highlighted by red arrow and paste your code between tilda symbols.

I still haven’t gotten anywhere