|
-
Aug 25th, 2005, 08:23 AM
#3
New Member
Re: How to factorise a numeric expression using VB?
I think what Mo's getting at though is what's the algorithm.
If all the equations to be solved are quadratics as per the example, it's dead simple.
The equation is y= ax^2 + bx + c and then
x1= (-b + (b^2 - 4ac)^.5) / 2a
x2= (-b - (b^2 - 4ac)^.5) / 2a
Simple code will do that arithmetic.
First you should have the code do 2 things...
1) check for a=0 since the equation is then a straight line not a parabola and it's illegal to divide by the 2a if a=0
2) check if the square root term b^2 - 4ac is <0, because if it is there is no real square root and the curve does not cut the x axis.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|