<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Extracting the numerical value from a solve() Maxima command</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hi,<BR>
<BR>
This was my attempt to get Maxima to solve the following equation:<BR>
$base1^$power1maxima = $base2^$power2maxima<BR>
where $power1maxima and $power2maxima are linear equations and<BR>
$base1 and $base2 are constant values.<BR>
<BR>
Below is a snippet of part of my code:<BR>
<BR>
$solution = &cas('maxima',"float(solve(($power1maxima)*log($base1) = ($power2maxima)*log($base2),x))");<BR>
$solution =~ /(-?\d+(?:\.\d+)?)/;<BR>
$answer = $1;<BR>
<BR>
<BR>
Here are a couple of examples of some values:<BR>
<BR>
Example 1:<BR>
An equation it is trying to solve: (2 * x)*log(7) = (-7 * x - 7)*log(9)<BR>
$solution is [x = -.7980624185332027]<BR>
answer=7<BR>
<BR>
Example 2:<BR>
An equation it is trying to solve: (2x)log(4)=(?5x?8)log(3)<BR>
$solution is [x=?1063303930517583]<BR>
answer=?1063303930517583<BR>
<BR>
The answer for Example 2 should be -1.063303930517583.  If I double click on the values on the page I get the decimal point, otherwise if I highlight them which is what I did for Example 2, the decimal is missing, which is a separate issue.<BR>
<BR>
Example 2 also generates this error:<BR>
ERROR: Computer's answer is incorrect ("-1.063303930517583"). It is likely that the tolerance range [-1.06340393051758, -1.06320393051758] needs to be adjusted.<BR>
This error occurred while processing response 1_7 in part 0<BR>
<BR>
My tolerance range is 5%.<BR>
<BR>
I think it is my attempt at a regular expression is probably causing this problem.<BR>
<BR>
How do I extract the numerical value from a solve command in Maxima?<BR>
<BR>
<BR>
Thanks.</FONT>
</P>

</BODY>
</HTML>