#๐ How to make a julia set - beginer
145 messages ยท Page 1 of 1 (latest)
@supple lance
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I've never done Julia Sets, but I have done Mandelbrot Sets many times, and they're a similar algorithm afaik.
idk what afaik means?
"as far as I know"
i was doing mandelbrot sets but it was too hard
i thoguht an easier equations would be easier
I don't think they're too different. I think Julia sets are just a generalization of Mandelbort Sets.
it seems as if you meant realNum * (realNum-1) instead of realNum * realNum-1
I'll see if I can find some code that shows the algorithm I've used previously.
honestly i was just watching a video explaining complex numbers and he made some code wich gave out numbers but they were different to mine
so ik mines wrong
idk what im doing
Also, Python has a complex number type btw. You don't need to do the complex number math yourself.
!e
print(1+2j, type(1+2j))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
(1+2j) <class 'complex'>
what maths is needed
At least with Mandelbrot sets, you square the complex numbers as part of the iteration.
Ah, I was thinking of the limit test. You can square the complex result when checking if the point is going off to infinity.
C is how complex number set is usually marked, so small c is sometimes used as "some complex number"
Just like natural number set is N and n is used to mean "some natural number"
We're talking about actual values, not variable names, here.
c is the point being tested iirc, so ya, for each point, c remains the same.
ya
Ah, yes, in case of Mandelbrot, the function is defines as f_c (f with lower index c) - it's function f for given c
what is a value of c that does work
It's where the iteration starts at, and it gets added back on to the intermediate result ever iteration.
I don't know why it's set up like that, but those are the rules.
yea i
ik
is something like this correct
as the mandelbrot set
or nah\
it cant be that easy
Here's the last algorithm that I wrote (Rust, not Python unfortunately: https://github.com/carcigenicate/mandelbrot_explorer/blob/d0776e0bab5dc26960672b231411ab9fe01f102c/src/logic/mandelbrot_iteration.rs#L20
src/logic/mandelbrot_iteration.rs line 20
pub fn test_point(initial: ComplexPoint, max_iterations: u32, infinity_limit: u32) -> u32 {```
i dont really udnerstand
Nvm, I'm realizing now that I haven't actually looked at the formal Mandelbrot definition in forever and have just been re-translating my old algorithm every time I redo the project. My algorithm actually seems different than the formal definition. I have no idea where I got it from at this point.
I originally wrote that core algorithm like 10 years ago from some source.
you would have to check for the modulus for the number "z" after each iteration, and if it is over 2 then "c" is not part of the set.
If after the maxIterations the modulus of z does not go over 2, we consider c to be part of the set
Doing this over different values for "c" will get you the mandlebrot set
so the mandelbrot set hasincreased resolution with more valeus of c?
and what is a good jump between each value of c
like should i add 0.01to c each time or smth
yes that seems good
since python is not very quick, something between 25-50 should be good
also you do have to vary the complex component of c as well
yeah, because c=a+bi(writtten a+bj in python)
so modulus here means "distance of complex number from (0, 0) on the complex graph",
ohh k
and not "remainder" (ik its kinda confusing)
yeah here it would be the value of the number it self,
but for a general complex number its value would be (a^2 + b^2)^.5 where the number is z=a+bi
|z| in math notation
abs in python (handles complex type by default)
Just use abs in python
!e print(abs(3+4j))
:white_check_mark: Your 3.12 eval job has completed with return code 0.
5.0
yeah i was about to write that but u said it first
how is3+4j 5
as (3^2 + 4^2)^(0.5) = 25^0.5 = 5
abs(3+4j), not 3+4j
Because 3+4j is just 3+4j
No. You'd want to iterate each point maxIter times. Not maxIter iterations and going only up with the points
And each point is 2d - each point has real and imaginary part. While your c is just c+0j
yea if i add the j its breaks
It's not "add the j", j character is part of the literal value
wdym by this
Do you know what literal is in programming? It's value that is read, well, literally. String literal is quotes+stuff between the quotes. Int literal is just a number.
Complex literal has either just imaginary part, so it has to be some number and j. Or real+imaginary part.
Like 4+3j above is a literal with real part. Or you'd want to use 1j to convert something to imaginary part (e.g. a*1j).
i added the j
i really dont understand how i change it to make it work
each time the results do like 1iteration before passing abs2
Of course they do, because i is your outer loop. So it will stay being i=1 until all of the inside finishes...
I mentioned it here how your loops are opposite
yea
both loops are in max iterations times
changing that wont change anything
It's about what each variable means (where it's used), not how many times the loop iterates over
I wrote it in that message. You'd want to change c in the outer loop, while the inner loop only calculates all z values for the given c
As you yourself said before the code - c is constant for the given z calculation
Why do you think it's the same?
Does this code also "repeats the same equation 50 times" or not?
x = 2
for i in range(10):
x = x*x
You're not. It just sounds like you still lack a lot of basics
Define "most of the basics"
!d array you mean this? Or list?
This module defines an object type which can compactly represent an array of basic values: characters, integers, floating-point numbers. Arrays are sequence types and behave very much like lists, except that the type of objects stored in them is constrained. The type is specified at object creation time by using a type code, which is a single character. The following type codes are defined:
List is not an array
Set? Dict? Classes?
For this here you'd also need to at least understand complex number basics, you didn't even understand how abs works on them nor what j is.
ik what it is
someone said modulus
then said thats what abs is
when i think it is %
anyway thanks for ur help
im pretty busy this week but maybe next wekend ill try do some more of this stuff
cya
Because that IS the alternative name for absolute value. And with complex numbers when modulus is used often, saying "modulus of z" is shorter "absolute value of z"
ok
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.