So I have been at work with a bunch of programs to do physic's, calculus, and electrical engineering problems for me, and I had a good start, as I made programs for chapters 1-7 so far in calculus 8th edition book... stuff for physics such as Culoumbs (how the hell ya spell that again? Razz) law, electrical field strength, friction problems, and i could go on and on with the stuff I've made recently.. I am now working on a triangle solver program.. I know there are plenty of these out there already, but I like making programs, and I thought I would give it a try.

Here's what I have so far:


Code:

:0->A
:0->B
:0->C
:0->D
:0->E
:0->F
:0->G
:ClrHome
:ClrDraw
:AxesOff
:Line(-6,-6,6,-6
:Line(6,-6,6,6
:Line(-6,-6,6,6
:Text(3,3,"IINPUT ANY THREE
:Text(11,3,"THEN PRS ENTER
:Text(52,45,"1
:Text(28,77,"2
:Text(25,40,"3
:Text(42,70,"4
:Text(42,33,"5
:Text(17,70,"6
:Lbl 1
:Repeat K=/0
:Getkey->k
:End
:If K=21
:Then goto 2
:End
:If K=92
:Then
:Input "SIDE",A
:Text(52,45,A
:Goto 1
:End
:If K=93
:Then
:Input "SIDE",B
:Text(28,77,B
:Goto 1
:End
:If K=94
:Then
:Input "SIDE",C
:Text(25,40,C
:Goto 1
:End
:If K=82
:Then
:Input "ANGLE",D
:Text(42,70,D
:Goto 1
:End
:If K=83
:Then
:Input "ANGLE",E
:Text(42,33,E
:Goto 1
:End
:If K=84
:Then
:Input "ANGLE",F
:Text(17,70,F
:Goto 1
:End
:Lbl 2
:



That is all I have so far... What I need your guys' help with, Is figuring out (not necessarily the calculations, because I know how to do the sin,cos, tan, and all their inverses to find the sides/angles) but I need help with knowing how to get to the calculations. It's hard to explain, but I know hat I mean in my head lol Razz
I guess what I mean is, you would have to do different equations depending on what sides/angles are put in. The only way I can think of setting that up which is completelllllyyy unpractical would be doing an If/then statement for all possibilities...
ie; ABC, ABD,ABE,ABF,ACD,ACE, ACF,ADE,ADF and so on... (A,B,C are sides and D,E,F are angles)
What do I do? Sad
I believe Weregoose has made a triangle solving program before, so you may want to ask him. Smile
Some optimizations:

Code:
:0->A
:0->B
:0->C
:0->D
:0->E
:0->F
:0->G

can be

Code:
Delvar ADelvarBDelvar CDelvar DDelvar EDelvar FDelvarG

And the Goto1 should be Goto 1 .
In fact, the:

Code:
:0->A
:0->B
:0->C
:0->D
:0->E
:0->F
:0->G
:ClrHome

Can be:

Code:
Delvar ADelvarBDelvar CDelvar DDelvar EDelvar FDelvar GClrHome
Got it.
What should I do about "I guess what I mean is, you would have to do different equations depending on what sides/angles are put in. The only way I can think of setting that up which is completelllllyyy unpractical would be doing an If/then statement for all possibilities...
ie; ABC, ABD,ABE,ABF,ACD,ACE, ACF,ADE,ADF and so on... (A,B,C are sides and D,E,F are angles)"
All those Inputs and Gotos are definitely super-redundant; there's absolutely a better way to do that. For one thing, entering numbers on the graphscreen is not that fun. If I wanted to do something really cool, I'd suggest using the DCS GUI libraries for a cool six-input window, but I don't know how you'd feel about that, since it's a bit complex.
Let's say I have a list L1 containing 5 and 8 as the two knowns and 0 as the unknown, and I want to write a function that replaces the non-given by an operation done between the two given. 3! = 6 different ways of inputting L1 are to be expected, so rather than write six sections of code, I should write one that adapts itself to the ordering.

sum() is easy, but how do I know where to place it? If I take the not() of L1, then I get all 0's except a 1 where the unknown value was. I multiply this by the sum() of the original L1, and then add that to the original L1. Regardless of order, the three numbers—5, 8, and 13—should all be present.

prod() is a little harder. If 0 is in the list, then the product will always be 0; if I can change that 0 to a 1, then the problem goes away. Easy: I just add L1 to not(L1), which lets me prod() the known values (times 1). I then store that away in the same fashion as the sum() from earlier.

Where things get especially tricky is when I want to find, say, the angle element from one list that is not opposite the given side from another list. It's fun/torture to try to wrap your head around these types of problems, and I speak from experience!
Wow... my brain hurts... Smile
I'm glad i just got my Motorola Xoom (Tablet) cause I'm just going to lay in bed and read this over and over til it makes a little bit of sense. It's not your fault though, great explanation, just it's so new I've got to get it in my brain lol.
Do you think it's possible to take all the variables (ABC,ABD,ABE,ABF etc) and Karnaugh map them to get a simplified expression, in which I could use the simplified expression to do separate If/thens? Idk, I'm talking out of my butt lol, I'll keep looking into your logic. Thanks goose, you've helped me with a lot so far Smile
KermMartian wrote:
... If I wanted to do something really cool, I'd suggest using the DCS GUI libraries for a cool six-input window...


Product placement, much Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement