|
|
|
last edited 3 years ago by test1 |
| 1 2 3 4 5 6 7 8 9 | ||
|
Editor: test1
Time: 2023/09/17 15:40:43 GMT+0 |
||
| Note: | ||
changed: -# include "axiom.as" # include "fricas.as" removed: --- Old GCL version use: ---)lisp (si::allocate-contiguous-pages 1500 t) ---)lisp (si::allocate 'sfun 50 t) - changed: -To run this program on your own computer you need linux and -**Axiom+Aldor** from AxiomBinaries. To run this program on your own computer you need Linux and **FriCAS+Aldor**. You need to build them from sources, follow the instructions in INSTALL. changed: - $ vi sieve.as - -2 Start Axiom:: - - $ AXIOMsys $ vim sieve.as 2 Start FriCAS:: $ fricas
From section 1.2 of Aldor Users Guide
(1) -> <aldor> # include "fricas.as"
import from Boolean,Integer, NonNegativeInteger;
sieve(n: Integer): Integer == { isprime: OneDimensionalArray Boolean := new(n::NonNegativeInteger,true);
np:Integer := 0; for p in 2..n | isprime p repeat { np := np + 1; for i in (p+p)..n by p repeat isprime i := false; } np }</aldor>
Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/860059225630362337-25px001.as
using Aldor compiler and options
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
. Use the system command )set compiler args to change these
options.
#1 (Warning) Could not use archive file `libfricas.al'.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/860059225630362337-25px001.as", line 1:
# include "fricas.as"
^
[L1 C1] #2 (Error) Could not open file `fricas.as'.
The )library system command was not called after compilation.for i in 1..4 repeat
n := 10^i
outputList ["There are ", sieve n, " primes <= ", n]
There are no library operations named sieve
Use HyperDoc Browse or issue
)what op sieve
to learn if there is any operation containing " sieve " in its
name.
Cannot find a definition or applicable library operation named sieve
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.
FriCAS will attempt to step through and interpret the code.
There are no library operations named sieve
Use HyperDoc Browse or issue
)what op sieve
to learn if there is any operation containing " sieve " in its
name.
Cannot find a definition or applicable library operation named sieve
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.
To run this program on your own computer you need Linux and FriCAS+Aldor. You need to build them from sources, follow the instructions in INSTALL.
$ vim sieve.as
$ fricas
(1) -> )compile sieve.as
for i in 1..6 repeat ( _
n := 10^i; _
outputList ["There are ", sieve n, " primes <= ", n] _
)