chaos
I got this calculator for math class.
Posts: 4
|
Post by chaos on Apr 14, 2005 15:10:38 GMT -5
I am trying to write a TI -89 program for my composite structures class, and I am having problems. I want to be able to enter a number for how many layers in the composite and have the program take that number and ask for the angle of each layer. Example: (Prompt)"enter number of layers" (I enter 4). (Prompts) "enter A1" "enter A2" "enter A3" "enter A4" or if I only wanted 2 layers it would only prompt for A1 and A2. Does this make sense?
My second problem is I need to store every iteration of a 'for loop' so I can use them later in the program. Can anyone help me with this?
|
|
|
Post by Vladik on Apr 14, 2005 16:16:07 GMT -5
Well, for the prompts, I would do this:
:Input "Number Of Layers:",layers :{}->A (Makes a new list for A1, A2, and so on) :For f,1,layers (loops for the number of layers) :"Enter A"&string(f)&":"->enter (creates a prompt that says "Enter A_" where _ is the loop number (f) :Input enter,atemp :atemp->A[dim(A)+1] (stores the data to the end of the list 'A' :EndFor
You would get a list called "A"...
You could easily do the same with the Dialog command.
For your second question:
:{[First Iteration Here}->A :For f,2,100 :[Insert Operation Here. Refer to another iteration by doing this: A[iteration you want]]->A(dim(A)+1) :EndFor
|
|
|
Post by Vladik on Apr 14, 2005 16:16:23 GMT -5
Hope this helps.
|
|
|
Post by Pure on Apr 14, 2005 18:06:55 GMT -5
ditto. That worked on my 89 titanium
|
|
chaos
I got this calculator for math class.
Posts: 4
|
Post by chaos on Apr 15, 2005 11:26:38 GMT -5
Thanks, I will give it a try and let you know if it works. ;D
|
|
|
Post by Pure on Apr 15, 2005 17:01:43 GMT -5
okay!
|
|
|
Post by Vladik on Apr 16, 2005 13:18:27 GMT -5
So, did it work out for you?
|
|
chaos
I got this calculator for math class.
Posts: 4
|
Post by chaos on Apr 21, 2005 14:10:18 GMT -5
The program does succesfully create a list the number layers I choose, but now I need to create a For loop that will take the list and use the first value for the first iteration and the second value of the list for the second value and so on.
Below is part of my code. I want to loop this from 1 to n times, with n being the number of layers, but I need the increment for Theta to change based upon the inputs from the list. Meaning I choose 3 for the number of layers, the program then prompts for Theta1, Theta2, and Theta3. I put in 45, 0, 90 respectivly or whatever angles I need it to be. Now the for loop runs 3 times with theta in code below replaced with 45 for the first iteration 0 for the second iteration and 90 for the third iteration.
25. h1+h2*cos(2*theta)+h3*cos(4*theta)--> qbar11 26. h1-h2*cos(2*theta)+h3*cos(4*theta)-->qbar22 27. h4-h3*cos(4*theta)-->qbar12 28. h5-h3*cos(4*theta)-->qbar66 29. (h2*sin(2*theta)+h3*sin(4*)theta)/2-->qbar16 30. (h2*sin(2*theta)-h3*sin(4*theta)/2-->qbar26 31. [[qbar11,qbar12,qbar16][ qbar12,qbar22,qbar26][ qbar16,qbar26,qbar66]]-->Qbarmatrix 32. Disp Qbarmatrix 33. EndPrgm
I also need each Qbarmatrix to be stored as Qbarmatrix1 for the first iteration, Qbarmatrix2 for the second iteration and so on depending on the number of layers because I need to multiply each Qbarmatrix by a different factors and then sum all the Qbarmatrixes together to get the final answer.
Can this be done?
|
|
|
Post by bfr on Apr 21, 2005 15:29:03 GMT -5
I'm not competely sure what you're trying to say, but does this help?
For(A,1,3 Qbarmatrix->listname(A) EndFor sum(listname->C Disp C
Then you can just operate on the individual values in the list. Vladik might understand what you are saying.....
|
|
|
Post by Pure on Apr 21, 2005 19:48:09 GMT -5
What he's doing is converting the Matrix to alist and re-storing it to a different var...
|
|
chaos
I got this calculator for math class.
Posts: 4
|
Post by chaos on Apr 22, 2005 13:24:40 GMT -5
I fixed my previous post. Hopefully it makes more sense now.
|
|
|
Post by Pure on Apr 22, 2005 13:46:10 GMT -5
it does...how did bfr's code do?
|
|
|
Post by Vladik on Apr 28, 2005 20:21:44 GMT -5
The program does succesfully create a list the number layers I choose, but now I need to create a For loop that will take the list and use the first value for the first iteration and the second value of the list for the second value and so on. Below is part of my code. I want to loop this from 1 to n times, with n being the number of layers, but I need the increment for Theta to change based upon the inputs from the list. Meaning I choose 3 for the number of layers, the program then prompts for Theta1, Theta2, and Theta3. I put in 45, 0, 90 respectivly or whatever angles I need it to be. Now the for loop runs 3 times with theta in code below replaced with 45 for the first iteration 0 for the second iteration and 90 for the third iteration. 25. h1+h2*cos(2*theta)+h3*cos(4*theta)--> qbar11 26. h1-h2*cos(2*theta)+h3*cos(4*theta)-->qbar22 27. h4-h3*cos(4*theta)-->qbar12 28. h5-h3*cos(4*theta)-->qbar66 29. (h2*sin(2*theta)+h3*sin(4*)theta)/2-->qbar16 30. (h2*sin(2*theta)-h3*sin(4*theta)/2-->qbar26 31. [[qbar11,qbar12,qbar16][ qbar12,qbar22,qbar26][ qbar16,qbar26,qbar66]]-->Qbarmatrix 32. Disp Qbarmatrix 33. EndPrgm I also need each Qbarmatrix to be stored as Qbarmatrix1 for the first iteration, Qbarmatrix2 for the second iteration and so on depending on the number of layers because I need to multiply each Qbarmatrix by a different factors and then sum all the Qbarmatrixes together to get the final answer. Can this be done? The Qbarmatrices would take up your entire RAM!
|
|
|
Post by Vladik on Jun 2, 2005 21:59:59 GMT -5
Um... hello?
Chaos, are you here?
|
|
|
Post by bfr on Jun 3, 2005 15:16:54 GMT -5
Oh, I understand what he's trying to do. It is impossible on the TI-86, but it might work on the TI-89....
|
|
|
Post by Vladik on Jun 12, 2005 15:39:23 GMT -5
It will work on the TI-89 and it is impossible on the 86.
|
|