wgxli / complex-function-plotter

WebGL Complex Function Plotter
https://samuelj.li/complex-function-plotter/
GNU General Public License v3.0
48 stars 9 forks source link

ln(0) #31

Closed gtbot2007 closed 1 year ago

gtbot2007 commented 1 year ago

ln(0) gives as −36.841+1.571i and I have no idea where this number is coming from or why

wgxli commented 1 year ago

This is because internally we compute ln(z + 1e-16 i) to obtain a consistent branch cut when evaluating composed functions. The offset 1e-16 is limited by GLSL resolution on the GPU.

Infinity is not expressible in the GLSL representation I am using, so as a compromise I have special-cased ln(0) to -10^100 in the latest update, as well as reducing the epsilon and using it only when needed.