You are a guest. Restricted access. Read more.
SCaVis manual

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 math3.special package. to define the “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)

The function “erf” is taken from Erf Java class. 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

man/math/special_functions.txt · Last modified: 2014/12/13 13:12 by admin
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5