Subject: pw.mac and assume_pos behavior/was assume_pos bug
From: Richard Hennessy
Date: Sat, 25 Oct 2008 03:19:22 -0400
Well, I used to like assume_pos, but I never loved it. Now I like is even less. I don't recommend using assume_pos with my pw.mac package if there is a range specification that ends or starts at zero, it will cause you headaches there.
For example
(%i1) load(pw);
Defining functions pw(L,x) and pwhelp().
'nn+xx partitions `sum
'nn+xx partitions `sum
'nn+xx partitions `sum
'nn+xx partitions `sum
'nn+xx partitions `sum
'nn+xx partitions `sum
(%o1) C:/Maxima-5.16.3/share/maxima/5.16.3/share/contrib/pw.mac
(%i2) a:0;
(%o2) 0
(%i3) assume_pos:true;
(%o3) true
(%i4) plot2d([pw([-inf,-1/(x-a), a, 1/(x-a), inf],x)], [x,-1,1], [plot_format, gnuplot])$ This will not plot right
(%i5) assume_pos:false;
(%o5) false
(%i6) plot2d([pw([-inf,-1/(x-a), a, 1/(x-a), inf],x)], [x,-1,1], [plot_format, gnuplot])$ This is okay
If a is nonzero then both plots are okay. Very strange. I may try to find a workaround to using assume_pos, since it is useful sometimes but not if you get wrong results.
Rich
----- Original Message -----
From: Stavros Macrakis
To: Richard Hennessy
Cc: Maxima List
Sent: Friday, October 24, 2008 10:15 PM
Subject: Re: [Maxima] assume_pos bug
On Fri, Oct 24, 2008 at 9:56 PM, Richard Hennessy <rvh2007 at comcast.net> wrote:
...It seems to me that assume_pos is a patch to "fix" a much deeper problem with Maxima's asksign. It is not a very good
one.
I absolutely agree that assume_pos is a terrible hack and very likely to cause problems. It would probably be a good idea to include some sort of warning in the documentation making that explicit.
You can get into trouble even if you read the documentation.
? The documentation seems pretty clear: assume_pos tells Maxima to assume that all unknown variables are positive. If this is a safe assumption, fine. If not, you will get into trouble. A simpler example along the same lines:
assume_pos: true$
ex: abs(x) => x
ex, x=-5 => -5
Oh, horrors! abs(x) can never be -5! But assume_pos:true asserts that x cannot be negative. Maxima relied on the assertion. Is that Maxima's fault or the user's?
-s