NTNUJAVA Virtual Physics Laboratory

Easy Java Simulations (2001- ) => Modern Physics => Topic started by: Fu-Kwun Hwang on August 05, 2007, 12:07:40 pm

Title: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on August 05, 2007, 12:07:40 pm
This applet let you play with atomic spectra of hydrogen.

The wavelengths of hydrogen spectra lines can be described by the following equation:

1/?=RH*(1/n12-1/n22)
where RH=1.0973732*107 m-1

You can change n1 with the slider bar. The program will plot a series of spectrum lines.
You might want to change the xmax(at the right) to see the full range of the spectra.
One of the line is thicker and with an arrow is the one with n2 equal to slider bar value.

Click within simulation region will toggle "visible spectra range".

You can also find out how the red shift of the spectra calculated from Hubble's law.
v=H0 D where the recessional velocity is proportional to the distance of the star to the earth (D). You can adjust the distance of the star.
And see the red shift of the hydrogen spectra from that star due to the expansion of the universe.
[hide]

[/hide]
n1=1 : Lyman series (Ultraviolet)
n1=2 : Balmer series (Near Ultraviolet and Visible)
n1=3 : Paschen series (Infrared)
n1=4 : Brackett series (Infrared)
n1=5 : Pund series (Infrared)
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on August 26, 2009, 03:32:04 pm
Dear Prof. Hwang,
The redshift applet is a very good idea, because it shows that the individual spectrum lines are not equally shifted, but the shift depends on the wavelength (or the frequency).
I have a comment though:
If c is the speed of light, then the distance unit should be millions of light years. Then the numerical value 3.3 indicated for the distance on the starting screen (which probably comes from 1 Mpc = 3.26 million light years) gives then approximately the correct value for the Hubble speed in units of c. (If calculated with H0 = 74 (km/s)/Mpc.)
Is it possible to translate the applet to Hungarian?
Best regards,
Sandor Nagy 
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on August 26, 2009, 05:46:49 pm
It is easy to translate string in EJS into different language format:
1. Download the simulation file: you will get xxx.jar file
2. Double click downloaded jar file to run it.
3. RIght Click in the simulation window: select translation from GUI options
A window will popup with all the strings. Type in your translation into second column (modify original values) and save it when you are done.
4. It should be loaded automatically when you run it next time.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on August 26, 2009, 08:37:40 pm
Thank you Prof. Hwang,
The translation worked fine, except that the information window that pops up with the simulation is empty, although I translated that too before I loaded down the program. Is there a way to block the empty window?
I will write the help in html.
Best,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on August 27, 2009, 01:14:13 am
I just recompiled the simulation. Please download latest version and try it again if it is still not working.

If you have installed EJS in your computer:
You can Right click open EJS model , and the source code will be open in EJS environment.
You can change those label in EJS and recompile it again (Click green trigangle button).
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on August 29, 2009, 12:36:19 am
I will do that. However I have another problem. I have just uploaded the Hungarian version on the server for the students, but if you open the page 
http://www.chem.elte.hu/Sandor.Nagy/NewClearGlossy/Java/Hubble_Hwang/index.html
the applet will probably not run. The same package runs nice on my computer both at home and at my office at university. I don't know what the problem can be.
I also show you the screen as it is supposed to look like. (See the attachment.) The reason I am showing is that it contains a formula in English which is a picture not a string. I think, it would be better if instead of the word "Wavelength" there would be a Greek letter "lambda".
What do you think?
Best,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on August 29, 2009, 09:50:54 am
If you open the source in EJS, you will find there is a veriable named:eqn withvalue "wavelength \lambda=R_H(\frac{1}{n_1^2}-\frac{1}{n_2^2})";

You can add TeX mathematics formula syntax and it will display it. However  has to be written as \
in order for java to process it as .

The problem seems due to incompatiable type of java. I just re-compiled it again, please try to download it again.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on August 29, 2009, 09:04:35 pm
Please check the applet on your page. It shows error on my computer after a long time of waiting. The rest of the applets are OK.
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: lookang on August 29, 2009, 11:53:59 pm
the error message is

Reading certificates from 11 http://www.phy.ntnu.edu.tw/ntnujava/ejsuser/2/ejs_hydrogen.jar | C:UsersXXXXXXApplication DataSunJavaDeploymentcache6.01179faa90b-7ed45fc6.idx
cHotEqn V 4.02 cHotEqn
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission Fonts14.gif read)
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkRead(Unknown Source)
   at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
   at sun.awt.SunToolkit.getImage(Unknown Source)
   at atp.d.a(Unknown Source)
   at atp.d.a(Unknown Source)
   at atp.cHotEqn.if(Unknown Source)
   at atp.cHotEqn.if(Unknown Source)
   at atp.cHotEqn.try(Unknown Source)
   at atp.cHotEqn.new(Unknown Source)
   at atp.cHotEqn.getPreferredSize(Unknown Source)
   at java.awt.GridLayout.preferredLayoutSize(Unknown Source)
   at java.awt.Container.preferredSize(Unknown Source)
   at java.awt.Container.getPreferredSize(Unknown Source)
   at javax.swing.JComponent.getPreferredSize(Unknown Source)
   at java.awt.BorderLayout.layoutContainer(Unknown Source)
   at java.awt.Container.layout(Unknown Source)
   at java.awt.Container.doLayout(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validate(Unknown Source)
   at sun.plugin.util.GrayBoxPainter$2.run(Unknown Source)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
java.security.AccessControlException: access denied (java.io.FilePermission Fonts14.gif read)
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkRead(Unknown Source)
   at sun.awt.SunToolkit.getImageFromHash(Unknown Source)
   at sun.awt.SunToolkit.getImage(Unknown Source)
   at atp.d.a(Unknown Source)
   at atp.d.a(Unknown Source)
   at atp.cHotEqn.if(Unknown Source)
   at atp.cHotEqn.if(Unknown Source)
   at atp.cHotEqn.try(Unknown Source)
   at atp.cHotEqn.new(Unknown Source)
   at atp.cHotEqn.getPreferredSize(Unknown Source)
   at java.awt.GridLayout.preferredLayoutSize(Unknown Source)
   at java.awt.Container.preferredSize(Unknown Source)
   at java.awt.Container.getPreferredSize(Unknown Source)
   at javax.swing.JComponent.getPreferredSize(Unknown Source)
   at java.awt.BorderLayout.layoutContainer(Unknown Source)
   at java.awt.Container.layout(Unknown Source)
   at java.awt.Container.doLayout(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validateTree(Unknown Source)
   at java.awt.Container.validate(Unknown Source)
   at org.colos.ejs.library.LauncherApplet.captureWindow(Unknown Source)
   at users.ntnu.fkh.hydrogen_pkg.hydrogenSimulation.(hydrogenSimulation.java:21)
   at users.ntnu.fkh.hydrogen_pkg.hydrogen.(hydrogen.java:77)
   at users.ntnu.fkh.hydrogen_pkg.hydrogenApplet.init(hydrogenApplet.java:22)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Exception: java.security.AccessControlException: access denied (java.io.FilePermission Fonts14.gif read)
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on August 30, 2009, 01:03:55 am
Yes, something like that,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on August 30, 2009, 06:13:07 pm
I remove \lambda command inside TeX string and it is working fine now.

Adding \lambda work fine when run downloaded jar file locally (as application).
However, it was not able to read some font due to security reason when running as applet.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 01, 2009, 12:38:54 am
Thanks, I have uploaded the new version and it works fine.
You can check it on my page at
http://www.chem.elte.hu/Sandor.Nagy/NewClearGlossy/Java/Hubble_Hwang/index.html
However, I have a suggestion (maybe two):
I think, the "wavelength" formula (and Rydberg's constant) should be removed from the applet area. One reason is the problem with translation. The second is: it should be the reciprocal of the wavelength. The third is: you explain it correctly anyway. The fourth is: the applet would look better.
Best,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 01, 2009, 12:12:56 pm
Thank you for your suggestion.

Yes, there is a mistake for the forum in the applet. It has been modified according to your suggestion.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 01, 2009, 09:04:36 pm
I have uploaded the new version.
It works fine and it looks great.
Thanks for your help:
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 01, 2009, 09:20:25 pm
Sorry, I have just realized that the translation only works locally but not on the uploaded files.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 01, 2009, 11:46:58 pm
The translation should also work for files uploaded to your server.
Please reply and click "Upload new EJS jar file" next to the "spell check" button.
Select jar files you have download /translated and saved.
I will try to help you solve the problem, but I need those translated jar file.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 02, 2009, 04:11:23 am
Sorry to disturb you with my ignorance.
I am sending you the zipped packake,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 02, 2009, 11:29:51 am
I unpack your file and rename hydrogen_en.properties to hydrogen_hu.properties (I hope hu is the correct language code for your language)

If you download the jar again and run it. You will find magyar as one of item under GUI options->language

If the language code is correct, you should find the default in the above simulation.
For example: I also add hydrogen_zh.properties for chinese language. And the applet will load it automatically when I view it.

Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 02, 2009, 01:43:00 pm
I am sorry, but I am just not able to set "magyar" as the default language. If I open the jar directly or by the index.html or by the hydrogen.html, it is always the English version that comes out. If opened with the html files I cannot even change the language manually.
Can you please help me. The best would be if you changed the zipped package and sent it back to me because I am just not able to handle this.

Also when I did the translation from GUI, I opened the Help in the left lower corner. It explains the translation with nice pictures which I cannot see when I am doing the translation. I have no idea what I am doing wrong.
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: lookang on September 02, 2009, 02:37:23 pm
is your computer OS language in Hungarian?

http://www.um.es/fem/EjsWiki/Main/DeploymentLocalization
its user interface will appear in the default language of your operating system. You can switch to a different language by using the drawing panel’s popup menu GUI options ? Language option.

According to the http://www.um.es/fem/EjsWiki/Main/DeploymentLocalization the Ejs applet detects the language of the computer default language and display it as default.

Maybe you need to check your computer OS language.

For me, i can see only default english cos my computer is English OS, the other 2 language chinese (??????=0.00000 c ??????) and (hungary) Távolodási sebesség:  0.00000 c available as options to be chosen.

Hope this info helps ;D
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 02, 2009, 04:16:15 pm
Hi "lookang",
Thanks for trying to help me.
At home I have English operation system. At the university I have Hungarian. Some of my students may have German. In Hungary people use all kinds of operation systems (except, maybe, Chinese, but I am not sure :-). It does not mean that they command the language of the computer, but they all speak Hungarian. So I needed a solution, which is independent of the language of the OS, and makes sure that the language of the applet is Hungarian no matter what computer is used. Otherwise I have no idea how I am supposed to explain to the reader what they see on the applet surface because I don't know it either.
Sandor
PS: Going global is a hard thing.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: lookang on September 02, 2009, 07:15:33 pm
Maybe you need to contact ejs creator prof paco to enable setting of any language as default. Currently I only can see English as default.

I am glad more people are tapping on educator community to advance the teaching profession. Going global is the future in my view.
Keep it up man! You are on the right track.  ;D
 

 
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 02, 2009, 11:34:59 pm
The translation of string in applet is a feature of java itself.
As far as I understand: The language default is chosen when you install java in your O.S.
Because I have chinese OS so the default language is Chinese. And the language code for us is tw.
If xxxx_tw.properties is found, it will be used to translate all the string. Otherwise, no translation will be done.

The best way to do is you make the translation in the EJS and remove those properties files, since your students might use different OS and different language setting.

Because I was not able to recognize those character in your translated file, you need to do the translation by your self with your computer.
Please do the following steps:
1. You need to install EJS. (download either EJS4.1 (http://www.phy.ntnu.edu.tw/demolab/download/ejs/ejs4.1.zip) or EJS4.2  (http://www.phy.ntnu.edu.tw/demolab/download/ejs/ejs4.2.zip))
2. Unzip it to your computer. For example: C: or D:
3. Click the EjsConsole.jar in the EJS installed directory for example: c:ejs_4.1EjsConsole.jar to setup initial file (This only need to be done once)
3. Download the attached jar file.  ejs_hydrogen2.jar
4. Double click the jar file to run it. Right Click in the simulation region and select "Open EJS Model".
then The file will be opened in EJS (The tool I used to create the simulation).
5.  Click the View at the top to show the GUI elements as a tree.
6. Find all the slider elements, right click the slider element to show menu and select "properties" (the first one), a popup window will open and you will find string you need to translate (as "format" property)
7. Do all the translation and click green right triangle to compile the program. You will find new generated simulation. Check out if ererything is fine.
8. Right Click the button below previous green button, select package current simulation only.
And new jar file will be generate under export directory.  Double the file to run it.
Upload it to your server and change the name hydrogen to hydrogen2 in the html file.
(If you do not want to change the name in html file, you need to save the ejs source as hydrogen.xml before you recompile it).

If you can not do it. It seems that lookang can view the language code in your file.
May be he can help to do it for you.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 03, 2009, 03:36:17 am
Thank you,
I will try it tomorrow, upload it on Friday and let you know whether I succeeded.
Best,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 03, 2009, 04:37:58 pm
I have just tried to download EJS4.1 and  EJS4.2 but I got a message that the link is broken. I had no problem with downloading the attached ejs_hydrogen2.jar though.
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 03, 2009, 10:52:34 pm
I am sorry. I just upload those files to my server. Please download it again.
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 04, 2009, 04:33:40 am
Thanks, I have just downloaded it. I will try it out tomorrow.
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 05, 2009, 02:23:55 am
Thanks for the detailed instructions. It works locally now the way I wanted. I can only upload it on Monday because our system only allows that from IP addresses belonging to the university. I hope it would work from the server too.
Best,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 05, 2009, 11:46:16 am
Let me know if you have any problem with the uploaded EJS file on your server.

[hide]
You can check out(test) the web page version with file located at

 output/users/ntnu/fkh/hydrogen_Simulation.html file under ejs work space directory

Just open the above file with your browser.[/hide]
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: NagySandorIstvan on September 10, 2009, 12:47:21 am
Dear Prof. Hwang,
I have uploaded the file today. I have checked it both from the university and from home and it works perfectly. You can judge it for yourself:
http://www.chem.elte.hu/Sandor.Nagy/NewClearGlossy/Java/Hubble_Hwang/index.html
Last time I forgot to tell you something that I mentioned you in an earlier message.
I think that the distance values in the English version are to be understood not in "light years" but in "millions of light years" for the given redshift values. Please check it.
Thank you again for the  tremendous energy that you spent on helping me.
Very best regards,
Sandor
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: Fu-Kwun Hwang on September 10, 2009, 01:28:46 am
Thank you. The mistake has been corrected!
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: koclup1580 on December 29, 2012, 02:19:02 pm
good
Title: Re: Atomic Spectra of Hydrogen and red shift
Post by: diinxcom on December 14, 2014, 06:24:07 pm
[hide]jasa pembuatan website (http://diinx.com/produk-dan-layanan/jasa-pembuatan-website/) / jual genset (http://eragenset.com/) / jual genset (http://mdcs.co/)

[/hide]
Thanks for the help... It works!