On Feb 18, 2008 5:12 PM, Marco Carmosino <mogunus at gmail.com> wrote:
> Hello all. I am trying to find all points where two functions intersect,
> using maxima.
>
> These are my function definitions:
>
> (%i29) log2(x) := log(x)/log(2)
> (%i84) eq1 : y = 64*n*log2(n)$
> (%i85) eq2 : y = 8*n^2$
>
> When I use:
>
> solve([eq2,eq1],[n,y]);
>
> I get:
>
> `algsys' cannot solve - system too complicated.
> -- an error. To debug this try debugmode(true);
>
> I've tried using "pickapart" at levels 1, 2, and 3 on eq1, but I still get
> the same error message when I execute:
>
> solve([eq2,%],[n,y]);
>
> When I use find_root, with the same equation definitions, I get two
> different replies depending on whether I pick y or n as my variable:
>
> (%i99) find_root([eq2,eq1],y,1,100);
> Is n positive or negative?
>
> positive;
> Is n positive or negative?
>
> positive;
> 2 64 n log(n)
> (%o99) find_root([y = 8 n , y = -----------], y, 1.0, 100.0)
> log(2)
>
> I think I am responding to the "positive or negative" prompt wrong, but I
> couldn't find how to respond properly in the docs.
>
> (%i96) find_root([eq2,eq1],n,1,100);
> 2 64 n log(n)
> (%o96) find_root([y = 8 n , y = -----------], n, 1.0, 100.0)
> log(2)
>
> Sorry about the length of this, but I wanted to specify exactly what I
> tried. Thanks very much for any help.
What about the following?
(%i52) f(n):=8*n^2-64*n*log2(n);
(%o52) f(n):=8*n^2-64*n*log2(n)
(%i53) find_root(f(n),n,1,2);
(%o53) 1.099997030237609
(%i54) find_root(f(n),n,35,50);
(%o54) 43.55926043688165
Notice, Marco, that find_root only works with unidimentional
functions. By using substitution, one can get a unidimentional
function. Use plot2d to identify the intervals where the roots are
and, subsequently, use find_root.
Paul