APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D.indexToX(i) is working on EJS post and replies

Return to the is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D.indexToX(i) is working on EJS thread
Login to post to this thread

is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D.
lookang Avatar
lookang
244 Posts

Is there a comparable function to `_view._vectorField2D.indexToX(i);` in EJSS? However, it's worth noting that `_view.vectorField2D.indexToX(i)` functions properly in EJS.

I located the code within the provided link: https://www.compadre.org/OSP/document/ServeFile.cfm?ID=9964&DocID=1589. This pertains to the 'DipoleTrajectoryWrong.xml' example.


OSP@SG blog
OSP@SG Digital Library

Replies to is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D.

Re: is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D. -
Wolfgang
191 Posts

Unfortunatetely, JavaScript EJS doe not yet support 2D scalar and vector fields.



Re: is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D. -
lookang Avatar
lookang
244 Posts

I recreated the new Vector Field and Scalar Field using EJSS6.1

https://iwant2study.org/ospsg/index.php/interactive-resources/physics/05-electricity-and-magnetism/01-efield/1172-dipoletrajectorywrong

Please find this version created in EJSS6.1 that supports scalar field. Felix created this capability some years back when he was in Singapore.

Attached File: Screenshot20230813at4.26.04PM.png


OSP@SG blog
OSP@SG Digital Library


Re: is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D. -
Wolfgang
191 Posts

Although EJS 6 does not yet have a scalar or a vector field drag-and-drop element, it is straighforward to add JavaScript code to visualize these 2D fields.  Here are examples.

Scalar field contour and colored pixel plot.  
https://www.compadre.org/osp/items/detail.cfm?ID=14061

Vector Field using arrow color for magnitude.
https://www.compadre.org/osp/items/detail.cfm?ID=14060



Re: is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D. -
Alfonso Fischer
1 Posts

It is easy to add JavaScript code to view these 2D fields doodle jump, even though EJS 6 does not yet include a scalar or vector field drag-and-drop element.



Re: is there an equivalent function for _view._vectorField2D.indexToX(i); in EJSS ? _view.vectorField2D. -
Wolfgang
191 Posts

It is not difficult to program a vector field in JavaScript.  Look at the code for the Electic Field model by clicking on the Open in Web EJS link in the following EJS model.

https://www.compadre.org/osp/items/detail.cfm?ID=14060



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book