Solving some simultaneous equations



On 10/26/2011 10:35 AM, Daniel Dalton wrote:
> I need to solve the following.
>
> 3^x=x+4
Hi Dan,
here is one more answer to add up to the ones you've already received.

That is an example of a transcendental equation which, as others have 
pointed out,
can only be solved approximately, using some numerical method. Perhaps 
the simplest
method is that of recursion, which consists of writing the equation in 
the form x=f(x).
In your case, x = 3^x -4. You guess any initial value for x (we will try 
x0=1) and you then
substitute that value in f(x) to find x1 and so on. In Maxima that would be:

(%i1) eq: float(3^x-4)$
(%i2) x:1;
(%o2)                           1
(%i3) x:ev(eq);
(%o3)                         - 1.0
(%i4) x:ev(eq);
(%o4)                  - 3.666666666666667
(%i5) x:ev(eq);
(%o5)                  - 3.982194449749291
(%i6) x:ev(eq);
(%o6)                  - 3.987410444764546
(%i7) x:ev(eq);
(%o7)                  - 3.987482381093471
(%i8) x:ev(eq);
(%o8)                  - 3.987483370323493

which converges to the solution. The problem with this method is that it 
will only converge to
a solution if that solution is an "attractive fixed point". It might 
diverge, or converge to a
particular solution which is not the one you are looking for, but since 
it is so easy, it is always
worth trying it first.

In your example, there is actually a second solution. It can be found 
like this: instead of solving
for x on the right-hand side of

3^x=x+4

solve for x on the left hand: x = log(x+4)/log(3) and repat the same method:

(%i9) remvalue(x)$
(%i10) eq: float(log(x+4)/log(3))$
(%i11) x: 1;
(%o11)                          1
(%i12) x:ev(eq);
(%o12)                  1.464973520717927
(%i13) x:ev(eq);
(%o13)                  1.545913234256127
(%i14) x:ev(eq);
(%o14)                  1.559295594995721
(%i15) x:ev(eq);
(%o15)                  1.561489368345442
(%i16) x:ev(eq);
(%o16)                  1.561848490222131
(%i17) x:ev(eq);
(%o17)                  1.561907265173242
(%i18) x:ev(eq);
(%o18)                  1.561916884094625
(%i19) x:ev(eq);
(%o19)                  1.561918458286997

Regards,
Jaime