Results 1 to 3 of 3

Thread: How to factorise a numeric expression using VB?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2005
    Posts
    1

    How to factorise a numeric expression using VB?

    I need to factorise an numeric expression using VB.And also to display the two possible values of the expression.
    Eg. x^2 +2x+1
    Thanks..

  2. #2
    Lively Member
    Join Date
    Aug 2005
    Posts
    77

    Re: How to factorise a numeric expression using VB?

    Found the roots of your expression.
    In your case x1=-1 and x2=-1.

    the factorsare are the negative values of the roots:
    -(-1) = 1

    Your factorised expression is (x+1)(x+1)

    Pieter

  3. #3
    New Member
    Join Date
    Apr 2005
    Posts
    10

    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
  •  



Click Here to Expand Forum to Full Width