|
From: Kyle Andrews on 25 Jun 2008 20:08 Hi everyone, I have saved a somewhat time consuming but trivial integral into a variable 'H'. This integral takes two temperatures (T1,T2) and 4 heat capacity variables (A,B,C,D). Is there any way I could set this up so I could just pass a list containing values for these variables (T1 T2 A B C D) to the calculator and have it automatically Assign all the variables? If not, would it be simple enough to turn this into a function that takes these variables? If it is really easy, could you post some sample code that would get me on my way? Thanks a bunch!
From: Toby on 25 Jun 2008 22:03 On Jun 25, 8:08 pm, Kyle Andrews <Kyle.C.Andr...(a)gmail.com> wrote: > Hi everyone, > > I have saved a somewhat time consuming but trivial integral into a > variable 'H'. This integral takes two temperatures (T1,T2) and 4 heat > capacity variables (A,B,C,D). Is there any way I could set this up so > I could just pass a list containing values for these variables (T1 T2 > A B C D) to the calculator and have it automatically Assign all the > variables? > > If not, would it be simple enough to turn this into a function that > takes these variables? If it is really easy, could you post some > sample code that would get me on my way? > > Thanks a bunch! {t1 t2 a b c d} {T1 T2 A B C D} STO
From: mnhollinger on 25 Jun 2008 23:07 On Jun 25, 8:08 pm, Kyle Andrews <Kyle.C.Andr...(a)gmail.com> wrote: > Hi everyone, > > I have saved a somewhat time consuming but trivial integral into a > variable 'H'. This integral takes two temperatures (T1,T2) and 4 heat > capacity variables (A,B,C,D). Is there any way I could set this up so > I could just pass a list containing values for these variables (T1 T2 > A B C D) to the calculator and have it automatically Assign all the > variables? > > If not, would it be simple enough to turn this into a function that > takes these variables? If it is really easy, could you post some > sample code that would get me on my way? > > Thanks a bunch! Kyle, I like using a local variable structure when a lot of variables are involved. Put your variables in a list on stack level 1 and then decompose the list and store the values into local variables. 1: {1 2 3 4 5 6} << LIST-> @decompose list DROP @remove number of objects in list -> t1 t2 a b c d @store values in local variables << @your program goes here>> >> Mark
From: mnhollinger on 25 Jun 2008 23:35 On Jun 25, 11:07 pm, mnhollin...(a)yahoo.com wrote: > On Jun 25, 8:08 pm, Kyle Andrews <Kyle.C.Andr...(a)gmail.com> wrote: > > > Hi everyone, > > > I have saved a somewhat time consuming but trivial integral into a > > variable 'H'. This integral takes two temperatures (T1,T2) and 4 heat > > capacity variables (A,B,C,D). Is there any way I could set this up so > > I could just pass a list containing values for these variables (T1 T2 > > A B C D) to the calculator and have it automatically Assign all the > > variables? > > > If not, would it be simple enough to turn this into a function that > > takes these variables? If it is really easy, could you post some > > sample code that would get me on my way? > > > Thanks a bunch! > > Kyle, > > I like using a local variable structure when a lot of variables are > involved. > Put your variables in a list on stack level 1 and then decompose the > list and store the values into local variables. > 1: {1 2 3 4 5 6} > << LIST-> @decompose list > DROP @remove number of objects in list > -> t1 t2 a b c d @store values in local variables > << @your program goes here>> > > > > Mark Don't forget the closing right delimeters. I put them in this web form but they didn't appear. I see some of the other guys use /<< instead of << when posting. Maybe << means something in HTML(?) and it cuts them from the end of the post. By convention, the local variable names use lower case letters.
From: Virgil on 26 Jun 2008 03:53 In article <442a3f92-eb47-4bdb-a62f-5a5baa5f3074(a)8g2000hse.googlegroups.com>, mnhollinger(a)yahoo.com wrote: > On Jun 25, 8:08�pm, Kyle Andrews <Kyle.C.Andr...(a)gmail.com> wrote: > > Hi everyone, > > > > I have saved a somewhat time consuming but trivial integral into a > > variable 'H'. This integral takes two temperatures (T1,T2) and 4 heat > > capacity variables (A,B,C,D). Is there any way I could set this up so > > I could just pass a list containing values for these variables (T1 T2 > > A B C D) to the calculator and have it automatically Assign all the > > variables? > > > > If not, would it be simple enough to turn this into a function that > > takes these variables? If it is really easy, could you post some > > sample code that would get me on my way? > > > > Thanks a bunch! > > Kyle, > > I like using a local variable structure when a lot of variables are > involved. > Put your variables in a list on stack level 1 and then decompose the > list and store the values into local variables. > 1: {1 2 3 4 5 6} > << LIST-> @decompose list > DROP @remove number of objects in list > -> t1 t2 a b c d @store values in local variables > << @your program goes here>> Quicker than LIST-> DROP , is EVAL. When EVAL is used on a list, it merely strips off the list delimiters and puts the listed objects on the stack, which is what LIST-> DROP does..
|
Next
|
Last
Pages: 1 2 Prev: FEM48/49 v5.3 SR6 released Next: A lecture about the HP28 and the Saturn processor |