from java.awt import*
from jhplot import *
from jhplot.math.exp4j import *
from jhplot.math.exp4j.function import *
class cf2(Function):
def apply(self,val):
if (val[0]<100):
return val[0]*val[0]
if (val[0]>=100):
return val[0]
e=ExpressionBuilder("cf2(x)")
func=cf2("cf2",1);
e.function(func)
e.variables("x")
fff=e.build()
#fff.setVariable("x", 10);
#print fff.evaluate()
c1 = HPlot()
c1.visible(1)
c1.setAutoRange()
f=F1D(e.build(), 10,1000)
c1.draw(f)
Ads help maintain this website.