Solving Equations With logs



Marco Carmosino a ?crit :
> Thanks very much, numeric solutions are fine and find_root works great 
> for two equations. However, I'm having trouble solving where I just want 
> to set my equation equal to a constant:
> 
> (%i50) find_root(log2(n)=10^6, n, 0, 10^60);
>                                      log(n)
> (%o50)           find_root(------ = 1000000, n, 0.0, 1.0E+60)
>                                       log(2)
> 
> A numeric approximation to the solution of equations of the form log2(n) 
> = 10^6 would also be fine. I have also tried:
> 
> (%i52) solve(log2(n)=10^6,n);
> 
> This produces a very, very long string of numbers.
Sure !
The only solution is 2^(10^6), a number which has about 300000 decimal 
digits ! And of course find_root cannot find it, since it is not in the 
interval [0,10^60]. Another reason is that find_root must be given an 
interval such that your function (difference of two sides of the 
equation) takes values of opposite signs at its ends. But when n is 0, 
what is the sign of log2(n) ? If you try the interval [1,10^(10^6)] then 
you get an overflow because of the right hand side.
If you try more reasonable values, you find a solution :
find_root(log2(n)=10^2, n, 1, 10^60);
correctly gives a numerical solution around 10^30.

Eric
> 
> Some background: I'd like to be able to automate comparing the running 
> time of algorithms to each other, for different times T, so I can sort a 
> table of them.
> 
> Thanks
> 
> --Marco
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima