1) When programming in the new javascript of EJSS, the programming syntaxis (procedures, variables, etc) is javascript. I have no experience with that. Is very different from java coding? Where can we learn to program in javascript?
2) I do use external libraries in java for number crunching, Lapack, and complex libraries (the old FORTRAN libraries, ported to Java. I know that Apache Org numerical calculus libraries do exist, but I feel more comfortable with the old venerable Blas and Lapack). Is it possible to use these in EJSS? (I think not, but....) If not, are there similar libraries for number crunching in EJSS-javascript?
To make clear the question: when solving a Hamiltonian for a well potential, I do use a big 200x200 square tridiagonal matrix. I need eigen-value and eigenstate routines. Can that be done using some javascript preexistent routines?
3) Could you address me to a book, or references, in javascript coding (better in Applied Physics or Computing Physics)
Re: Programming style, external libraries and so on -
Francisco Esquembre
237 Posts
Here are a few answers:
>1) When programming in the new javascript of EJSS, the programming syntaxis (procedures, variables, etc) is javascript. I have no experience with that. Is very different from java coding? Where can we learn to program in javascript?
Not really very different for algorithms. I have just created a short document (still in draft form) instructing how to port an existing Java simulation to Javascript. Nothing too detailed, but I have attached it. (Chapters 2 and 3 are missing, but still helpful.)
>2) I do use external libraries in java for number crunching, Lapack, and complex libraries (the old FORTRAN libraries, ported to Java. I know that Apache Org numerical calculus libraries do exist, but I feel more comfortable with the old venerable Blas and Lapack). Is it possible to use these in EJSS? (I think not, but....) If not, are there similar libraries for number crunching in EJSS-javascript?
EjsS Javascript 'flavor' (as I like to call it) has a Model Element that implements a bit of this. In particular, linear algebra. It is the Numerics JS library. See http://numericjs.com and the model element.
>To make clear the question: when solving a Hamiltonian for a well potential, I do use a big 200x200 square tridiagonal matrix. I need eigen-value and eigenstate routines. Can that be done using some javascript preexistent routines?
Please, consult the Numeric JS doc.
>3) Could you address me to a book, or references, in javascript coding (better in Applied Physics or Computing Physics)
Not really. I learnt it with a vert technical book. But google for "javascript manual", I got some interesting sites.
Re: Programming style, external libraries and so on -
Cleon Teunissen
29 Posts
To me the following two resources were very interesting: A series of talks by Douglas Crockford: http://www.youtube.com/playlist?list=PL7664379246A246CB
A series of essays by Dmitry Soshnikov, written for people who come to javascript from other languages: Starting point: http://dmitrysoshnikov.com/ecmascript/javascript-the-core/
Dmitry Soshnikov avoids oversimplification. An introduction to Javascript that oversimplifies has the following disadvantage: as you learn more you will find that you have to unlearn some things; the things that aren't as simple as portrayed.
When reading Dmitry Soshnikov my impression is that I won't have to unlearn things, as I progress.
Of course, to create simulations with EJS one only needs to know a very limited subset of the programming environment. To create a Java simulation I did not need to learn about Java Classes; only how to write Java methods.
So: what sort of thing do we have to know?
Here's something from the top of my head: in Javascript there are two comparison operators: '==' and '==='. The '==' operator does type coercion. If you compare two variables of different type (probably as a result of a programming error), then the == operator converts one or both, to make them of the same type. The type coercion can mask errors (the program just ploughs on, creating unintented results). Therefore the === was introduced, for comparison without type coercion.
Re: Programming style, external libraries and so on -
anto sarco
1 Posts
While the two have similar in names , both are two totally different programming languages. Java is a full featured, all purpose, programming language that is mainly used in server side, mobile development and also run in browsers. To compile java based programs you need JDK+JRE set up in your computer. Since java is pure object oriented programming language everything you do is under a class. It follows very strict typing and enforces casting of references. More about...java and javascript....