NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: lookang on August 10, 2010, 09:10:53 am



Title: this is how to make display show in scientific format 0.00E00 like tracker
Post by: lookang on August 10, 2010, 09:10:53 am
Format   
The format used to display the value, i.e. the number of decimal digits with which to display the value.   Type 0.0 with one or more zeros after the point.

http://www.um.es/fem/EjsWiki/Main/ElementsSlider

i just try 0.00E00 and it works!
cool man



Title: Re: this is how to make display show in scientific format 0.00E00 like tracker
Post by: lookang on August 10, 2010, 09:13:19 pm
Dear Ejs learning community

I have a question.

I have a custom function
double dv;
public String double2String(double v,double divider){
 if(v > 0)dv=0.5;
 else if(v < 0)dv=-0.5;
 else dv=0;
 return (int)(v*divider+dv)/divider+"";
}

the string called cannot display the values correctly
for example
s_E2 = " {g_net} = 6.67*10^{ - 11} *( " +double2String(m1,10.)+")"+"/("+double2String(x1-xtest,10.)+"){^2}" ;

how can the codes be modified to display in scientific form?

this doesn't work
s_E2 = " {g_net} = 6.67*10^{ - 11} *( " +double2String(m1,0.00E00)+")"+"/("+double2String(x1-xtest,0.00E00)+"){^2}" ;

any tips?

i think must rewrite the custom function but i don't know how to start  ;D
or is there some open source physics function that can do this?


Title: Re: this is how to make display show in scientific format 0.00E00 like tracker
Post by: lookang on August 11, 2010, 08:05:48 am
http://www.um.es/fem/EjsWiki/Main/ElementsSlider

edited the wiki to include

Format   
The format used to display the value, i.e. the number of decimal digits with which to display the value.   
Type 0.0 with one or more zeros after the point. or 0.00E00 for scientific notation