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

Integration

SCaVis extends SimPy and integrates it into Java. Below we show an advanced example of how to plot a function and its differential on the same plot.

Code example

  Download for this example is disabled for non-members
 1: from java.awt import Color
 2: from jhplot  import *
 3:
 4: c1 = HPlot("Canvas")
 5: c1.setAutoRange()
 6: c1.setGTitle("Differential", Color.red)
 7: c1.setNameX("Xaxis")
 8: c1.setNameY("Yaxis")
 9: c1.setName("Canvas title")
10: c1.visible()
11: c1.setAutoRange()
12:
13: func="2*exp(-x*x/50)+sin(pi*x)/x"
14: f1 = F1D(func, 1.0, 10.0)
15: c1.draw(f1)
16:
17: from sympy import *
18: x = Symbol('x')
19: a=diff(S(func), x)
20: f2 = F1D(str(a), 1.0, 10.0)
21: f2.setTitle("Differential")
22: f2.setColor(Color.green)
23: c1.draw(f2)
24: c1.export("figure.pdf")

The output figure is shown below:

man/symbolic/sympy/integration.txt · Last modified: 2014/01/23 20:10 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