| Author |
Message |
cleonardo
Joined: 15 May 2010 Posts: 1
|
Posted: May 15, 2010 8:56 PM Post subject: How to program a numeric solver inside program |
|
|
Hi, this is my first post in this forum and need help with programming.
Say I have an equation with 3 variables, a=b*y for example, only one is unknown, which is either a, b or c. I use numeric solver and this easily solves for the unknown.
What I want to do is create a program which will ask the user for the name of the unknown variable in the equation. The equation will be inside the program of course. If user enters "b" as the unknown then the program solves the equation using the two other known variables supplied by user, a &c. How do I use solve() inside this program? |
|
| Back to top |
|
 |
treflip
Joined: 24 Nov 2009 Posts: 1
|
Posted: October 14, 2010 9:15 AM Post subject: Me too! |
|
|
Hey,
How's it going? I am doing the same thing! I can get you a little farther... but am stuck at displaying my results on the home screen!
Percent error is the experimental data minus the calculated data, divided by the calculated data, and then multiplied by 100.
I can make a request that asks for the experimental and then for the calculated. I wanted to use the function I already have to do the calculations, this program just helps with remembering what variable is what. Here's my code so far
Pererr()
Prgm
Local a,b,x
request "Your data",b
request "Calculated data",a
expr(a)->a
expr(b)->b
percerr(a,b)->x
text string(x)&"% Error"
Endprgm
The function is already wrote and I wanted to experiment with calling or subroutines but you can input the formula right into the prgm. Also I didn't want to jump to the PrgmIO screen because it's a hassle to press F5 to get back when doing calculations! What I'm saying is request stores variables as strings so you have to express them as numbers with the expr() function. but it displays a popup box right in the home screen.
Ideally, and I think you'd agree with me the answer would display directly into the home display, that way you could just carry on with your work. But I don't know how to do that right now. The last popup works for me and unless someone on hear can show me how to display results on the home screen then I won't worry about it now.
Just use the coding and put your information into the texts and operator areas and you should be good to go! |
|
| Back to top |
|
 |
boozee
Joined: 29 Aug 2010 Posts: 6
|
Posted: March 10, 2011 4:03 PM Post subject: |
|
|
| Do you still want a solution? |
|
| 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
|
|