 |
Showing a custom function using exp4j in 3D
Source code name: "func_exp4_3D.py"
Programming language: Python
Topic: Function/2D
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/func_exp4_3D_2539.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from java.awt import*
from jhplot import *
from jhplot.math.exp4j import *
from jhplot.math.exp4j.function import *
class cf2d(Function):
def apply(self,val):
if (val[0]<50 or val[1]<50):
return val[1]*val[0]
if (val[0]>=50 and val[1]>=50):
return val[0]*val[0]+val[1]*val[1]
e=ExpressionBuilder("cf2d(x,y)")
func=cf2d("cf2d",2);
e.function(func)
e.variables("x")
e.variables("y")
fff=e.build()
#fff.setVariable("x", 10);
#print fff.evaluate()
c1 = HPlot3D()
c1.visible(1)
c1.setAutoRange()
f=F2D(e.build(), 0,200, 0,200)
c1.draw(f)
You see the box below because you did not login.