draw3d and logx(xy)=true



El vie, 18-01-2013 a las 23:33 +0400, Dmitry Shkirmanov escribi?:
> Hello, list. I need to build a 3d graph in the logarithmic scale and
> with some condition, that crops the graph in the xy plane.
> Let me provide an simple example:
> 
> Maxima 5.29.1 http://maxima.sourceforge.net
> using Lisp SBCL 1.0.40.0.debian
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
> (%i1) load("draw");
> (%o1)            /usr/share/maxima/5.29.1/share/draw/draw.lisp
> (%i2) func(x,y):= if x^2+y^2<1000 then false else abs(x*y);
>                              2    2
> (%o2)      func(x, y) := if x  + y  < 1000 then false else abs(x y)
> (%i3) draw3d(
> xu_grid=50, 
> yv_grid=50,
> terminal = 'wxt,
> font= "Helvetica",
> color=yellow,
> logx=true,
> logy=true,
> logz=true,
> explicit(
> func(x,y),
> x,10, 100000,
> y,10,10000),
> 
> user_preamble="
> set pm3d at sb;
> set ticscale 1,0.5;
> set ytics offset 0;
> set palette rgbformulae 2,13,10;
> set xtics offset 0;
> set xlabel 'x';
> set title 'some expr';
> set mxtics 2;
> set size 1, 1;
> set mytics 2;
> set yrange [10:20000];
> set view 57, 244;
> set border 4095 front linetype -1;
> "
> );
> (%o3)                          [gr3d(explicit)]
> 
> It happens, that the density of grid lines on the surface is
> different. In the beginning of the axis the density is too low. In the
> end of the axis the density is too big.
> As a result maxima cuts off the square instead of circle. 
> So, is there any way to crop circle for provided example ?

Hello,

Draw always produce function samples in the linear scale. When you
select log scales with options logx, logy, and logz, Gnuplot applies the
transformation accordingly to these sample points before plotting them.

Once this transformation is applied, you have few samples near the
origin, and you see the square instead of the circle.

A possible work-around is to work directly in the log scale, something
like this:

mytics: setify(makelist ([concat("10^",i),i], i,1,5));
func(x,y):= if (10^x)^2+(10^y)^2<1000 then false else 10^(x+y);
draw3d(
    xlabel="log-x",
    ylabel="log-y",
    terminal = 'wxt,
    xu_grid=50, 
    yv_grid=50,
    font= "Helvetica",
    logz=true,
    xtics = mytics,
    ytics = mytics,
    explicit(
       func(Lx,Ly), Lx, 1, 5, Ly, 1, 5) );


--
Mario