1. Algebra problem
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 07, 2005
- 687 views
My high school algebra has deserted me Given the formula A^b + Cb = d how do I solve for 'b'? -- Derek Parnell Melbourne, Australia
2. Re: Algebra problem
- Posted by ags <eu at 531pi.co.nz> Jul 07, 2005
- 629 views
Derek Parnell wrote: > > My high school algebra has deserted me > > Given the formula > > A^b + Cb = d > > how do I solve for 'b'? Just pieced together from the web... could be quite wrong, sad eh? A^b + Cb = d -> log(A)b + Cb = d -> b(log(A) + C) = d ... b = d / (log(A) + C)) Gary
3. Re: Algebra problem
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 07, 2005
- 621 views
ags wrote: > > Just pieced together from the web... could be quite wrong, sad eh? > > A^b + Cb = d > > -> log(A)b + Cb = d > > -> b(log(A) + C) = d > > ... b = d / (log(A) + C)) Sorry but no prize. 5^2 = 25 log(5)2 = 1.39794 -- Derek Parnell Melbourne, Australia irc://irc.sorcery.net:9000/euphoria
4. Re: Algebra problem
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 07, 2005
- 624 views
Derek Parnell wrote: > My high school algebra has deserted me > > Given the formula > > A^b + Cb = d > > how do I solve for 'b'? Just for the sake of clarity, I assume you mean the same as: A^b + C*b = d , right? This is not simple, because b is not only exponent of A, but also factor of C. If we know the values of A, C, and d, we can go the following way: Change the equation to A^b = -C*b + d Plot the graphs of the two functions f(b) = A^b g(b) = -C*b + d The b values of all points where both graphs intersect are solutions of the original equation. ( Note: It is not actually necessary to plot 2 functions. We can also e.g. change the equation to A^b + C*b - d = 0 , then plot the function f(b) = A^b + C*b - d and look for the points where the function graph intersects with the x-axis. ) ----------------- Example for A = 2 C = 3 d = 5 The equation to solve is then (using x instead of b, because the program that I used for plotting only "knows" x): 2^x + 3*x = 5 The two functions are then f(x) = 2^x g(x) = -3*x + 5 On the plot at <http://home.arcor.de/luethje/temp/equ.jpg>, we see that there is one intersection at x = 1. I hope someone else knows a simpler and more general way ... Regards, Juergen PS: Rob, I wanted to upload the "attachment" to www.rapideuphoria.com (as you once have offered). But I forgot the name of the directory, where the file then is. Maybe you can add some short instructions to the page <http://www.rapideuphoria.com/cgi-bin/usercont.exu?dbId=new>?
5. Re: Algebra problem
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 07, 2005
- 608 views
ags wrote: > Derek Parnell wrote: >> >> My high school algebra has deserted me >> >> Given the formula >> >> A^b + Cb = d >> >> how do I solve for 'b'? > > Just pieced together from the web... could be quite wrong, sad eh? > > A^b + Cb = d > > -> log(A)b + Cb = d <snip> Sorry, this _is_ wrong. You must calculate the logarithms of both sides of the equation: -> log(A^b + Cb) = log(d) And now ...? Regards, Juergen
6. Re: Algebra problem
- Posted by Alexander Toresson <alexander.toresson at gmail.com> Jul 07, 2005
- 635 views
Derek Parnell wrote: > > My high school algebra has deserted me > > Given the formula > > A^b + Cb = d > > how do I solve for 'b'? > > -- > Derek Parnell > Melbourne, Australia > I dunno really if this is solvable. Anyway, here are my attempts: ----------------------- A^b + Cb = d log(A^b) = log(d - Cb) b * log(A) = log(d - Cb) log(b * log(A)) = log(log(d - Cb)) log(b) + log(log(A)) = log(log(d - Cb)) e^(log(b) + log(log(A))) = log(d - Cb) e^(e^(log(b) + log(log(A)))) = d - Cb e^(e^(log(b)) + e^(log(log(A)))) = d - Cb e^(b + log(A)) = d - Cb -------------------- A^b + Cb = d A^b = d - Cb -A^b + d = Cb (-A^b + d)/C = b log((-A^b + d)/C) = log(b) log(-A^b + d) - log(C) = log(b) -------------------- A^b + Cb = d A = (d - Cb)^(1/b) log(A) = log((d - Cb)^(1/b)) log(A) = (1/b) * log(d - Cb) log(A) * b = log(d - Cb) Regards, Alexander Toresson
7. Re: Algebra problem
- Posted by Erik-Jan van Kampen <e.vankampen at student.tudelft.nl> Jul 07, 2005
- 640 views
Derek Parnell wrote: > > My high school algebra has deserted me > > Given the formula > > A^b + Cb = d > > how do I solve for 'b'? > > -- > Derek Parnell > Melbourne, Australia > Hi Derek, From the Matlab 6.5 Symbolic Toolbox: >> solve(A^b+C*b-d,b) ans = -(lambertw(log(A)/C*exp(d*log(A)/C))*C-d*log(A))/log(A)/C >> help lambertw LAMBERTW Lambert's W function. W = LAMBERTW(X) is the solution to w*exp(w) = x. W = LAMBERTW(K,X) is the K-th branch of this multi-valued function. Reference: Robert M. Corless, G. H. Gonnet, D. E. G. Hare, D. J. Jeffrey, and D. E. Knuth, "On the Lambert W Function", Advances in Computational Mathematics, volume 5, 1996, pp. 329-359. Also available from: http://pineapple.apmaths.uwo.ca/~rmc/papers/LambertW/index.html Regards, Erik-Jan
8. Re: Algebra problem
- Posted by don cole <doncole at pacbell.net> Jul 07, 2005
- 696 views
Derek Parnell wrote: > > My high school algebra has deserted me > > Given the formula > > A^b + Cb = d > > how do I solve for 'b'? > > -- > Derek Parnell > Melbourne, Australia > Insufficient data to solve. Say for example b=1 then you have A+C=d A,C or d cannot be solved without knowing the value of A,C or d. You could say A=d-C or C=d-A or d=A+C But this really doesn't solve anything. don cole SF
9. Re: Algebra problem
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 07, 2005
- 758 views
Erik-Jan van Kampen wrote: > Derek Parnell wrote: > >> My high school algebra has deserted me >> >> Given the formula >> >> A^b + Cb = d >> >> how do I solve for 'b'? > > > Hi Derek, > > From the Matlab 6.5 Symbolic Toolbox: > >>> solve(A^b+C*b-d,b) > > ans = > > -(lambertw(log(A)/C*exp(d*log(A)/C))*C-d*log(A))/log(A)/C > >>> help lambertw > > LAMBERTW Lambert's W function. > W = LAMBERTW(X) is the solution to w*exp(w) = x. > W = LAMBERTW(K,X) is the K-th branch of this multi-valued function. > Reference: Robert M. Corless, G. H. Gonnet, D. E. G. Hare, > D. J. Jeffrey, and D. E. Knuth, "On the Lambert W Function", > Advances in Computational Mathematics, volume 5, 1996, pp. 329-359. > Also available from: > http://pineapple.apmaths.uwo.ca/~rmc/papers/LambertW/index.html Interesting! I just wrote a "brute force" lambertw() function in Euphoria, and calculated the example that I gave in my other post:
constant E = 2.718281828459045235 type nonnegative_atom (object x) if atom(x) then return x >= 0 end if return 0 end type function lambertw (nonnegative_atom x) for w = 0 to x by 0.001 do if w*power(E,w) >= x then return w end if end for return 0 end function atom A, C, d A = 2 C = 3 d = 5 ? -(lambertw(log(A)/C*power(E,d*log(A)/C))*C - d*log(A)) / log(A) / C
Prints 0.9986988627 -- the correct result is 1. Regards, Juergen
10. Re: Algebra problem
- Posted by Al Getz <Xaxo at aol.com> Jul 07, 2005
- 609 views
Hi there, This looked interesting so i entered two forms of the solution into my Scientific Calculator programmed in Euphoria of course :) My first thought was to simply use a numerical solver to try this, but then i decided to use the other solution also and compare results. For reference the calculator's built in solver has this simple syntax: x=Solve(LeftSide,RightSide,x,guess,max_iterations,errorlimit) where x is the var being solved for LeftSide is the left side of the equation (A^b+C*b) RightSide is the right side of the equation (D) (d made cap D for clarity) guess is the initial guess max_iterations is the max number of iter's to attempt to find the solution errorlimit is the desired max error of the value of x returned I entered these lines exactly like this: A=2 C=3 D=5 b1=Solve(A^b+C*b,D,b,1,100,1e-6) lambertw(X)=Solve(w*e^w,X,w,1,100,1e-6) b2=-(lambertw(ln(A)/C*e^(D*ln(A)/C))*C-D*ln(A))/ln(A)/C (i copy and pasted the right side of this last line assuming it was correct) then selected all six lines and hit "In Place Eval" and i got two answers...b1 is using the direct built in solver, and b2 is using the built in solver to calculate lambertw(X) to whatever precision the errorlimit is set to and then find the solution given in the previous post. Using the direct built in solver, b1=1 exactly (to 16 digits). Using the alternate solution, b2=0.999999673312148. From examining the alternate solution for other error limits, i could quickly see that the precision of the answer depended mostly on the error in calculating lambertw(X). If i decreased the error limit, i got a better answer. Actually i entered a second form for lambertw(X) also and got the same results as for the previous lambertw(X)...the higher the accuracy in calculating lambertw the better the final answer. I havent investigated the numerical stability of either method any further however, and one should keep in mind that functions like this can get quickly out of hand when dealing with the limit of 16 digits on most computers without additional numerical support. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
11. Re: Algebra problem
- Posted by ags <eu at 531pi.co.nz> Jul 07, 2005
- 628 views
- Last edited Jul 08, 2005
Derek Parnell wrote: > > ags wrote: > > > > > Just pieced together from the web... could be quite wrong, sad eh? > > > > A^b + Cb = d > > > > -> log(A)b + Cb = d > > > > -> b(log(A) + C) = d > > > > ... b = d / (log(A) + C)) > > Sorry but no prize. > > 5^2 = 25 > log(5)2 = 1.39794 > No wonder I failed Stage 1 Algebra Gary
12. Re: Algebra problem
- Posted by ags <eu at 531pi.co.nz> Jul 07, 2005
- 616 views
- Last edited Jul 08, 2005
Juergen Luethje wrote: > -> log(A^b + Cb) = log(d) > > And now ...? I try to remember for next time :) Gary
13. Re: Algebra problem
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 08, 2005
- 604 views
Erik-Jan van Kampen wrote: > > Derek Parnell wrote: > > > > My high school algebra has deserted me > > > > Given the formula > > > > A^b + Cb = d > > > > how do I solve for 'b'? > > > > -- > > Derek Parnell > > Melbourne, Australia > > > > Hi Derek, > > From the Matlab 6.5 Symbolic Toolbox: > > >> solve(A^b+C*b-d,b) > > ans = > > -(lambertw(log(A)/C*exp(d*log(A)/C))*C-d*log(A))/log(A)/C > Thanks. I thought it would be something simple like that ;-0 This solution also implies that 'A' must > 1 and 'C' must be > 0 otherwise there is no valid value for 'b'. For those curious about this formula, it is being used in project task estimations. Given an estimated duration and a confidence rating, I try to calculate reasonable minimum and maximum durations for the task. For example, if a task has had 12 days work already expended and the project manager estimates with 75% confidence that there is another 5 days to go, I'm calculating what are the optimistic and pessimistic durations for the task. Other variables include how experienced (skillful) the manager is in estimating things. The formula above is one of the trickier ones involved. I have been using spreadsheets to help record and calculate things but once projects get above a certain size or complexity, I need another tool. MS-Project falls short in a number of areas too. -- Derek Parnell Melbourne, Australia
14. Re: Algebra problem
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 08, 2005
- 620 views
Derek Parnell wrote: > Erik-Jan van Kampen wrote: > >> Derek Parnell wrote: >>> >>> My high school algebra has deserted me >>> >>> Given the formula >>> >>> A^b + Cb = d >>> >>> how do I solve for 'b'? >>> >>> -- >>> Derek Parnell >>> Melbourne, Australia >>> >> >> Hi Derek, >> >> From the Matlab 6.5 Symbolic Toolbox: >> >>>> solve(A^b+C*b-d,b) >> >> ans = >> >> -(lambertw(log(A)/C*exp(d*log(A)/C))*C-d*log(A))/log(A)/C >> > > Thanks. I thought it would be something simple like that ;-0 > > This solution also implies that 'A' must > 1 and 'C' must be > 0 > otherwise there is no valid value for 'b'. No generally. A must not be = 1, but it can be < 1, e.g. for A = 0.6 C = 3 d = 5 there are the two solutions: b1 = 1.512753283 b2 = -6.184691234
sequence s atom A, C, d, b A = 0.6 C = 3 d = 5 s = {1.512753283, -6.184691234} -- check results for i = 1 to length(s) do b = s[i] printf(1, "%f^%f + %f*%f = %f (expected: %f)\n", {A,b,C,b,power(A,b)+C*b,d}) end for
Also e.g. A = 2 C = -3 d = 5 works for me. Not only positive arguments are allowed for the lambertw() function -- although I made this restriction in my "quick and dirty" Eu implementation yesterday. I'm very sorry if that might have given you a wrong idea. The function lambertw(x) doesn't have a real value for x < -1/e, and it apparently has two values when x is in the interval [-1/e, 0[ (see http://mathworld.wolfram.com/LambertW-Function.html). > For those curious about this formula, it is being used in project task > estimations. [snipped interesting explanation] Regards, Juergen