| Author |
Message |
mikel12541
Joined: 17 Sep 2007 Posts: 4
|
Posted: September 17, 2007 6:29 PM Post subject: Programming problem |
|
|
I'm currently trying to write a physics program and I've run into a problem. I've gotten the calculator to request for variables and such but when I made equations and told the calculator to display the answers it doesn't simplify.
For example it would display the answer as
-2.*("4"-"2")
"3"^2
I want it to solve the equation.
Does anyone know what I need to do? |
|
| Back to top |
|
 |
pogo
Joined: 15 Sep 2007 Posts: 6
|
Posted: September 17, 2007 7:36 PM Post subject: |
|
|
Could you post the code you're using for this? It's hard to suggest solutions when we don't know how you're going about it.
Anyway, it looks like the numbers you are inputting are string values instead of numerical values (in other words the calculator thinks you want the symbol for "5" instead of the decimal value of 5). You're probably just using the wrong function, so let us know how you're requesting the input from the user and in what part of the program (is it in a Dialog box, on the regular program I/O screen, etc). |
|
| Back to top |
|
 |
mikel12541
Joined: 17 Sep 2007 Posts: 4
|
Posted: September 17, 2007 8:02 PM Post subject: |
|
|
I'm doing
:Request "enter a velocity",x1,0
:If x1=x1 Then
:Request "enter a distance",x2,0
:elsef x1=""
:Request "enter a distance",x2,0
:EndIF
:If x2=x2 Then
:request "enter a time",x3,0
:elself x2=""
:request "enter a time",x3,0
:endif
:if x3=x3 then
:request "initial velocity",x4,0
:elself x3=""
:request "initial velocity",x4,0
:Endif
:If x4=x4 then
:request "final velocity",x5,0
:elself x4=""
:request "final velocity",x5,0
:Endif
:If x5=x5 then
:request "acceleration",x6,0
:elself x5=""
:request "acceleration",x6,0
:endif
:if x1=x1 and x2=x2 and x3=x3 and x4="" and x5="" and x6="" then
: (2*x2-2*x3)/x3^2->x6 I put a space cause of emoticons
:2*x1-x2/x3->x5
: x2/x3->x4 I put a space because of emoticons
:Disp "initial velocity=",x4
:Pause
:Disp "final velocity=",x5
:pause
:Disp "acceleration=",x6
:Endif
:endprgm
I did all the stuff in the beginning so that it would prompt the user to put in information for the values and if one of the values was the one they wanted to solve for they just leave it blank and press enter. |
|
| Back to top |
|
 |
pogo
Joined: 15 Sep 2007 Posts: 6
|
Posted: September 18, 2007 3:44 AM Post subject: |
|
|
The Request function is your issue here. Request creates a string value for your variables, not a numerical value. Two ways to fix it:
1) Change all of your Request functions to Input functions. This will cause the input sections to be on the same window your answer shows up in (the program I/O screen), not in those nice little pop up windows.
2) If you want to keep the Request pop up windows, then after each variable input you need to put expr(x1)->x1 and change the variable, of course (-> is the STO> button just above the ON button, it's also listed in the catalog as a little arrow). This will change the user input into a numerical form.
I didn't have time to punch in your whole program to see if it all works out, but if not feel free to post again. |
|
| Back to top |
|
 |
mikel12541
Joined: 17 Sep 2007 Posts: 4
|
Posted: September 18, 2007 4:04 PM Post subject: |
|
|
Thanks now I have another question.
I'm now using this
:Input "enter a velocity",x1,
:If x1=x1 Then
:Input "enter a distance",x2,
:elsef x1=x
:Input "enter a distance",x2
:EndIF
:If x2=x2 Then
:input "enter a time",x3
:elself x2=x
:Input "enter a time",x3
:endif
:if x3=x3 then
:input "initial velocity",x4
:elself x3=x
:input "initial velocity",x4
:Endif
:If x4=x4 then
:input "final velocity",x5
:elself x4=x
:input "final velocity",x5
:Endif
:If x5=x5 then
:input "acceleration",x6
:elself x5=x
:input "acceleration",x6
:endif
:if x4=x and x5=x and x6=x then
: (2*x2-2*x3)/x3^2->x6 I put a space cause of emoticons
:2*x1-x2/x3->x5
: x2/x3->x4 I put a space because of emoticons
:Disp "initial velocity=",x4
:Pause
:Disp "final velocity=",x5
:pause
:Disp "acceleration=",x6
:Endif
:If x3=x and x5=x and x6=x then
:Delvar x3
:Delvar x5
:Delvar x6
:2*x1-x4->x5
2/x1->x3
2*x1)^2/x2->x6
:disp "time=",x3
:disp "final velocity=",x5
:disp "acceleration=",x6
:Endif
:endprgm
When I give the givens to the calculator for the second equation it says that the first equation didn't come out to either true or false. Would you be able to help me?
:endprgm |
|
| Back to top |
|
 |
pogo
Joined: 15 Sep 2007 Posts: 6
|
Posted: September 18, 2007 7:04 PM Post subject: |
|
|
Ok, well I'm not sure I'm quite understanding your problem at the moment, but try this. I typed up your program and I had to change 2 little things to get it to run. I guess try making these changes and see if it's doing what you want now. I'm doing this on a TI-89, so if you're using a different model then this might not be right for your calculator.
1) Put a Then statement after each of the 5 instances you use ElseIf, so that becomes
2) Remove the last 2 instances of EndIf. One is just below displaying acceleration and just above the line that has x3 x5 and x6. The other is the second to last line of the program, just before EndPrgm
If that doesn't help then I guess try restating the problem you're having and maybe give me some example inputs and what the appropriate output should be. |
|
| Back to top |
|
 |
mikel12541
Joined: 17 Sep 2007 Posts: 4
|
Posted: September 18, 2007 7:13 PM Post subject: |
|
|
| I'm using the ti 89 titanium. And is there a way to make it like If x1= all real numbers then... Because if there was a way to do that I think it would solve my problems. |
|
| Back to top |
|
 |
pogo
Joined: 15 Sep 2007 Posts: 6
|
Posted: September 19, 2007 3:23 PM Post subject: |
|
|
Well, I'm sure there is a way to do something like that, but that goes way over my head. You might have better luck at United-TI. They know what they're talking about and the forums are very active.
http://www.unitedti.org/
Sorry I wasn't more help. I'm sure those guys can answer your questions, though. |
|
| Back to top |
|
 |
mactay
Joined: 23 Feb 2008 Posts: 4
|
Posted: February 26, 2008 9:25 PM Post subject: help with the ti 78 titanium |
|
|
if at all possible help with the following, but don't want a graph
i need to know how to enter and arrive with the answer to systems of equations.
the answer for the following is: (4,5) but need to know how to enter.
4x-4y=-4
3x+4y= 32
if you can help with this i would be very grateful.
mactay |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
Saphic 1.5 // Theme created by Sopel
|
|