How to parametrize an input to be evaluated

2026-09-06English

Hi! I'm writing a little program to generate images of the Mandelbrot set and other sets. The thing is i would like to have something like ./Mandelbrot -function z*z*z + c

But i have no idea on how to make this parametrizable and detect the formulas. I would write a little helper function to detect at least the simple ones like z^smth + c but if i want to use other stuff like

f(z) = | z | ^ 2 + c its gonna be too complicated for me to do it..

So, any solution for this or I should give up on the idea?

Actual code for the actual implementation:

c := m.getImaginaryNumber(x, y) z := complex128(0) var i int for i = 0; i < m.iters && cmplx.Abs(z) <= 2; i++ { z = z*z + c //parametrize??? } //crazy, give up if i == m.iters { return 0 } 
submitted by /u/mucleck
[link] [留言] Read original: https://www.reddit.com/r/golang/comments/1w8606s/how_to_parametrize_an_input_to_be_evaluated/

原文:https://www.a8q9.cn/en/article/en-how-to-parametrize-an-input-to-be-evaluated.html

相关文章