using symbolic calculation in Python I have
import sympy from cmath import * from mpmath import arg, cplot z = sympy.symbols('z') fhandle='z**2' g = lambda w: sympy.sympify(fhandle).evalf(subs={z: w}) g(1+2j) # Returns: -3.0 + 4.0*I # hence the next command fails, because I is expected to be 1j cplot(g, [-3,3], [-3,3]) Crawling the web I only found this which will fix the matter for the print command, but will not work with cplot.
Any suggestions?

sympify. When you can (which is almost always) write actual code, not strings to be passed tosympify.fhandlewill be passed as a string from the web interface. Still abusive?sympifymay parse code througheval, which means that you are exposing your app to injections. It is not an issue if you can trust the users, but it is good to know anyway.