# Math Help - computer science problem

1. ## computer science problem

for my comp. sci. homework i need to create a function that takes the 2 following lines:

y=ax + bx^2 +c
y=ex+f

and find their intercepts. Im thinking i put the 2 equations equal to each other and solve for x. I get

x=sqrt((f-c)/b+a-e)

when i try this however its not right, my calculator is giving me a different answer. Any ideas? thanks!

2. Originally Posted by Evan.Kimia
for my comp. sci. homework i need to create a function that takes the 2 following lines:

y=ax + bx^2 +c
y=ex+f

and find their intercepts. Im thinking i put the 2 equations equal to each other and solve for x. I get

x=sqrt((f-c)/b+a-e)

when i try this however its not right, my calculator is giving me a different answer. Any ideas? thanks!
$ex + f = ax + bx^2 + c \Rightarrow bx^2 + (a - e)x + (c - f) = 0$.

The first thing your program needs to do is check the value of the discriminant of this quadratic equation for the given input values ....

3. i think i MIGHT of got it. I did what you said, and i did get the x value as if i solved it for a quadradic equation through a quadradic equation calculator. reason i did that is because i think my calculator might be on the fritz. I get my value for x, input it back into the program and get a y value. just for kicks, i do it in the other equation to see if i get the same value, and i do. Im thinking the program works, but my calculator is giving me different values. Could anyone just try graphing these 2 equations and tell me what they get for the 2 intercepts?
i used:
a=2
b=4
c=6
e=16
f=10

i get
(3.7656, 70.2490) and (-0.2656,5.7510)