You are a guest. Restricted access. Read more.

Special functions

The simplest way to create complicated functions including special function is to call external Java libraries. You can use any Java library in the function definitions, mixing freely Java and Python code (or any other scripting language). Here is a small example that creates 1-erf(x) function from Apache API to define “erf” function.

from jhplot import *
from org.apache.commons.math3.special.Erf import *
 
class MyFunc(FNon):
      def value(self, x):
                return 1-erf(x[0])
c1 = HPlot()
c1.visible();   c1.setAutoRange()
pl = MyFunc("function",1,0)
f1=F1D(pl,-4,4)
c1.draw(f1)

Here “MyFunc” is a class that defines a new function (1-erf) and returns its values. x[0] defines “x” (0 means one-dimensional function). You can also define functions in multiple dimensions using x[0], x[1], x[2] etc. notations.

The output of this script is shown in this plot:

The above approach works only for Jython/Python codding. A more general approach is to call Java directly and extend the class jhplot.FNon that is a pure-Java approach, as in the above example. In this case you can create not only Python scripts, but also write code in pure Java, or mix Java, Groovy and JRuby.

Look at the section Non-parametric functions for more details.

You are not full member and have a limited access to this section. One can unlock this part after becoming a full member.

List of Java libraries for special functions

Here is a short list of special functions supported by SCaVis:

You are not full member and have a limited access to this section. One can unlock this part after becoming a full member.

Navigation

Print/export