Re: Variable Assignment

*To*: mathgroup at smc.vnet.net*Subject*: [mg14012] Re: [mg14007] Variable Assignment*From*: BobHanlon at aol.com*Date*: Mon, 14 Sep 1998 02:57:54 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Clear[x]; x = x /. FindRoot[Exp[x] == x^2, {x, -0.5}] -0.7034674295409823 Exp[x] - x^2 -1.339360800045596*^-8 Clear[x]; x = x /. Solve[Exp[x] == x^2, {x}] InverseFunction::ifun: Warning: Inverse functions are being used. Values may be lost for multivalued inverses. InverseFunction::ifun: Warning: Inverse functions are being used. Values may be lost for multivalued inverses. Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found. {-2*ProductLog[-1/2], -2*ProductLog[1/2]} % // N {1.588047264689378 - 1.540223501020758*I, -0.7034674224983916} If you are only interested in real solutions: x = Select[x, Im[#] == 0&] {-2*ProductLog[1/2]} x = x[[1]] -2*ProductLog[1/2] Exp[x] - x^2 // FullSimplify 0 ?ProductLog ProductLog[z] gives the principal solution for w in z = w e^w. ProductLog[k, z] gives the kth solution. Bob Hanlon In a message dated 9/13/98 3:18:11 AM, wax at waxer.com wrote: >FindRoot[Exp[x] == x^2, {x, -0.5}] > >{x --> -0.703467} > >How do I assign the result [-0.7033467] to a variable?