Math prog

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
floogle11
Veteran
Posts: 71
Joined: Sat May 02, 2009 7:08 pm
Location: Zorgon planet
Contact:

Math prog

Post by floogle11 » Wed Nov 03, 2010 4:10 pm

Hey guys i hate this one problem and i wanna program a program to do the work for me and i cant think of how to start.

Problem is like this:
(x + 1)(x + 6)(x - 4)
or like:
(2x + 3)(x - 4)(3x * 4)
And i want to the numbers as variables.
Go to my Qbsite its: Trueqb.webs.com
Or if you play nazi zombies go to www.Nazizombys.com and register for cheats, hints, and strategys.

esdel
Newbie
Posts: 4
Joined: Wed Nov 17, 2010 8:05 am

Post by esdel » Wed Feb 23, 2011 9:51 am

How to start is think about this

When you multiply your three ( ) together you get what's called a cubic
like x^3 + Ax^2 + Bx + C

So work out A,B,C and you have your answer

If you actually mean ( )( )( ) = 0 you have a cubic equation and the formula for finding x is in Google

User avatar
Kiyotewolf
Veteran
Posts: 96
Joined: Tue Apr 01, 2008 11:38 pm

Post by Kiyotewolf » Sun Apr 03, 2011 7:12 pm

If you want it to rewrite your formula into it's other forms, then you're going to have to write a formula parser, something that can take the text of the expression you're writing, and be able to re-write it using rules of algebra.

If you want it to solve the expression for answers, you can use a FOR NEXT loop and give it ranges of integers, or decimal values, and watch for answers which are zero, or close to zero.



~Kiyote!

a = (x * x)(y * y)(z * z)
~~~ if you want to solve something like in this form, you're going to have to look for numbers that make a become zero.

It would be easier to start off visualizing the program, by just drawing points on the screen.

Feed it values going in, and plot values coming out.

If you get past 3 variables, you're going to have a a hard time visualizing it, because you'll have passed 3 dimensions.
Banana phone! We need more lemon pledge. * exploding fist of iced tea! * I see your psycho cat and counter with a duck that has a broken leg, in a cast.

Post Reply