From: Robert D. <rob...@us...> - 2009-07-23 04:29:54
|
Update of /cvsroot/maxima/maxima/tests In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32560/tests Modified Files: rtest8.mac rtest_plot.mac Log Message: * src/plot.lisp: (1) cut out %enumer flag, and put less reliance on the numer flag and more on the float(...) function; the effect is to postpone some floatification until after evaluation. This is an attempt to get sensible output for stuff like plot2d(x^(1/3), ...) which has caused trouble on various occasions (2) when the function to be plotted is a Lisp function, wrap it (instead of calling directly) so that translated functions act same as untranslated * tests/rtest8.mac: move some tests for COERCE-FLOAT-FUN from test/rtest_plot.mac to here * tests/rtest_plot.mac: (1) remove some tests for COERCE-FLOAT-FUN (2) write .eps outputs to maxima_tempdir (3) other minor revisions Index: rtest8.mac =================================================================== RCS file: /cvsroot/maxima/maxima/tests/rtest8.mac,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- rtest8.mac 7 Jun 2009 17:25:53 -0000 1.20 +++ rtest8.mac 23 Jul 2009 04:29:46 -0000 1.21 @@ -465,6 +465,34 @@ find_root (g = 0, a, 0, 1)); 0.3978613590133817; +/* from mailing list 2009-02-18 + * "Re: [Maxima] I want to tell maxima (-1)^0.33333333333333=-1, what should i do?" + * see also tests/rtest_plot + */ + +(foo17(x):=(sqrt(-16*x^4-16*x^3+20*x^2+12*x+23)/(6*sqrt(3))+(16*x^3-12*x^2-6*x-25)/54)^(1/3), + float_approx_equal_tolerance : 1e-12, + 0); +0; + +first (quad_qags (foo17 (u), u, -1, 0)); +- 0.359753467469551; + +first (quad_qags (foo17, u, -1, 0)); +- 0.359753467469551; + +find_root (foo17 (u) = -0.2, u, -1, 0); +- 0.246809031968399; + +(bar17 (u) := foo17 (u) + 0.2, find_root (bar17, u, -1, 0)); +- 0.246809031968399; + +(compile (foo17), first (quad_qags (foo17, u, -1, 0))); +- 0.359753467469551; + +find_root (bar17, u, -1, 0); +- 0.246809031968399; + reset (float_approx_equal_tolerance); [float_approx_equal_tolerance]; Index: rtest_plot.mac =================================================================== RCS file: /cvsroot/maxima/maxima/tests/rtest_plot.mac,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- rtest_plot.mac 24 Jun 2009 13:36:37 -0000 1.3 +++ rtest_plot.mac 23 Jul 2009 04:29:46 -0000 1.4 @@ -1,4 +1,14 @@ -/* execute this script via demo(...) */ +/* execute this script + * + * (1) wait for user between examples: + * demo ("tests/rtest_plot.mac"); + * + * (2) or noninteractively: + * batch ("tests/rtest_plot.mac"); + * + * Maxima waits for the user to close the Openmath window + * before proceeding, but otherwise it just blazes through. + */ /* Examples copied from plot2d documentation */ @@ -50,7 +60,7 @@ "To save a plot ..." $ -plot2d (sin(x), [x, 0, 2*%pi], [psfile, "sin.eps"])$ +plot2d (sin(x), [x, 0, 2*%pi], [psfile, concat (maxima_tempdir, "/sin.eps")])$ "The next example uses the y option ..." $ @@ -72,7 +82,7 @@ '{/Symbol p}' 3.1415,'3{/Symbol p}/2' 4.712, '2{/Symbol p}' \ 6.283)"$ plot2d ([cos(x), sin(x), tan(x)], [x, -2*%pi, 2*%pi], - [y, -2, 2], [gnuplot_preamble, my_preamble], [psfile, "trig.eps"]); + [y, -2, 2], [gnuplot_preamble, my_preamble], [psfile, concat (maxima_tempdir, "/trig.eps")]); /* Examples copied from plot3d documentation */ @@ -298,31 +308,17 @@ /* from mailing list 2009-02-18 * "Re: [Maxima] I want to tell maxima (-1)^0.33333333333333=-1, what should i do?" - * This is entirely a problem in COERCE-FLOAT-FUN, hence the quad_qags and find_root here. */ -foo(x):=(sqrt(-16*x^4-16*x^3+20*x^2+12*x+23)/(6*sqrt(3))+(16*x^3-12*x^2-6*x-25)/54)^(1/3)$ - -plot2d (foo (u), [u, -1, 0]); - -plot2d (foo, [u, -1, 0]); - -quad_qags (foo (u), u, -1, 0); - -quad_qags (foo, u, -1, 0); - -find_root (foo (u) = -0.2, u, -1, 0); - -bar (u) := foo (u) + 0.2; -find_root (bar, u, -1, 0); +foo29(x):=(sqrt(-16*x^4-16*x^3+20*x^2+12*x+23)/(6*sqrt(3))+(16*x^3-12*x^2-6*x-25)/54)^(1/3)$ -compile (foo); +plot2d (foo29 (u), [u, -1, 0]); -plot2d (foo, [u, -1, 0]); +plot2d (foo29, [u, -1, 0]); -quad_qags (foo, u, -1, 0); +compile (foo29); -find_root (bar, u, -1, 0); +plot2d (foo29, [u, -1, 0]); "FINIS" $ |