Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'Problem with calling procedure/Function' topicStudent Support Forum > General > "Problem with calling procedure/Function"

Next Comment >Help | Reply To Topic
Author Comment/Response
08/22/08 8:49pm

Hi all,

I construct a procedure as

'In[]:=' pstheoT[T_, T0_, ρ0_, anf_, μ2_, Q2_] := Module[{ps}, "different commands related to T,T0,ρ0,anf,μ2,Q2"; ps = PG1]

Then I set parameters
'In[]:=' {T02, ρ02, anf2, μ22, Q22} = {443,1.5,1.4,0.82,4.28};

Now I call the procedure/Function for single input value, T=340, and receive correct results as:
'In[3]:=' pstheoT[340, T02, ρ02, anf2, μ22, Q22]
'Out[3]=' 0.0442688

The problem for me is that it is impossible to calculate for a list. I have tried as:
'In[]:=' tprho[[All, 8]] = pstheoT[tprho[[All, 1]], T02, ρ02, anf2, μ22, Q22];
or other tried:
'In[]:=' Do[tprho[[i, 8]] = pstheoT[tprho[[i, 1]], T02, ρ02, anf2, μ22, Q22], {i,Length[tprho[[All, 1]]]}]

Where tprho[[All,1]]={300,310,320,330,340,350,360,370,380,390}.

I received a totally wrong results in tprho[[All,8]]. The result tprho[[5,8]] based on tprho[[5,1]]=340 are different from the calculation of single input at T=340 (In[3]).

Could you please tell me how to solve the problem?


URL: ,

Subject (listing for 'Problem with calling procedure/Function')
Author Date Posted
Problem with calling procedure/Function ngocanh 08/22/08 8:49pm
Re: Problem with calling procedure/Function Xavier 09/29/08 08:01am
Next Comment >Help | Reply To Topic