On Thu, Jan 12, 2023 at 07:15:01PM +0100, Pieter van Oostrum wrote:
> I saw a math olympiad problem:
>
> solve 27^x = 1/x
>
> The solution is rather simple, although not completely trivial.
> Solution: x = 1/3.
>
> I tried to solve this with fricas, but it can't fins a solution.
>
> (1) -> solve(27^x = 1/x, x)
>
> (1) []
> Type: List(Equation(Expression(Integer)))
>
> On my iPad I tried it with PocketCAS (based of giac), and it does find a slution, although not an exact one.
>
> solve(27^x = 1/x, x)
> ->[exp(-LambertW(ln(27)))]
> which is correct, but it calculates it approximately 0.3333333333
>
> Is there a way to get this result in Fricas, preferably exact?
ATM FriCAS can not solve such an equation. As a general comment
let me say that FriCAS focuses on general methods which scale
resonably well. Also, while FriCAS documentaion says that
"variables" by default are real, in fact FriCAS solution methods
work mostly in complex domain. In complex domain equations like
you gave have infinite number of solutions. In this case, 'lambertW'
is multivalued and in fact represents infinite set of solutions
(probably all). As noted, 'lambertW' solution is exact. You can
use FriCAS to verify this. Namely, note that the equation is
equivalent to
x*exp(log(27)*x) = 1
Now plug in 'exp(-lambertW(a))' inside:
(3) -> exp(-lambertW(log(27)))*exp(log(27)*exp(-lambertW(log(27))))
(3) 1
Type: Expression(Integer)
We got 1, so this is true equality. In fact, this is more general,
'exp(-lambertW(a))' solves 'x*exp(a*x) = 1'. FriCAS can not check
this directy, but there is general 'lambertW' indentity:
exp(-lambertW(a)) = 1/exp(lambertW(a)) = lambertW(a)/a
If we plug in this into equation we get:
(9) -> (lambertW(a)/a)*exp(a*(lambertW(a)/a))
(9) 1
Type: Expression(Integer)
Coming back to original equation, if you seek for rational solutions,
for this equation solution can be easily obtained by factorization.
However, in general factorization is prohibitively expensive.
--
Waldek Hebisch