|
From: Jaime V. <vi...@fe...> - 2026-03-05 10:41:06
|
Hello Barton, Very nice solution. I have a couple of comments: 1. If one uses radcan right after %o10, me can see the "naive" solution x=-2/3 (%o10) %union([x = -(log(49/25)/log(343/125))]) (%i11) radcan(%); (%o11) %union([x = -(2/3)]) 2. I wish we also had an "equation_convert" that would transform the original equation (eq1) into another equation (eq3) that %solve can solve right away, like this: (%i1) eq1: 5^(3*x+2) = 7^(3*x+2)$ (%i2) eq3: lhs(eq1)/rhs(eq1)=1$ (%i3) load(to_poly_solve)$ (%i4) %solve(eq3,x); (%o4) %union([x = (2*%i*%pi*%z802+log(25/49))/log(343/125)]) Regards, Jaime On 3/3/26 22:54, Barton Willis via Maxima-discuss wrote: > Here is my solution—I'll look at your solution in a bit. To try this > for yourself, you'll need a recent version of function_convert > <https://github.com/barton-willis/function_convert> > > (%i1) load(function_convert)$ > > Define a converter that standardizes the base of an exponential to > %e. The repeated "^" = standardize_base looks weird --- the second > is an alias for the first: > > (%i2) register_converter("^" = standardize_base, "^" = > standardize_base, lambda([a,b], exp(b*log(a)))); > (%o2) done > > Standardize the base to %e: > > (%i3) eq1: 5^(3*x+2) = 7^(3*x+2)$ > > (%i4) eq2 : function_convert("^" = standardize_base, eq1); > (eq2) %e^(log(5)*(3*x+2))=%e^(log(7)*(3*x+2)) > > And solve with to_poly_solve: > > (%i5) load(to_poly_solve)$ > > (%i8) sol : %solve(eq2,x); > (sol) %union([x=-((2*%i*%pi*%z927+log(49/25))/log(343/125))]) > > Reset the pesky counter to zero: > > (%i9) sol : nicedummies(sol); > (sol) %union([x=-((2*%i*%pi*%z0+log(49/25))/log(343/125))]) > > Let's find a real solution --- we need to use carbon-based computing > (our brains) to see that we need to set %z0 to zero: > > (%i10) solX : subst(%z0=0,sol); > (solX) %union([x=-(log(49/25)/log(343/125))]) > > Let's check --- always check: > > (%i11) subst(first(solX),eq1); > (%o11) 5^(2-(3*log(49/25))/log(343/125))=7^(2-(3*log(49/25))/log(343/125)) > > (%i12) radcan(%); > (%o12) 1=1 > > There are light-weight methods to standardize the base to %e, using > function_convert isn't needed. Something like subst("^" = > lambda([a,b], exp(b*log(a)), xxx)) will work. > > Maybe I will find a new syntax for register_converter that allows the > alias to be optional. Also, for now , the third argument to > register_converter must be a Maxima lambda form. I think I can insert > a few lines of code and allow the last argument to be a Maxima > function. Maybe I'll try to do that too. > > --Barton > > > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |