Grégory Vanuxem
unread,Oct 31, 2024, 3:10:05 PM10/31/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas...@googlegroups.com
Hello,
I have some issues with the 'default' keyword (?) in the interpreter,
I need it to coerce it to a JuliaSymbol, but coercing 'default to a
JuliaSymbol is not possible unless I use it as a string:
(2) -> a:=necf(1/2);
(3) -> sin(a,'tangent)
(3) 0.479426 {(2*a)/(a^2+1) where a = 0.255342 [Tan(0.250000 {1/4})]}
Type: NemoExactComplexField
(4) -> sin(a,'exponential)
(4)
0.479426 + 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.877583 + 0.479426*I
[Exp(0.500000*I {(b)/2})], b = I [b^2+1=0
]}
Type: NemoExactComplexField
(5) -> sin(a,'default)
Line 1: sin(a,'default)
......A
Error A: syntax error at top level
Error A: Improper syntax.
2 error(s) parsing
(5) -> sin(a,"default")
(5)
0.479426 + 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.877583 + 0.479426*I
[Exp(0.500000*I {(b)/2})], b = I [b^2+1=0
]}
And if I issue, even in the official FriCAS, 'default' in the interpreter:
(6) -> default
Internal Error
Unexpected error in call to system function pf2Sex1
So I wonder why, and if it can be filtered somewhere in boot or Lisp
code? Also, if it can be and if it will be, what about doing like
Julia or Xcas when they avoid defining an already defined symbol like
'sin' for example? In FriCAS it is possible to assign to a variable,
say 'sin' for example, something like:
sin := sin(0.5)
After, the sin function is no longer available by default. I think it
should be possible during an assignment to check if 'sin' is already a
library operation, something like defined?(Symbol) in the interpreter
code.
In Julia:
julia> sin=sin(0.7)
ERROR: cannot assign a value to imported variable Base.sin from module Main
Stacktrace:
[1] top-level scope
@ REPL[1]:1
Xcas:
sin:=sin(0.5)
=> sin' is a reserved word, sto not allowed: 0.479425538604
Python allows this though, as FriCAS:
Python 3.12.6 (main, Sep 7 2024, 14:20:15) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import sin
>>> sin=sin(0.5)
>>> sin(1.7)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float' object is not callable
>>>
My primary interest is of course 'default', after, it is a matter of
taste I think.
- Greg