OKlibrary  0.2.1.6
Basic.dem
Go to the documentation of this file.
00001 /* Oliver Kullmann, 29.7.2007 (Swansea) */
00002 /* Copyright 2007, 2008 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00022 if oklib_test_demos then
00023  if oklib_test_demos_level < 2 then return()$
00024 
00025 oklib_include("OKlib/ComputerAlgebra/Satisfiability/Lisp/BranchingTuples/Basic.mac")$
00026 
00027 "The chi-function for branching tuple [1,2]:"$
00028 chi([1,2],x);
00029 
00030 "Various tau-values:"$
00031 tau_eps([1,2],0.1);
00032 tau_eps([1,2],0.01);
00033 tau_eps([1.0,2],0.1);
00034 tau_eps([1.0,2],0.01);
00035 tau([1,2]);
00036 taun(1,2);
00037 taun(1,2,3);
00038 tau2(1,2);
00039 tau3(1,2,3);
00040 
00041 "Probability distributions associated with branching tuples via the tau-function:"$
00042 tauprob([5,5,5,5]);
00043 tauprobn(1,1,1);
00044 tauprob3(11,11,11);
00045 tauprob2(1,2);
00046 
00047 "Plots of the tau2-function (with different plotting devices; you might rotate the plots a bit (left-click) while waiting for the following computations, or resize them (double-click)):"$
00048 plot3d(tau2, [x,0.5,2], [y,0.5,2]);
00049 plot3d(tau2, [x,0.5,2], [y,0.5,2], [gnuplot_pm3d, true]);
00050 
00051 "More balanced branching tuples have a smaller tau-value:"$
00052 tau_preamble: "set pm3d at s; unset surface; set contour; set cntrparam levels 15; unset key";
00053 plot3d(tau2, [x,1,3], [y,1,3], [grid, 50, 50], [gnuplot_pm3d, true], [gnuplot_preamble, tau_preamble])$
00054 
00055 /* does not work
00056 load(draw);
00057 draw3d(explicit(tau2(x,y), x,0.5,2, y,0.5,2), grid=true, enhanced3d=true, contour=base);
00058 scene1 : gr3d(explicit(taun(x,y), x,0.5,2, y,0.5,2));
00059 scene2 : gr3d(explicit(taun(1,1)+ Dtau(1,1) . ([x,y] - [1,1]), x,0.5,2, y,0.5,2));
00060 draw(scene1, scene2);
00061 */
00062 
00063 "Function chi2 is not convex (nor concave):"$
00064 t0 : [0.5, 0.5];
00065 d0 : [0.6, 0.6];
00066 a0 : 1.1;
00067 b0 : 0.5;
00068 eigen_chi2(0.5, 0.5, 1.1);
00069 chi_line_dom();
00070 plot2d(chi_line, [x,-0.199, 4]);
00071