unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* as for Calc and the math library
@ 2024-08-10 22:48 Emanuel Berg
  2024-08-11  4:58 ` Eli Zaretskii
  0 siblings, 1 reply; 82+ messages in thread
From: Emanuel Berg @ 2024-08-10 22:48 UTC (permalink / raw)
  To: emacs-devel

;; __________________________________________________________
;; ``````````````````````````````````````````````````````````
;; |                         
;; 3                        CCUG-ML                        60
;;                                                          |
;; __________________________________________________________
;; `-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-`-

I have now been using the Calc library a bit!

Not a lot. Very little.

But I can already say about Calc that it is very good.
The code is good as well and as for math it is at a very
high level.

But it it is too complicated and the entry level is too high.
It is advanced math but also an advanced program.

We still need a math library that covers like up to the
introductory courses at the university. This should be
accessible with the familiar Elisp syntax.

Every function in math from school and again, maybe including
the introductory courses at the university, should be
available with Emacs notation.

So now, we don't have

(** 4 1)
( ^ 4 1)

(We do have `expt' but notation is important and should be,
for a math library, using "their" symbols and conventions,
not ours, as much as possible.)

We don't have

(defun distance-point (min max)
  (+ min (/ (- max min) 2.0)) )

Or from Logic, we don't have `nand' i.e. (not (and a b)). [last]

All that we don't have, or we do, as Calc can do it - easily.

Okay, so we don't need a new generic library. We need
a generic library which is a complement to all the basic
stuff, we don't have readily available as for now.

Out of respect for Calc there is no need to move it, now need
for that and no practical reason to.

However the new stuff must be totally transparent. When some
dude comes home from school/university and wants to try some
half-basic stuff, this should work instantly using the Elisp
he is used to. It should be "Oh, cool, Emacs has it!" And for
a long time, it should be like that for him.

If at some much later point, he (or she) moves on to "real
Calc", then he is so good we don't have to worry about
him anymore.

So we should have a CCUG-ML project: the Generic Complementary
Math Library Using Calc.

Yes, it would be to some small extent *using* Calc but to
a huge extent it would just be an interface. But 100%
transparent, so one can use Elisp and the common math
notation people know from school.

No long prefixes, no special notation, nothing, as I now know
there is _a lot_ of in Calc. People should be allowed to use
the basics of Calc without knowing it!

It should just be just like when I looked for `**' and `nand',
only this time, they should exist, thru the interface,
using Calc.

IMO!

Here is nand BTW:

(defun nand (&rest conditions)
  (when (member nil conditions)
    t) )

;; (nand)           ; nil
;; (nand 1 2 3)     ; nil
;; (nand nil)       ; t
;; (nand 1 2 nil 3) ; t

;; (not (and))           ; nil
;; (not (and 1 2 3))     ; nil
;; (not (and nil))       ; t
;; (not (and 1 2 nil 3)) ; t

And here is some Calc:

(require 'calc-ext)
(require 'cl-lib)

;; (infx "0 < 10")

(defun infx (str)
  (let* ((exp (math-read-expr str))
         (fun (car exp))
         (new (cons (intern (caar (cl-member fun math-expr-opers :key #'cadr :test #'equal)))
                    (cdr exp))))
    (apply (car new) (cdr new))))

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 82+ messages in thread
* Re: as for Calc and the math library
@ 2024-08-12  5:30 arthur miller
  2024-08-12 11:00 ` Eli Zaretskii
  0 siblings, 1 reply; 82+ messages in thread
From: arthur miller @ 2024-08-12  5:30 UTC (permalink / raw)
  To: emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

> > If Emacs is to have a math library, the library must use high-quality
> > mathematical and numerical algorithms that are well-known and
> > described in many textbooks on this subject matter...
>
> I agree with this point, but I suspect that writing such a library from
> scratch might be a bit difficult.
>
> May I suggest an alternative: abstract out GNU Calc math routines to be
> available from Elisp without having to read Calc sources.
> Such a task would require:
> 1. Documenting some Calc data structures
> 2. Possibly refactoring some Calc functions to use simpler API.
>
> It would be a much easier task and can improve the existing
> functionality.

Even better, given people proper FFI so they can import and use any of the tens
or hundreds of quality math libraries available.

That would also help to keep C core smaller, and relieve the dependency on core
devs to add bindings to future libraries when users want or need them.

A third of Emacs C core could have easily been implemented by users if they had
proper FFI exposed to Lisp instead of C modules which very few people use.

[-- Attachment #2: Type: text/html, Size: 3943 bytes --]

^ permalink raw reply	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2024-08-24  2:59 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-10 22:48 as for Calc and the math library Emanuel Berg
2024-08-11  4:58 ` Eli Zaretskii
2024-08-11 16:45   ` Ihor Radchenko
2024-08-11 16:55     ` Christopher Dimech
2024-08-11 17:05     ` Emanuel Berg
2024-08-11 17:59     ` Eli Zaretskii
2024-08-11 18:17       ` Christopher Dimech
2024-08-11 18:32         ` Eli Zaretskii
2024-08-11 19:53           ` Christopher Dimech
2024-08-11 18:27       ` Ihor Radchenko
2024-08-11 18:38         ` Emanuel Berg
2024-08-12  6:28           ` New Emacs features via Google Summer of Code (or other similar stipend schemes) (was: as for Calc and the math library) Ihor Radchenko
2024-08-12 11:09             ` Eli Zaretskii
2024-08-12 12:10               ` New Emacs features via Google Summer of Code (or other similar stipend schemes) Joel Reicher
2024-08-12 18:59                 ` Ihor Radchenko
2024-08-12 22:28                   ` Pedro
2024-08-14 10:07                     ` Ihor Radchenko
2024-08-15 11:44                     ` Ihor Radchenko
2024-08-12 19:17               ` New Emacs features via Google Summer of Code (or other similar stipend schemes) (was: as for Calc and the math library) Ihor Radchenko
2024-08-13  8:12                 ` New Emacs features via Google Summer of Code (or other similar stipend schemes) Andrea Corallo
2024-08-18 11:48                   ` Ihor Radchenko
2024-08-18 12:35                     ` Eli Zaretskii
2024-08-18 12:52                       ` Ihor Radchenko
2024-08-18 13:39                         ` Eli Zaretskii
2024-08-18 13:56                           ` RTF import/export emacs (was: New Emacs features via Google Summer of Code (or other similar stipend schemes)) Ihor Radchenko
2024-08-18 14:14                             ` Eli Zaretskii
2024-08-18 14:35                               ` Ihor Radchenko
2024-08-18 14:38                                 ` Eli Zaretskii
2024-08-18 17:37                                 ` Jim Porter
2024-08-18 18:16                                   ` Eli Zaretskii
2024-08-18 18:38                                     ` Jim Porter
2024-08-18 19:05                                       ` tomas
2024-08-13 11:02                 ` New Emacs features via Google Summer of Code (or other similar stipend schemes) (was: as for Calc and the math library) Eli Zaretskii
2024-08-18 11:09                   ` Ihor Radchenko
2024-08-18 11:25                     ` Eli Zaretskii
2024-08-18 11:33                     ` Stefan Kangas
2024-08-18 12:47                       ` Ihor Radchenko
2024-08-11 18:52         ` as for Calc and the math library Eli Zaretskii
2024-08-11 19:13           ` Ihor Radchenko
2024-08-12  2:24             ` Eli Zaretskii
2024-08-11 21:50           ` Christopher Dimech
  -- strict thread matches above, loose matches on Subject: below --
2024-08-12  5:30 arthur miller
2024-08-12 11:00 ` Eli Zaretskii
2024-08-12 11:23   ` Nicolas Martyanoff
2024-08-12 11:46     ` Eli Zaretskii
2024-08-12 12:11       ` Nicolas Martyanoff
2024-08-12 13:22         ` Eli Zaretskii
2024-08-12 13:38           ` Christopher Dimech
2024-08-15  1:59             ` Richard Stallman
2024-08-15  3:06               ` Christopher Dimech
2024-08-15  6:43                 ` Eli Zaretskii
2024-08-15 13:28                   ` Christopher Dimech
2024-08-15 16:39                     ` Eli Zaretskii
2024-08-13  7:16           ` Sv: " arthur miller
2024-08-13 12:12             ` Eli Zaretskii
2024-08-13 13:10               ` Nicolas Martyanoff
2024-08-13 13:30                 ` Eli Zaretskii
2024-08-13 13:48                   ` Nicolas Martyanoff
2024-08-13 21:43               ` Sv: " arthur miller
2024-08-14  5:09                 ` Eli Zaretskii
2024-08-14  8:45                   ` Sv: " arthur miller
2024-08-14  9:56                     ` Nicolas Martyanoff
2024-08-14 10:43                       ` Eli Zaretskii
2024-08-13  5:39       ` Gerd Möllmann
2024-08-14  4:11         ` Gerd Möllmann
2024-08-14  6:23           ` Eli Zaretskii
2024-08-14  6:28             ` Gerd Möllmann
2024-08-14  6:43               ` Eli Zaretskii
2024-08-14 14:00             ` Suhail Singh
2024-08-14 14:20               ` Eli Zaretskii
2024-08-14 15:08                 ` Suhail Singh
2024-08-14 15:31                   ` Eli Zaretskii
2024-08-14 16:00                     ` Suhail Singh
2024-08-14 16:24                       ` Eli Zaretskii
2024-08-14 20:35                       ` Emanuel Berg
2024-08-15  5:00                     ` Sv: " arthur miller
2024-08-15  7:02                       ` Eli Zaretskii
2024-08-15 20:09                         ` Sv: " arthur miller
2024-08-16  5:47                           ` Eli Zaretskii
2024-08-18 16:38                           ` Richard Stallman
2024-08-18 17:27                             ` Christopher Dimech
2024-08-19 12:05                             ` Sv: " arthur miller
2024-08-24  2:59                               ` Richard Stallman
2024-08-24  2:59                               ` Richard Stallman
2024-08-14 14:35               ` Gerd Möllmann
2024-08-14 14:40                 ` Nicolas Martyanoff
2024-08-14 14:47                   ` Gerd Möllmann
2024-08-14 14:49                   ` Eli Zaretskii
2024-08-14  5:29     ` Madhu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).