Hi all.

I am trying to program an application to draw graphs. I am currently trying to graph a formula in the form 2^(ax) + bx + c. Basically I want the user to be able to specify 2 points on the graph in the 1rst quadrant( one of which must be a point where x is 0 ), and a value for b, and I work out an exponential graph that intersects those 2 points. I'm stuck in needing to rewrite the equation to solve for a. Sorry if my explanation isn't well written, but its been awhile since my last math lesson

Lets say the points the user enters are :
(0, Y1), (X2, Y2)

I can get c by :

y(0) = 2^(0) + b(0) + c
Y1 = c + 1

c = Y1 - 1

but now I need to rewrite y(x) = 2^(ax) + bx + c in terms of a, such that y(0) = Y1 and y(X2) = Y2. ie, I need 'a' to be alone on the LHS, and the RHS to only consist of b, c, X2, Y1, and Y2, and intersect the 2 points.

I tried to solve this awhile ago, and somehow arrived at :
a = logbase2( Y1 + Y2 - bX2 - 2c - 1 )/X2
which turns out to be wrong, since for as Y1 approaches Y2 I end up trying to find the log of a negative number...

Any help on getting a correct equation would be appreciated.

Thanks.