there are a lot of old java syntax that I don't know how to convert to JavaScript equivalent. For example.
1. in Variables tab, spline is a type ==CubicSpline, how do I convert to JavaScript? 2. in fixed relationship, code like "y[i]=((org.opensourcephysics.numerics.CubicSpline)spline).evaluate(xi);" is this kind of code working on EJSS or only EJS currently?
I lack the technical knowledge of harnessing the org.opensourcephysics.numerics.CubicSpline library, Thus, can an EJSS (Javascript) version be released soon? :)
Re: is it possible to have a JavaScript version of Cubical Spline? -
Wolfgang
192 Posts
The Cubic spline model that is referenced in this thread was written using the Java version of EJS. It uses a numerical method from the OSP Java library and that code is attached. Unfortunatley, this cubic spline code has not been implemented in JavaScript.
The Java shown uses the given (x,y) data to compute the polynomical coefficients for the piecewise cubic function. These coefficients are then used to create an OSP function that is passsed to the OSP graph object. I recommend that you use a full-featured JavaScript development environment to implement and test the code JavaScript before importing it into a JavaScript EJS model.
The Java OSP library is available on Git Hub for anyone who woild like to do the conversion to JavaScript.