For those interested in the mathematical power of Jython for engineering and scientific application I will start sending some code snippets of working code. I find Jython (read also Python), very efficient, organized and fast to develop any kind of application. Here goes an easy one: """ Use of Java arrays, sin() and cos() methods. Java Source: "Technical Java Developing Scientific And Engineering Applications". Prentice Hall. ISBN 0-13-101815-9 Ported to Jython by: Alfonso Reyes, October 2007 """ import jarray from jarray import array, zeros from java.lang import Math # number of points. The array will show them from 0 to (numPoints-1) numPoints = 9; x = jarray.zeros(numPoints, "d") # array of double y = jarray.zeros(numPoints, "d") """ Distribute points around a circle of radius 1.0 """ for i in range(0, numPoints, 1): # array index goes from 0 to (numPoints-1) angle = i * 2.0 * Math.PI/(numPoints-1); x[i] = Math.cos(angle); y[i] = Math.sin(angle); # use C like formatting for a nice output print "x[%d]=%12.5f \t\t y[%d]=%12.5f" % (i, x[i], i, y[i])

View this message in context: Using arrays with trigonometric methods. Jython examples
Sent from the jython-users mailing list archive at