multi line rules not working

13 views
Skip to first unread message

osmanfb1

unread,
Mar 8, 2023, 1:08:54 AM3/8/23
to FriCAS - computer algebra system
Hello,
I have cloned the fricas repository and built fricas (ubuntu  22.04.2). Seems to be working but when I tried multi line rules, I am getting a syntax error:

1) -> logrule1 := rule log a + log b == log(a*b)

   (1)  log(b) + log(a) + %B == log(a b) + %B
                       Type: RewriteRule(Integer,Integer,Expression(Integer))
(2) -> logrule1(log 2 + log 3)

   (2)  log(6)
                                                    Type: Expression(Integer)
(3) -> log 2 + log 3

   (3)  log(3) + log(2)
                                                    Type: Expression(Integer)
(4) -> logrule2 := rule
  Line   1: logrule2 := rule
           ............A
  Error  A: syntax error at top level
  Error  A: Improper syntax.
   2 error(s) parsing

(4) -> )version

Value = "FriCAS 2022-07-16 compiled at Thu Mar  2 03:01:13 PM EST 2023"


is this a known issue or am I doing something wrong??
Thanks
Osman

Ralf Hemmecke

unread,
Mar 8, 2023, 1:31:26 AM3/8/23
to fricas...@googlegroups.com
> is this a known issue or am I doing something wrong??

I would call this a known issue.

But it is only for the default interface. It works fine if FriCAS reads
.input files or compiles .spad files.

There is a way to put FriCAS as a jupyter kernel and thus use the
Jupyter web interface. Since you know how to compile FriCAS, I could
make this available to you.
Or you use an older Version of FriCAS and follow the steps here:
https://hemmecke.github.io/qeta/fricasinstall.html

You can also consider to use FriCAS in emacs with the frimacs mode, then
you can write your multiline input into an .input file and send it to a
fricas session via Ctrl-C Ctrl-C.

https://github.com/pdo/frimacs

Or you can escape the end-of-line character by an underscore character.

(1) -> logrule2 := rule_
(log ( x ) + log ( y ) == log ( x * y );_
sin (x) * cos (y) == tan(x*y))

(I just added a stupid second rule for demonstration.) Then, however,
you need to put parentheses and separate by semicolon, because the
interpreter will basically read this as ONE long line.

Ralf

osmanfb1

unread,
Mar 8, 2023, 9:06:50 AM3/8/23
to FriCAS - computer algebra system
Thanks for the quick reply Ralf. Emacs idea worked for me. But would be interested in getting the jupyter kernel too.
using underscores is also good. I was trying something like that using curly brackets :-(
Fricas/Axiom books or tutorials do not mention this at all. I built fricas with lisp only but it had the same problem
and was very slow (sbcl was the lisp). Built open-axiom , had the same problem.
Thanks again,
Osman

Reply all
Reply to author
Forward
0 new messages