You can easily plot the points using a python script. This script iterates through a list of $x$ & $y$ values from $-70$ to $70$ where as @Robin Betts has pointed out $4y > (y-x+1)^2$ are imaginary values and cannot be plotted. So this script ignores negative values where the term $4y$ is greater than the term $(y-x+1)^2$ and only plots the real points.
import bpy
def get_object(name):
objects = bpy.context.scene.objects
if name in objects:
return objects[name]
m = bpy.data.meshes.new(name + "-mesh")
o = bpy.data.objects.new(name, m)
#o.modifiers.new(name, 'SKIN')
bpy.context.collection.objects.link(o)
return o
# ==================================================================================================
# Equation:
# Descritpion: plot the graph ( y - x + 1 - ( (y-x+1)^2 -4y )^(1/2) ) / (2)
# ==================================================================================================
def get_range(start, end, step = 2):
return [x * 0.1 for x in range(start * 10, end * 10, step)]
def get_graph_z_real(x, y):
return (y - x + 1)**2 - 4*y
def get_graph_z(x, y, real):
return ( y - x + 1 - ( real )**(1/2) ) / (2)
def draw_graph():
verts = []
for py in range(-70, 70):
for px in range(-70, 70):
real = get_graph_z_real(px, py)
if real < 0:
continue
pz = get_graph_z(px, py, real)
verts.append([px, py, pz])
o = get_object("graph")
m = o.data
m.clear_geometry()
m.from_pydata(verts, (), ())
draw_graph()
Or you can use the Z Math Surface under object menu Add > Math Function > Z Math Surface
But since you have that imaginary part you cannot directly use the equation $(y-x+1-((y-x+1)^2-4y)^{1/2} )/(2)$ but instead need to use a condition to filter out the imaginary part. The best you can do is probably set the term $(y-x+1)^2-4y$ to zero if $4y$ is greater than $(y-x+1)^2$ like so (or experiment with other non-imaginary values):
(y-x+1-((y-x+1)**2 -4*y if 4*y < (y-x+1)**2 else 0 )**(1/2) ) / (2)
Another sample to restrict the domain to $0 <= x <= 1$ & $0 <= y <= 1$
import bpy
def get_object(name):
objects = bpy.context.scene.objects
if name in objects:
return objects[name]
m = bpy.data.meshes.new(name + "-mesh")
o = bpy.data.objects.new(name, m)
#o.modifiers.new(name, 'SKIN')
bpy.context.collection.objects.link(o)
return o
# ==================================================================================================
# Equation:
# Descritpion: plot the graph ( y - x + 1 - ( (y-x+1)^2 -4y )^(1/2) ) / (2)
# ==================================================================================================
def get_range(start, end, step = 2):
return [x * 0.001 for x in range(start * 1000, end * 1000, step)]
def get_graph_z_real(x, y):
return (y - x + 1)**2 - 4*y
def get_graph_z(x, y, real):
return ( y - x + 1 - ( real )**(1/2) ) / (2)
def draw_graph():
verts = []
for py in get_range(0, 1):
for px in get_range(0, 1):
real = get_graph_z_real(px, py)
if real < 0:
continue
pz = get_graph_z(px, py, real)
verts.append([px, py, pz])
o = get_object("graph")
m = o.data
m.clear_geometry()
m.from_pydata(verts, (), ())
draw_graph()
4*y > (y-x+1)**2
, you are asking for the square root of a negative number .. you would have to work out your own representation ofComplex
, 'Math Function' deals only with reals. Or restrict your domain. $\endgroup$**(1/2)
for the square root but^2
for the square part? That's not clear in your question. It's just that^
doesn't work. $\endgroup$