Solving some simultaneous equations



Maxima's function "solve" is for either linear systems, or non-linear
systems of *polynomials*. Therefore, it cannot solve this problem.
I would proceed by plotting the functions:

(%i1) plot2d([x+4,3^x],[x,-5,2]);
(%o1)

(you might need some trial-and-error to find out the proper plotting
interval). Then you can compute the exact value of both roots using
find_root, as Ruper and David suggested already. Alternatively, the function
"newton" can be used:

(%i2) load(newton1);
(%o2)         /usr/share/maxima/5.24.0/share/numeric/newton1.mac
(%i3) newton(x+4-3^x,x,1,1e-6);
(%o3)                          1.561918766327553
(%i4) newton(x+4-3^x,x,-1,1e-6);
(%o4)                         - 3.987483564814142

You could even use multidimensional newton:

(%i5) load(mnewton);
(%o5)         /usr/share/maxima/5.24.0/share/contrib/mnewton.mac
(%i6) mnewton([y=x+4,y=3^x],[x,y],[1,1]);
(%o6)           [[x = 1.56191876632454, y = 5.56191876632454]]
(%i7) mnewton([y=x+4,y=3^x],[x,y],[-1,1]);
(%o7)         [[x = - 3.987483384115971, y = 0.012516615884029]]

Note, however, that there is a robust method to compute *all* the roots of a
function within a given interval (the function does not need to be a
polynomial - it works for any function.) That way, you won't need to bother
with computing each root individually (this can be very annoying if you need
to compute many roots, for example the roots of a Bessel function.)
I am planning to create a Maxima package providing this functionality soon.

2011/10/26 Daniel Dalton <daniel.dalton47 at gmail.com>

> Hello,
>
> I need to solve the following.
>
> 3^x=x+4
>
> My text book tells me to graph it and see where the graphs (y=x+4, and
> y=3^x) meet. Unfortunately, I'm blind and can't read very accurately off
> the graph, and thus am using maxima instead of the recommended devices
> by my school.
>
> I tried this:
> solve([y=x+4, y=3^x],[x,y]);
>
> Obtaining this:
>
> algsys: tried and failed to reduce system to a polynomial in one variable;
> give up.
>  -- an error. To debug this try: debugmode(true);
>
> Can anyone recommend a way I should solve this question with maxima?
>