Re: how to display the value of w after using do?
- To: mathgroup at smc.vnet.net
- Subject: [mg111007] Re: how to display the value of w after using do?
- From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
- Date: Fri, 16 Jul 2010 06:59:20 -0400 (EDT)
Hi, a Do Loop never returns anything as long as you don't use return. You can find this information in the "MORE INFORMATION" section of the help of Do. However, the assignment of w[n][k] is done. Just check what ?w gives. If you want to "see" the values of your assignment explicitely, you could just use a Table: n = 5; Table[w[n][k] = Exp[z0[n][k]^2] Sqrt[ Pi] 2^(n - 1) n!/(n HermiteH[n - 1, z0[n][k]])^2, {k, n}] Hope this helps, Cheers Patrick On Fri, 2010-07-16 at 05:15 -0400, ynzhang at mech.uwa.edu.au wrote: > > Dear Sir/Madam, > > I am a beginner of Mathematica. > I just wrote a Notebook(nb) in Mathematica to in order to obtain the > Gauss-Hermite weights as follows: > > n = 5; > Do[w[n][k] = Exp[z0[n][k]^2] Sqrt[Pi] 2^(n - 1) n! / > (n HermiteH[n - 1, z0[n][k]])^2, {k, n}]; > I press shift & Enter to Evalutate. The results come out with only > > In[1]:= Do[w[n][k] = Exp[z0[n][k]^2] Sqrt[Pi] 2^(n - 1) n! / > (n HermiteH[n - 1, z0[n][k]])^2, {k, n}]; > > without Out[1].So I dont know if w comes out or not at last . If so, > there should be a row or column vector shown in Out[1]. > > > Thank you very much! I am looking forward to hearing from you soon! > > Regards, > Yanni >