[genius] Mon May 23 16:20:17 2016 Jiri (George) Lebl <jirka 5z com>



commit cfdf25b0735ca8b1f69408e74731808337c404f8
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Mon May 23 16:20:20 2016 -0500

    Mon May 23 16:20:17 2016  Jiri (George) Lebl <jirka 5z com>
    
        * src/graphing.c: fix segfault when rotate animation is running and a
          new function is plotted
    
        * src/funclib.c: fix error string
    
        * lib/functions/elementary.gel: fixup some of the inverse trig
          functions for complex arguments and fix some divisions by zero
    
        * po/eo.po: minor additions to translations

 ChangeLog                    |   12 ++++++++++
 lib/functions/elementary.gel |   45 +++++++++++++++++++++++++++++++-------
 po/eo.po                     |   48 +++++++++++++++++++++---------------------
 src/funclib.c                |    2 +-
 src/graphing.c               |    4 ++-
 5 files changed, 76 insertions(+), 35 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6528d19..88fadfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Mon May 23 16:20:17 2016  Jiri (George) Lebl <jirka 5z com>
+
+       * src/graphing.c: fix segfault when rotate animation is running and a
+         new function is plotted
+
+       * src/funclib.c: fix error string
+       
+       * lib/functions/elementary.gel: fixup some of the inverse trig
+         functions for complex arguments and fix some divisions by zero
+
+       * po/eo.po: minor additions to translations
+
 Wed Jan 20 09:37:38 2016  Jiri (George) Lebl <jirka 5z com>
 
        * lib/number_theory/primes.gel: update data from GIMPS (new prime)
diff --git a/lib/functions/elementary.gel b/lib/functions/elementary.gel
index 176ad3e..c0e4198 100644
--- a/lib/functions/elementary.gel
+++ b/lib/functions/elementary.gel
@@ -23,7 +23,8 @@ function deg2rad(x) = (
        (x*pi)/180
 );
 
-#FIXME: these may not deal well with zero values.
+#FIXME: these may not deal well with zero values. (should treat 0 correctly now)
+#FIXME: these should be further double checked
 
 SetHelp("asin","trigonometry","The arcsin (inverse sin) function");
 function asin(x) = (
@@ -31,8 +32,15 @@ function asin(x) = (
                return ApplyOverMatrix(x,asin)
        else if(not IsValue(x)) then
                (error("asin: argument not a value");bailout);
-       if (x==1) then pi/2 else if (x==-1) then -pi/2
-            else atan(x/sqrt(1-x^2))
+
+       if x==1 then
+               pi/2
+       else if x==-1 then
+               -pi/2
+       else if IsReal(x) and -1 < x < 1 then
+               atan(x/sqrt(1-x^2))
+       else
+               (-1i)*ln(1i*x+sqrt(abs(1-x^2))*exp((1i/2)*Arg(1-x^2)))
 );
 arcsin = asin
 SetHelpAlias ("asin", "arcsin");
@@ -43,7 +51,10 @@ function asinh(x) = (
                return ApplyOverMatrix(x,asinh)
        else if(not IsValue(x)) then
                (error("asinh: argument not a value");bailout);
-       ln(x+sqrt((x^2)+1))
+       if IsReal(x) then
+               ln(x+sqrt((x^2)+1))
+       else
+               ln(x+sqrt(abs(1+x^2))*exp((1i/2)*Arg(1+x^2)))
 );
 arcsinh = asinh
 SetHelpAlias ("asinh", "arcsinh");
@@ -54,8 +65,15 @@ function acos(x) = (
                return ApplyOverMatrix(x,acos)
        else if(not IsValue(x)) then
                (error("acos: argument not a value");bailout);
-        if (x==0) then pi/2 
-           else atan(sqrt(1-x^2)/x)+(if x>0 then 0 else pi)
+
+       if x==1 then
+               0
+       else if x==-1 then
+               pi
+       else if IsReal(x) and -1 < x < 1 then
+               atan(sqrt(1-x^2)/x)+(if x>0 then 0 else pi)
+       else
+               (-1i)*ln(1i*x+1i*sqrt(abs(1-x^2))*exp((1i/2)*Arg(1-x^2)))
 );
 arccos = acos
 SetHelpAlias ("acos", "arccos");
@@ -66,7 +84,10 @@ function acosh(x) = (
                return ApplyOverMatrix(x,acosh)
        else if(not IsValue(x)) then
                (error("acosh: argument not a value");bailout);
-       ln(x+sqrt((x^2)-1))
+       if IsReal(x) and -1 <= x <= 1 then
+               ln(x+sqrt((x^2)-1))
+       else
+               ln(x+sqrt(abs(x^2-1))*exp((1i/2)*Arg(x^2-1)))
 );
 arccosh = acosh
 SetHelpAlias ("acosh", "arccosh");
@@ -95,7 +116,12 @@ function acot(x) = (
                return ApplyOverMatrix(x,acot)
        else if(not IsValue(x)) then
                (error("acot: argument not a value");bailout);
-       atan(1/x)
+
+       #atan(1/x)
+       if IsReal(x) then
+               Re(ln((x+1i)/(x-1i))/2i)
+       else
+               ln((x+1i)/(x-1i))/2i
 );
 arccot = acot
 SetHelpAlias ("acot", "arccot");
@@ -106,7 +132,8 @@ function acoth(x) = (
                return ApplyOverMatrix(x,acoth)
        else if(not IsValue(x)) then
                (error("acoth: argument not a value");bailout);
-       atanh(1/x)
+       #atanh(1/x)
+       ln((x+1)/(x-1))/2
 );
 arccoth = acoth
 SetHelpAlias ("acoth", "arccoth");
diff --git a/po/eo.po b/po/eo.po
index e86b805..5a3e9e2 100644
--- a/po/eo.po
+++ b/po/eo.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: genius master\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2015-08-22 12:51-0500\n"
-"PO-Revision-Date: 2016-01-06 17:46-0500\n"
+"PO-Revision-Date: 2016-05-23 17:46-0500\n"
 "Last-Translator: Jiri Lebl <jirka 5z com>\n"
 "Language-Team: Esperanto <gnome-eo-list gnome org>\n"
 "Language: eo\n"
@@ -134,63 +134,63 @@ msgstr "La funkcio arccot (inversa kotangento)"
 
 #: ../lib/library-strings.c:27
 msgid "The arccoth (inverse coth) function"
-msgstr "La funkcio arccoth (inversa hyperbola kotangento)"
+msgstr "La funkcio arccoth (inversa hiperbola kotangento)"
 
 #: ../lib/library-strings.c:28
 msgid "The inverse cosecant function"
-msgstr ""
+msgstr "La inversa funkcio de cosekanto"
 
 #: ../lib/library-strings.c:29
 msgid "The inverse hyperbolic cosecant function"
-msgstr ""
+msgstr "La inversa funkcio de hiperbola cosekanto"
 
 #: ../lib/library-strings.c:30
 msgid "The inverse secant function"
-msgstr ""
+msgstr "La inversa funkcio de sekanto"
 
 #: ../lib/library-strings.c:31
 msgid "The inverse hyperbolic secant function"
-msgstr ""
+msgstr "La inversa funkcio de hiperbola sekanto"
 
 #: ../lib/library-strings.c:32
 msgid "The arcsin (inverse sin) function"
-msgstr ""
+msgstr "La funkcio arcsin (inversa sinuso)"
 
 #: ../lib/library-strings.c:33
 msgid "The arcsinh (inverse sinh) function"
-msgstr ""
+msgstr "La funkcio arcsinh (inversa hiperbola sinuso)"
 
 #: ../lib/library-strings.c:34
 msgid "The arctanh (inverse tanh) function"
-msgstr ""
+msgstr "La funkcio arctanh (inversa hiperbola tangento)"
 
 #: ../lib/library-strings.c:35
 msgid "The cotangent function"
-msgstr ""
+msgstr "La funkcio kotangento"
 
 #: ../lib/library-strings.c:36
 msgid "The hyperbolic cotangent function"
-msgstr ""
+msgstr "La hiperbola kotangenta funkcio"
 
 #: ../lib/library-strings.c:37
 msgid "The cosecant function"
-msgstr ""
+msgstr "La funkcio kosekanto"
 
 #: ../lib/library-strings.c:38
 msgid "The hyperbolic cosecant function"
-msgstr ""
+msgstr "La hiperbola kosekanta funkcio"
 
 #: ../lib/library-strings.c:39
 msgid "The secant function"
-msgstr ""
+msgstr "La funkcio sekanto"
 
 #: ../lib/library-strings.c:40
 msgid "The hyperbolic secant function"
-msgstr ""
+msgstr "La hiperbola sekanta funkcio"
 
 #: ../lib/library-strings.c:41
 msgid "The hyperbolic tangent function"
-msgstr ""
+msgstr "La hiperbola tangenta funkcio"
 
 #: ../lib/library-strings.c:42
 msgid "Are a and b relatively prime?"
@@ -198,7 +198,7 @@ msgstr "Ĉu a kaj b estas primaj inter si"
 
 #: ../lib/library-strings.c:43
 msgid "Return the nth Bernoulli number"
-msgstr "Liveri la n-an nombro de Bernoulli"
+msgstr "Liveri la n-an nombron de Bernoulli"
 
 #: ../lib/library-strings.c:44
 msgid ""
@@ -2031,7 +2031,7 @@ msgstr ""
 #: ../src/funclib.c:3088 ../src/funclib.c:3185
 #, c-format
 msgid "%s: Cannot compare complex numbers"
-msgstr ""
+msgstr "%s: Ne povas kompari kompleksaj nombroj"
 
 #: ../src/funclib.c:3098 ../src/funclib.c:3194
 #, c-format
@@ -4086,7 +4086,7 @@ msgstr "Komando por presi: "
 
 #: ../src/graphing.c:881
 msgid "Cannot open temporary file, cannot print."
-msgstr ""
+msgstr "Ne povas malfermi provizoran dosieron, ne povas presi."
 
 #: ../src/graphing.c:910
 msgid "Printing failed"
@@ -4123,7 +4123,7 @@ msgstr "Eksporti PNG"
 
 #: ../src/graphing.c:1208
 msgid "Missing ps2pdf command, perhaps ghostscript is not installed."
-msgstr ""
+msgstr "Mankas komando ps2pdf, elbe ghostscript ne estas instalita."
 
 #: ../src/graphing.c:1223
 msgid "EPS files"
@@ -4246,15 +4246,15 @@ msgstr "_Supre vido"
 
 #: ../src/graphing.c:2269
 msgid "R_otate axis..."
-msgstr ""
+msgstr "T_urni akso..."
 
 #: ../src/graphing.c:2274
 msgid "Start rotate _animation..."
-msgstr ""
+msgstr "Komenci _animicion de rotacio..."
 
 #: ../src/graphing.c:2279
 msgid "Stop rotate a_nimation..."
-msgstr ""
+msgstr "Haltigi a_nimicion de rotacio..."
 
 #: ../src/graphing.c:2289
 msgid "_Solver"
@@ -4270,7 +4270,7 @@ msgstr "_Viŝi solvaĵojn"
 
 #: ../src/graphing.c:2330
 msgid "Errors during plotting (possibly harmless), see the console."
-msgstr ""
+msgstr "Eraroj dum grafeado (eble sendamaĝaj), vidu la konzolon."
 
 #: ../src/graphing.c:3348
 #, c-format
diff --git a/src/funclib.c b/src/funclib.c
index 34006e5..6176d5a 100644
--- a/src/funclib.c
+++ b/src/funclib.c
@@ -3095,7 +3095,7 @@ max_op (GelCtx *ctx, GelETree * * a, gboolean *exception)
                         */
                        return gel_stealnode (a[0]);
                } else {
-                       gel_errorout (_("%s: Input not a number of matrix of numbers."),
+                       gel_errorout (_("%s: Input not a number or a matrix of numbers."),
                                      "max");
                        return NULL;
                }
diff --git a/src/graphing.c b/src/graphing.c
index 3679451..066da5f 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -1,5 +1,5 @@
 /* GENIUS Calculator
- * Copyright (C) 2003-2014 Jiri (George) Lebl
+ * Copyright (C) 2003-2016 Jiri (George) Lebl
  *
  * Author: Jiri (George) Lebl
  *
@@ -2346,6 +2346,8 @@ clear_graph (void)
 {
        int i;
 
+       stop_rotate_anim_cb (NULL, NULL);
+
        gtk_widget_hide (errors_label_box);
 
        /* to avoid the costly removes */


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