Skip to content

A 3D web grapher for complex functions that supports Re-Im, Im-Re and Mod-Arg plots

Notifications You must be signed in to change notification settings

hemisemidemipresent/complex3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

complex3

A 3D web-based complex function grapher

example of a Re-Im plot

example of a Mod-Arg plot

Uses a custom rust expression parser and evaluator (in ./rust) compiled to wasm

Features

  • Expandable function input box

    for this to update you have to press the Load button

  • Different types of Plots

    for this to update you have to press the Load button

  • (Rough) control over how many vertices loaded

    for this to update you have to press the Load button

  • Autorotate on/off

  • Glassy/Shiny surface on/off

    When shine is on:

    Note: This might not accurately represent how real life translucent shiny surfaces work, and there may be issues on devices with less great GPUs

  • If you dont like B/W with Re-Im/Im-Re plots

  • Lower Left Buttons

    the book icon hides/shows the topleft tab

    the camera icon exports the graph as a .png

Purpose

I saw cool stuff like this graph from this youtube video:

but there is no easy way to render such Mod-Arg plots. So the objective of this is to create an optimized way to graph 3D complex plots on the web (snappily).

TODO

  • cut off after certain height option
  • Export to a .stl file 3D printing (probably defer this or smth)
  • Opacity, Saturation, Value option

Done

  • Logarithmic height option
  • Hide title option
  • Add an option for how many points u want in a mesh (aka how good is your device)
  • Mod-Arg, Im-Re plot
  • Export to an image - compromised performance by adding preserveDrawingBuffer: true to renderer re-renders with preserveDrawingBuffer: true, exports image, and re-render with preserveDrawingBuffer: false
  • Optimize reloading
  • shiny/glassy surface option

What are Re-Im/Im-Re/Mod-Arg plots?

For a complex-valued function, the complex input consists of 2 values (Real and Imaginary part i.e. $x+iy$) while the complex output similarly also consists of 2 values. This would require a 4-dimensional graph that we cannot visualize, however, so instead, we plot 3 values and leave the 4th one to color

For example for the given function $f(x+iy) = w+iv$

  • a Re-Im plot takes the real component of the output $w$ and uses that as the height of the surface at a given point. the imaginary part $v$ is sigmoid-ed to B/W value
  • a Im-Re plot, on the other hand takes the imaginary component of the output $v$ and uses that as the height of the surface at a given point. the real part $w$ is sigmoid-ed to B/W value
  • a Mod-Arg plot takes the modulus as the height and the argument:

examples

note: for functions with asymptotes/large changes in gradient it is necessary to increase the "How good is your device" to a value higher, perhaps 10 but 25 is better

$\tan(z)$ (tan(z)), Mod-Arg

$\Gamma(z)$ (gamma(z)), Mod-Arg

$\sec(z)$ (sec(z)), Re-Im, colored

$\sinh(z)$ (sinh(z)), Mod-Arg

$4sin^{-1}\frac{z}{4}$ (4asin(z/4)), Re-Im

1/(1+(z/5)^2), Re-Im, colored, you can see the 2 asymptotes at z=±i that causes the radius of convergence to be 1