#754 MIN is not correct (problem with "is" function)

closed
nobody
Lisp Core (471)
5
2012-12-04
2005-06-14
joe532
No

I have the following problem with MIN : the graph of min
below does not match the min of the curves on the second
graph.

session:
f(h,k,l):=(h^k)*((1/h)*k*(1+l)+(d-k)*2*l);
g(h,k,l):=2*d*l+(h^k)*((1/h)*k*(1-l)-(d-k)*2*l); d:2; l:0.5;
plot2d([f((1-v)^(1/2),2,l), f((1-v),1,l), g(v^(1/2),2,l), g(v,1,l)],
[v,0,1])$
plot2d(min(f((1-v)^(1/2),2,l), f((1-v),1,l), g(v^(1/2),2,l), g(v,1,l)),
[v,0,1])$

on maxima
Maxima 5.9.1 http://maxima.sourceforge.net
Using Lisp GNU Common Lisp (GCL) GCL 2.6.6 (aka
GCL)
Distributed under the GNU Public License. See the file
COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function
bug_report()
provides bug reporting information.

Discussion

  • Robert Dodier

    Robert Dodier - 2005-06-14
    • labels: --> Lisp Core
    • summary: MIN is not correct --> MIN is not correct (problem with "is" function)
     
  • Robert Dodier

    Robert Dodier - 2005-06-14

    Logged In: YES
    user_id=501686

    OK, I've narrowed the problem.

    aa: f((1-v)^(1/2),2,l);
    bb: f((1-v),1,l);
    cc: g(v^(1/2),2,l);
    dd: g(v,1,l);

    min (aa, bb, cc, dd) => min((0.5/v-1.0)*v+2.0,
    3.0*sqrt(1-v))

    OK, that's min (aa, dd). As for bb and dd, bb is equal to dd:

    ratsimp (bb - dd) => 0

    What about cc ?

    is (cc > aa) => undecided (OK)
    is (cc > bb) => undecided (OK)
    is (cc > dd) => true (OOPS, should be undecided)
    is (cc > dd) => undecided (OK, but why is it different
    from first time?)

    trace (ratsimp), then is(cc > aa), is(cc > bb), is(cc > dd),
    shows ratsimp is called once by "is". On the second is(cc >
    dd), ratsimp is called twice by "is"; seems like the problem
    could be in "is".

    Given that bb is equal to dd, this is a work around:

    plot2d (min (aa, bb, cc), [v, 0, 1]);

     
  • Robert Dodier

    Robert Dodier - 2006-08-12
    • milestone: --> To_be_reviewed
     
  • Robert Dodier

    Robert Dodier - 2006-08-12

    Logged In: YES
    user_id=501686

    Not observed in 5.9.3cvs / Clisp 2.38, GCL 2.6.7, SBCL 0.9.9
    on Linux. Seems likely that recent modifications to min/max
    have fixed this. Marking this report to be retested on
    Windows -- if it does not appear there, we can close this
    report as fixed.

    For the record the following plot2d puts the 3 curves of
    interest together with the min of those 3 on one plot.
    Should find that the computed min coincides with whichever
    curve is lowest.

    f(h,k,l):=(h^k)*((1/h)*k*(1+l)+(d-k)*2*l);
    g(h,k,l):=2*d*l+(h^k)*((1/h)*k*(1-l)-(d-k)*2*l);
    d:2;
    l:0.5;

    plot2d([f((1-v)^(1/2),2,l), f((1-v),1,l), g(v^(1/2),2,l),
    g(v,1,l), min(f((1-v)^(1/2),2,l), f((1-v),1,l),
    g(v^(1/2),2,l), g(v,1,l))],
    [v,0,1])$

     
  • Dan Gildea

    Dan Gildea - 2008-05-25
    • status: open --> pending
     
  • SourceForge Robot

    • status: pending --> closed
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks