# [Maxima] how to solve if some variable is constant

=?big5?B?tsAguM62rw==?= bear.tw at hotmail.com
Sat Oct 10 13:10:21 CDT 2009

```how to solve if some variable is constant
we have
Q is a angle of sector
r is a radius of sector
S is a arc length of sector
A is a area of sector

question : if the value of A = the value of S, solve r=?
that is clearly, r=2.
A=S
1/2Sr=S
so, r=2

I try to do  in maxima
A:1/2*S*r;
solve([A=S,r]);
solve([1/2*S*r=S,r]);

(%o13) (r*S)/2
(%o14) [[S=0,r=0]]
(%o15) [[S=0,r=0]]

> From: maxima-request at math.utexas.edu
> Subject: Maxima Digest, Vol 39, Issue 30
> To: maxima at math.utexas.edu
> Date: Sat, 10 Oct 2009 12:00:05 -0500
>
> Send Maxima mailing list submissions to
> 	maxima at math.utexas.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://www.math.utexas.edu/mailman/listinfo/maxima
> or, via email, send a message with subject or body 'help' to
> 	maxima-request at math.utexas.edu
>
> You can reach the person managing the list at
> 	maxima-owner at math.utexas.edu
>
> than "Re: Contents of Maxima digest..."
>
>
> Today's Topics:
>
>    1. Further code to improve the assume database (Dieter Kaiser)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 10 Oct 2009 17:43:53 +0200
> From: Dieter Kaiser <drdieterkaiser at web.de>
> Subject: [Maxima] Further code to improve the assume database
> To: "maxima at math.utexas.edu" <maxima at math.utexas.edu>
> Message-ID: <1255189433.3499.2.camel at dieter-laptop>
> Content-Type: text/plain
>
> We have the known bug ID: 1045920 "a>1 and b>1, is a+b>2?"
>
> (%i2) assume(a>1,b>1);
> (%o2) [a > 1,b > 1]
>
> (%i3) sign(a+b-2);
> (%o3) pnz
>
> I have a routine sign-shift which will correct this result:
>
> (%o4) "sign-shift.lisp"
>
> (%i5) sign(a+b-2);
> (%o5) pos
>
> It will work for a lot of more cases too:
>
> (%i8) assume(a > 1,b > 1,c > 2)\$
>
> (%i2) is(b+a > 2)
> (%o2) true
>
> (%i4) is(b+2*a > 3)
> (%o4) true
>
> (%i6) is(c^2+b+2*a > 7)
> (%o6) true
>
> It works for negative bounds too:
>
> (%i8) assume(x < -1,y < -2,z < -2)\$
>
> (%i10) is(y+x < -3)
> (%o10) true
>
> (%i12) is(y+2*x < -4)
> (%o12) true
>
> z^2 is positive and the following sign is unknown:
>
> (%i14) is(z^2+y+2*x < -7)
> (%o14) unknown
>
> z^3 is negative and the test will give true again:
>
> (%i16) is(z^3+y+2*x < -12)
> (%o16) true
>
> I have no problems with the testsuite and the share_testsuite with the
> exception of one example:
>
> ********************** Problem 40 ***************
> Input:
> fourier_elim(fourier_elim(eqs, [y, x, z]), [z, y, x])
>
>
> Result:
> [0 < z, z < min(4, - y - x + 4), 0 < y, y < 1, 0 < x, x < 1]
>
> This differed from the expected result:
> [0 < z, z < 4 - x - y, 0 < y, y < 1, 0 < x, x < 1]
>
> 124/125 tests passed (not counting 5 expected errors).
>
>
> I know nothing about the code of fourier_elim. My question is, if the
> new result is really an error or if we can accept it. Perhaps
> fourier_elim can be improved to take advantage of the extended
> functionality of \$sign?
>
> This is the code of sign-shift:
>
> (defun sign-shift (expr)
>   (do ((l (append (cdr (facts1 '\$learndata)) (cdr (facts1 \$context)))
> (cdr l))
>        (e expr)
>        (flag) (fact) (num))
>       ((null l) (if flag (\$expand e) expr))
>     (setq fact (car l))
>     (when (eq (caar fact) 'mgreaterp)
>       ;; Do we have something like a>2 or a<-1 on the list of facts?
>       (cond ((and (symbolp (cadr fact))
>                   (not (\$freeof (cadr fact) e))
>                   (not (member (cadr fact) '(\$%pi \$%e \$%gamma \$%phi)))
>                   (mnump (setq num (caddr fact)))
>                   (not (zerop1 num)))
>              (setq flag t)
>              (if (mminusp num) (setq num (mul -1 num)))
> fact) e)))
>                   (not (\$freeof (caddr fact) e))
>                   (not (member (caddr fact) '(\$%pi \$%e \$%gamma \$%phi)))
>                   (mnump (setq num (cadr fact)))
>                   (not (zerop1 num)))
>              (setq flag t)
>              (if (mminusp num) (setq num (mul -1 num)))
>              (setq e (maxima-substitute
>
>
> The routine sign-shift has to be called in the routine signsum in
> compar.lisp:
>
> (defun signsum (x)
>   (setq x (sign-shift x))
>   ;; x might be simplified to an atom in sign-shift
>   (when (atom x) (setq x (cons '(mplus) (list x))))
>
>
> Dieter Kaiser
>
>
>
> ------------------------------
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
> End of Maxima Digest, Vol 39, Issue 30
> **************************************

_________________________________________________________________
ÀH¨­ªº Windows Live Messenger ©M Hotmail¡A¤£­­®É¦a´x´¤¸ê°TºÉ¦b«ü¶¡ ¡X Windows Live for Mobile
http://3c.msn.com.tw/mobile/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20091011/8980165d/attachment-0001.htm
```