[genius] Thu Oct 14 23:08:30 2021 Jiri (George) Lebl <jirka 5z com>



commit b35b9fce0d56db107cce554028b25e83c01c3829
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Thu Oct 14 23:08:33 2021 -0500

    Thu Oct 14 23:08:30 2021  Jiri (George) Lebl <jirka 5z com>
    
            * src/graphing.c: fix off by one in the computing of the graphing
              subintervals for surface plots
    
            * examples/zoom-differentiability.gel: wait for a moment at the
              start, and a slightly different nondifferentiable function

 ChangeLog                           |  8 ++++++++
 examples/zoom-differentiability.gel |  8 +++++---
 src/graphing.c                      | 14 +++++++-------
 3 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f398db23..001bbbb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Oct 14 23:08:30 2021  Jiri (George) Lebl <jirka 5z com>
+
+       * src/graphing.c: fix off by one in the computing of the graphing
+         subintervals for surface plots
+       
+       * examples/zoom-differentiability.gel: wait for a moment at the
+         start, and a slightly different nondifferentiable function
+
 Thu Oct 14 19:07:05 2021  Jiri (George) Lebl <jirka 5z com>
 
        * src/graphing.c: improve slightly again efficiency, and make
diff --git a/examples/zoom-differentiability.gel b/examples/zoom-differentiability.gel
index fb3e5111..ca38469a 100644
--- a/examples/zoom-differentiability.gel
+++ b/examples/zoom-differentiability.gel
@@ -11,13 +11,15 @@ SurfacePlotDrawLegends = false;
 SurfacePlotVariableNames = ["x","y","z"];
 
 if the_answer == 1 then (
-     for n=1 to 100 do (
-        SurfacePlot(`(x,y)=if x!=0.0 or y!=0.0 then (y^3)/(x^2+y^2)+0.2*x^2-0.3*y^2 else 
0.0,(0.95^n)*[-5,5,-5,5,-5,5]);
+     for n=1 to 200 do (
+        SurfacePlot(`(x,y)=if x!=0.0 or y!=0.0 then (y^3)/(x^2+y^2)+0.4*sin(2*x)^2-0.3*atan(y) else 
0.0,(0.95^n)*[-5,5,-5,5,-5,5]);
+        if (n==1) then wait(2);
         wait(0.02);
     )
 ) else if the_answer == 2 then (
-    for n=1 to 100 do (
+    for n=1 to 200 do (
         SurfacePlot(`(x,y)=0.4*x+0.3*y+0.2*x^2-0.3*y^2,(0.95^n)*[-5,5,-5,5,-5,5]);
+        if (n==1) then wait(2);
         wait(0.02);
     )
 )
diff --git a/src/graphing.c b/src/graphing.c
index 5970329b..ad9ed2ef 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -4805,19 +4805,19 @@ recompute_surface_function (gboolean fitting)
        if (surface_data_x != NULL) g_free (surface_data_x);
        if (surface_data_y != NULL) g_free (surface_data_y);
        if (surface_data_z != NULL) g_free (surface_data_z);
-       surface_data_x = (double *)g_malloc((30*30 + 1) * sizeof(double));
-       surface_data_y = (double *)g_malloc((30*30 + 1) * sizeof(double));
-       surface_data_z = (double *)g_malloc((30*30 + 1) * sizeof(double));
+       surface_data_x = (double *)g_malloc((31*31 + 1) * sizeof(double));
+       surface_data_y = (double *)g_malloc((31*31 + 1) * sizeof(double));
+       surface_data_z = (double *)g_malloc((31*31 + 1) * sizeof(double));
 
        /* FIXME: 30 should be configurable! */
        n = 0;
-       for (j = 0; j < 30; j++) {
-               if (j < 29)
+       for (j = 0; j <= 30; j++) {
+               if (j < 30)
                        y = surfacey1 + (j*(surfacey2-surfacey1))/30.0;
                else
                        y = surfacey2;
-               for (i = 0; i < 30; i++) {
-                       if (i < 29)
+               for (i = 0; i <= 30; i++) {
+                       if (i < 30)
                                x = surfacex1 + (i*(surfacex2-surfacex1))/30.0;
                        else
                                x = surfacex2;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]