Discussion:
[fricas-devel] question on using .fricas.input, it is not being read by Fricas
'Nasser M. Abbasi' via FriCAS - computer algebra system
2018-08-03 01:27:15 UTC
Permalink
I wanted to see if I can make Fricas read definition of function from
$HOME/.fricas.input

But it does not seem to be reading this file at all. How does one know it
is reading the file or not?

I never used this file before. I did the following
cat $HOME/.fricas.input
erfc(x) == 1 - erf(x)

Now started Fricas
======================
fricas
Checking for foreign routines
AXIOM="/usr/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
FriCAS Computer Algebra System
Version: FriCAS 1.3.4


(1) -> integrate(erfc(x),x)
There are no library operations named erfc
=======================

I am trying to see if this file can be automatically read, when sagemath
calls fricas. But
I can't even get it read by using Fricas directly as the above.

I do not know how to tell Sagemath to tell Fricas to use this definition
either. I do not
know what the syntax will be if possible.

I entered a bug against Sagemath for this translation issue as
well. https://trac.sagemath.org/ticket/25991

I also tried .axiom.input, but it also had no effect. The definition of
erfc() is not seen.

What Am I doing wrong? This is on Linux.

Thanks
--Nasser
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Riccardo GUIDA
2018-08-03 10:24:45 UTC
Permalink
No idea what is the problem but I reproduce the issue with Nasser erfc function.

The macro erfc2 is taken into account and works.

ric

(1) -> )system cat /home/guida/.fricas.input
)set output characters default
macro %SIF(e) == unparse(e::InputForm) -- SPAD Input Form
erfc(x) == 1 - erf(x)
macro erfc2(x) == 1 - erf(x)
(1) -> erfc2(1)

(1) - erf(1) + 1
Type: Expression(Integer)
(2) -> erfc(1)
There are no library operations named erfc
Use HyperDoc Browse or issue
)what op erfc
to learn if there is any operation containing " erfc " in its
name.

Cannot find a definition or applicable library operation named erfc
with argument type(s)
PositiveInteger

Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.

(2) -> )display op erfc
erfc is not a known function. FriCAS will try to list its functions
which contain erfc in their names. This is the same output you
would get by issuing
)what operations erfc

There are no operations containing those patterns

(2) ->
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Grégory Vanuxem
2018-08-03 11:14:17 UTC
Permalink
Hi

You can try to use the environment FRICAS_INITFILE via an 'export
FRICAS_INITFILE=/path/to/home'

See src/interp/i-toplev.boot line 106 (readSpadProfileIfThere) where we can
read the routine return 'nil' if it this environment variable is not
defined.

Not tested though, I would need more knowledge/investigation of the actual
source code.

Cheers,

Greg
Post by Riccardo GUIDA
No idea what is the problem but I reproduce the issue with Nasser erfc function.
The macro erfc2 is taken into account and works.
ric
(1) -> )system cat /home/guida/.fricas.input
)set output characters default
macro %SIF(e) == unparse(e::InputForm) -- SPAD Input Form
erfc(x) == 1 - erf(x)
macro erfc2(x) == 1 - erf(x)
(1) -> erfc2(1)
(1) - erf(1) + 1
Expression(Integer)
(2) -> erfc(1)
There are no library operations named erfc
Use HyperDoc Browse or issue
)what op erfc
to learn if there is any operation containing " erfc " in its
name.
Cannot find a definition or applicable library operation named erfc
with argument type(s)
PositiveInteger
or "$" to specify which version of the function you need.
(2) -> )display op erfc
erfc is not a known function. FriCAS will try to list its functions
which contain erfc in their names. This is the same output you
would get by issuing
)what operations erfc
There are no operations containing those patterns
(2) ->
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Grégory Vanuxem
2018-08-03 11:35:33 UTC
Permalink
In fact, quickly reading source FRICAS_INITFILE is a path to a file and
not a directory.

Otherwise the function make_input_filename is used. No time to investigate
more.

Other may help you
Post by Grégory Vanuxem
Hi
You can try to use the environment FRICAS_INITFILE via an 'export
FRICAS_INITFILE=/path/to/home'
See src/interp/i-toplev.boot line 106 (readSpadProfileIfThere) where we
can read the routine return 'nil' if it this environment variable is not
defined.
Not tested though, I would need more knowledge/investigation of the actual
source code.
Cheers,
Greg
Post by Riccardo GUIDA
No idea what is the problem but I reproduce the issue with Nasser erfc function.
The macro erfc2 is taken into account and works.
ric
(1) -> )system cat /home/guida/.fricas.input
)set output characters default
macro %SIF(e) == unparse(e::InputForm) -- SPAD Input Form
erfc(x) == 1 - erf(x)
macro erfc2(x) == 1 - erf(x)
(1) -> erfc2(1)
(1) - erf(1) + 1
Expression(Integer)
(2) -> erfc(1)
There are no library operations named erfc
Use HyperDoc Browse or issue
)what op erfc
to learn if there is any operation containing " erfc " in its
name.
Cannot find a definition or applicable library operation named erfc
with argument type(s)
PositiveInteger
or "$" to specify which version of the function you need.
(2) -> )display op erfc
erfc is not a known function. FriCAS will try to list its functions
which contain erfc in their names. This is the same output you
would get by issuing
)what operations erfc
There are no operations containing those patterns
(2) ->
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Waldek Hebisch
2018-08-03 12:02:23 UTC
Permalink
Post by 'Nasser M. Abbasi' via FriCAS - computer algebra system
I wanted to see if I can make Fricas read definition of function from
$HOME/.fricas.input
But it does not seem to be reading this file at all. How does one know it
is reading the file or not?
Add a printout. Or change some setting.
Post by 'Nasser M. Abbasi' via FriCAS - computer algebra system
I never used this file before. I did the following
cat $HOME/.fricas.input
erfc(x) == 1 - erf(x)
Now started Fricas
======================
fricas
Checking for foreign routines
AXIOM="/usr/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
FriCAS Computer Algebra System
Version: FriCAS 1.3.4
(1) -> integrate(erfc(x),x)
There are no library operations named erfc
=======================
This a feature. FriCAS keeps functions and variables in a
structure called frame. You can have multiple frames. In
fact, in normal session you will have two or more frames.
One is initial frame, init file is evaluated in this frame.
And there are user frames, where your command are evaluated.
You can switch between frames using ')frame next'.
So above you would need:

(1) -> )frame next
(3) -> erfc(x)
Compiling function erfc with type Variable(x) -> Expression(Integer)


(3) - erf(x) + 1
Type: Expression(Integer)

Note jump in command number: each frame keeps its own numeration of
commands and I put 2 command in init file.

More generaly, init file is intended to change global settings
like expose or hide a constuctor, break handling etc. Normally
for defining functions users are expected to use ')read' command
which works in current frame. As Ricardo noted macros are global,
so you can use a macro.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+***@googlegroups.com.
To post to this group, send email to fricas-***@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
Loading...