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.

How to use myFunction.evaluate

Return to the EJS Modeling forum
Login to post to this thread

How to use myFunction.evaluate
Mirka Kouka
5 Posts


I have in my simulation 3 fields. The first one has the function (for example 4*sin(pi/8*x)) but it can change from the user. The second one has the x-value of the function which also could be defined by the user. The third one is not editable and should show the value of the function.

By the initialization page when I write fx = _view.functionField.evaluate({x:1}); I get the correct result for x=1 but I want to get a result for any x given by the user in the second field.

I have tried  fx = _view.functionField.evaluate({x:_view.xField}); (xField is the name of my 2nd field) but it doesn't work.

Can anyone help me make this working? Thank you!!!!

Current Replies - View all
Re: How to use myFunction...   (Wolfgang - )
Re: Re: How to use myFunc...   (Mirka Kouka - )
Re: Re: Re: How to use my...   (Wolfgang - )
Re: Re: Re: Re: How to us...   (Mirka Kouka - )
OSP Projects:
Open Source Physics - EJS Modeling
Physlet Physics
Physlet Quantum Physics
STP Book