Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Solving equations using DBP

Author
Message
Robin
23
Years of Service
User Offline
Joined: 22nd Feb 2003
Location: United Kingdom
Posted: 4th Dec 2003 14:37
hi all
i'm currently doing a-level maths, and am interested in how i can combine db and the things i learn in class. one thing which struck me was, is it possible to solve equations using db?, or any programming language come to that. take the following simultaneus equations:
5x+2y=25 and 2x+7y=41
(x=3 and y=5)
is there a way how you can write a program to solve such equations?
ie. could you do something to rearrange the equation to solve it?
the only way i can think of is a very inefficient way, which is as follows:



all i'm doing is a for next loop, checking the numbers from -10 to 10 for x and y, and it does work. this obviously wouldn't work for the majority of equations, as i'm only checking the integers and only within a certain range. i suppose i could increase the range and set the step to something like 0.01 or 0.001. this increases the probability of it finding the correct answers, but that takes absolutely ages to finish as there are millions of different combinations. and you could also get irrational numbers, which wouldn't work either.
sorry if i'm not making any sense or not seeing something, but i just want to know if it is possible to do it any other way

is there?

http://www.thegameszone.tk
[email protected]
Jess T
Retired Moderator
22
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 4th Dec 2003 15:33
All you have to do is work it out in single little steps.

Here's a function I just whipped up that will evaluate those and any other simultaneous equation:


Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2026-07-26 20:16:33
Your offset time is: 2026-07-26 20:16:33