Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new extension] Complex Number #870

Closed
wants to merge 9 commits into from

Conversation

Skyhigh173
Copy link
Contributor

@Skyhigh173 Skyhigh173 commented Aug 10, 2023

Complex Number Extension

Contains these blocks:
image

support these functions:

  • 'abs','arg','neg','inv','muli','sign','exp','ln','log10','log2','square','sqrt','cbrt','iabs','conjg'
  • 'sin','cos','tan','arcsin','arccos','arctan','sinh','cosh','tanh','coth','sech','csch'
  • 're','im'
  • gamma function (factorial)

Btw since it uses regex a lot, so I have to find a better algorithm for parsing complex numbers

@qxsck
Copy link
Contributor

qxsck commented Aug 10, 2023

good

@Skyhigh173
Copy link
Contributor Author

I forgot to add factorial 😱

@ghost
Copy link

ghost commented Aug 10, 2023

This would be cool for displaying 2d graphs!

@Skyhigh173
Copy link
Contributor Author

This would be cool for displaying 2d graphs!

I posted it in discord for example (graph of ln(z)) image

@ghost
Copy link

ghost commented Aug 10, 2023

Wait... does that mean I can make the Mandelbrot Set?!

@Skyhigh173
Copy link
Contributor Author

Wait... does that mean I can make the Mandelbrot Set?!

Yes, ofc!
I have tested it by using formula (z^2+c) and it works

@Skyhigh173
Copy link
Contributor Author

Skyhigh173 commented Aug 11, 2023

Wait... does that mean I can make the Mandelbrot Set?!

image
image

@Flappy25
Copy link

Wow!

@penta-quark-neutro
Copy link

Wow, I had been building an extension on this topic, except for the quaternions.
Let me tell you that your extension is excellent.

@Skyhigh173
Copy link
Contributor Author

Skyhigh173 commented Aug 12, 2023

new modes

I will add more output modes :

  • normal string (1-i, 2.3+4.5i)
  • raw string (!1|2, !3.4|-3)
  • JSON ({"r":3,"i":5})
    to boost performance if you use them often (eg you can use 'raw str' to avoid regex)
    You can use to string block to convert them to normal string
    image

Result (for rendering high quality Mandelbrot set)

  • string: 32.677s
  • raw string: 9.771s
  • JSON: 7.45s

still missing:

- conjg function
- iabs function (iabs(a+bi) = abs(a) + abs(b)i)
(Completed)

@Skyhigh173
Copy link
Contributor Author

closed because waited too long + the code is a completely mess. It could be improved on.

@Skyhigh173 Skyhigh173 closed this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants