1
#****************************************************************************
2
# Maple to Scilab interface
3
# Version 1.0.1 (18 August 1998)
4
# Copyright (C) 1997-98 INRIA
7
# Tel: 33+ 01 39 63 55 77
8
# email: Claude.Gomez@inria.fr
9
# Web site: http://www-rocq.inria.fr/scilab/gomez
16
# 78153 Le Chesnay Cedex
18
#****************************************************************************
20
#############################################################################
21
# maple2scilab Maple procedure
23
# Converts a Maple matrix "expr" into a Scilab function "fname".
24
# The Maple matrix can have parameters which are changed into
25
# the arguments of the Scilab function.
26
# Then you have to load the generated code into Scilab: the way
27
# to do that is printed by the maple2scilab procedure.
29
# This conversion is made via: Fortran if "code" is 'f'
31
# directly in Scilab if code is 's'.
33
# Note that "expr" can also be an algebraic expression, a vector,
34
# a bi-dimensional array or a list of lists.
36
# If there is a fifth argument, it is the directory where
37
# the source codes of the Scilab function, Fortran subroutine
38
# or C function are gererated. Otherwise, the current directory is used.
40
# When generating C code, the file must include the "machine.h" header
41
# distributed with Scilab in the "routines" directory. Its path
42
# is automatically generated when installing Scilab.
43
# If you want to change the path, use the Maple global variable
44
# "machine_include"; for instance, do in Maple:
45
# machine_include:=`/my_directory/machine.h`;
47
# By default, the Fortran or C generated code is not optimized. If you want
48
# to generated optimized code do: optimized:=true;
49
#############################################################################
51
maple2scilab:=proc(fname::{name,string},expr,parameters,code::{name,string})
52
local ffile,k,lpath,maplematrix,ofile,para,release,sfile,soptimized;
53
global _ifunc,_old_labelling,_old_quiet,_old_screenwidth,_scicall,
55
_old_quiet:=interface(quiet); interface(quiet=true);
56
_old_labelling:=interface(labelling); interface(labelling=false);
57
_old_screenwidth:=interface(screenwidth); interface(screenwidth=80);
59
if type(expr,scalar) then
60
maplematrix:=convert([[expr]],matrix);
61
elif type(expr,matrix) then
64
maplematrix:=convert(expr,matrix);
67
if type(parameters,name) then
69
elif type(parameters,list) then
72
`maple2scilab/error`(`"parameters" argument must be a name or a list`)
75
if type(eval(k),name) then next;
76
elif type(eval(k),vector) or type(eval(k),matrix) then
77
if entries(eval(k))<>NULL then
78
`maple2scilab/error`(`matrix or vector parameter "`.k.
79
`" must not have entries`);
82
`maple2scilab/error`(`a parameter must be a name, a vector or a matrix`);
85
if code<>'f' and code<>'c' and code<>'s' then
86
`maple2scilab/error`(`code must be 'f' (Fortran), 'c' (C) or 's' (Scilab)`);
89
if nargs=5 then lpath:=cat(args[5],`/`); fi;
90
_ifunc:=linalg[indexfunc](maplematrix);
91
if (_ifunc<>NULL and _ifunc<>'sparse') then
92
`maple2scilab/error`(``.`matrix with index function "`._ifunc.
95
# look for Maple release number
96
release:=interface(version):
97
if SearchText(`Release 4`,release) <> 0 then
99
elif SearchText(`Release 5`,release) <> 0 then
102
ERROR(`Unknown Maple release`):
105
if not assigned(macrofor) then
106
# load Macrofort according to Maple release number
108
if assigned(optimized) then
109
soptimized:=optimized;
112
readshare(macrofor,'numerics');
116
optimized:=soptimized;
118
ffile:=cat(``.lpath,fname,`.f`);
120
`maple2scilab/make_fortran`(fname,maplematrix,para);
123
if not assigned(macroC) then
125
if assigned(optimized) then
126
soptimized:=optimized;
128
# load MacroC according to Maple release number
130
readshare(macroC,'numerics');
134
optimized:=soptimized;
136
ffile:=cat(``.lpath,fname,`.c`);
138
`maple2scilab/make_c`(fname,maplematrix,para);
141
ffile:=cat(``.lpath,fname,`.sci`);
142
`maple2scilab/scilab`(fname,expr,ffile,para);
144
lprint(`Scilab file created: `.ffile);
146
lprint(`Usage in Scilab: getf('`.ffile.`');`);
147
lprint(` `._scicall);
148
interface(quiet=_old_quiet);
149
interface(labelling=_old_labelling);
150
interface(screenwidth=_old_screenwidth);
153
# generate Scilab code
154
sfile:=cat(``.lpath,fname,`.sci`);
156
`maple2scilab/make_scilab_interface`(fname,maplematrix,para,code);
160
lprint(`Fortran file created (to be compiled): `.ffile);
162
lprint(`C file created (to be compiled): `.ffile);
164
ofile:=cat(``.lpath,fname,`.o`);
165
lprint(`Scilab file created: `.sfile);
167
lprint(`Usage in Scilab: link('`.ofile.`','`.fname.`');`);
168
lprint(` getf('`.sfile.`');`);
169
lprint(` `._scicall);
170
interface(quiet=_old_quiet);
171
interface(labelling=_old_labelling);
172
interface(screenwidth=_old_screenwidth);
176
`maple2scilab/error`:=proc(message)
177
interface(quiet=_old_quiet);
178
interface(labelling=_old_labelling);
179
interface(screenwidth=_old_screenwidth);
183
# This procedure generates the Fortran subroutine
184
# corresponding to the maple matrix "maplematrix".
185
# If the matrix is not sparse, the Fortran subroutine is
186
# fname(x1,x2,...,xn,fmat); it computes fmat(i,j) as a function of
187
# the arguments x1,x2,...,xn.
188
# If the matrix is sparse, the Fortran subroutine is
189
# fname(x1,x2,...,xn,ij,v,mn); it computes v(i) as a function of
190
# the arguments x1,x2,...,xn. ij and mn are used for creating the
191
# Scilab sparse matrix.
192
# Each argument can be a maple scalar, vector or matrix which should be
193
# in the list "arguments".
195
`maple2scilab/make_fortran`:=proc(fname,maplematrix,arguments)
196
global _ifunc,optimized;
197
local ent,flist,fmat,ij,ind,k,listarg,ll,mn,nent,soptimized,v;
200
if arguments<>[] then
201
for k in arguments do
202
if type(eval(k),name) then
203
listarg:=[op(listarg),k];
204
elif type(eval(k),vector) then
205
listarg:=[op(listarg),k[linalg[vectdim](eval(k))]];
206
elif type(eval(k),matrix) then
207
listarg:=[op(listarg),
208
k[linalg[rowdim](eval(k)),linalg[coldim](eval(k))]];
211
if listarg<>[] then ll:=['declaref','doubleprecision',listarg]; fi;
214
flist:=['subroutinem',fname,[op(arguments),'fmat'],
216
['commentf',`Function generated by Maple to Scilab interface`],
218
['declaref',`implicit doubleprecision`,[`(a-h,o-z)`]],
220
['declaref','dimension',
221
[fmat[linalg[rowdim](maplematrix),linalg[coldim](maplematrix)]]],
222
['matrixm','fmat',maplematrix]]];
223
elif _ifunc='sparse' then
224
ind:=matrix([indices(maplematrix)]);
225
ent:=vector(map(op,[entries(maplematrix)]));
226
nent:=linalg[vectdim](ent);
227
flist:=['subroutinem',fname,[op(arguments),'ij','v','mn'],
229
['commentf',`Function generated by Maple to Scilab interface`],
231
['declaref',`implicit doubleprecision`,[`(a-h,o-z)`]],
233
['declaref','dimension',
234
[ij[nent,2],v[nent],mn[2]]],
235
['equalf',mn[1],linalg[rowdim](maplematrix)],
236
['equalf',mn[2],linalg[coldim](maplematrix)],
237
['matrixm','ij',ind],
238
['matrixm','v',ent]]];
241
if assigned(optimized) then
242
soptimized:=optimized;
245
optimized:=soptimized;
249
# This procedure generates the C function
250
# corresponding to the maple matrix "maplematrix".
251
# If the matrix is not sparse, the C function is
252
# void fname(x1,x2,...,xn,fmat); it computes fmat(i,j) as a function of
253
# the arguments x1,x2,...,xn.
254
# If the matrix is sparse, the C function is
255
# void fname(x1,x2,...,xn,ij,v,mn); it computes v(i) as a function of
256
# the arguments x1,x2,...,xn. ij and mn are used for creating the
257
# Scilab sparse matrix.
258
# Each argument can be a maple scalar, vector or matrix which should be
259
# in the list "arguments".
261
`maple2scilab/make_c`:=proc(fname,maplematrix,arguments)
262
global _ifunc,autodeclare,machine_include,optimized,precision;
263
local dcl,ent,flist,fmat,i,ij,include,ind,j,k,kk,listarg,m,mn,n,nent,
265
if not assigned(machine_include) then
266
include:=`SCILAB_DIRECTORY/routines/machine.h`;
268
include:=machine_include;
272
if arguments<>[] then
273
for k in arguments do
274
if type(eval(k),name) then
275
listarg:=[op(listarg),``.`*arg_`.k];
276
dcl:=[op(dcl),['declareC','double',[``.k.`=*arg_`.k]]];
277
elif type(eval(k),vector) then
279
listarg:=[op(listarg),kk[linalg[vectdim](eval(k))+1]];
280
elif type(eval(k),matrix) then
282
listarg:=[op(listarg),kk[linalg[rowdim](eval(k))+1,
283
linalg[coldim](eval(k))+1]];
287
m:=linalg[rowdim](maplematrix); n:=linalg[coldim](maplematrix);
289
flist:=[['commentC',` Function generated by Maple to Scilab interface `],[],
290
['includeC',` "`.include.`" `],
291
['includeC',`<math.h>`],[],
292
['functionm','void',``.`C2F(`.fname.`)`,
293
[['double',[op(listarg),fmat[n+1,m+1]]]],
294
[op(dcl),['matrixm','fmat',linalg[transpose](maplematrix)]]]];
295
elif _ifunc='sparse' then
296
ind:=matrix([indices(maplematrix)]);
297
ent:=vector(map(op,[entries(maplematrix)]));
298
nent:=linalg[vectdim](ent);
299
flist:=[['commentC',` Function generated by Maple to Scilab interface `],[],
300
['includeC',` "`.include.`" `],
301
['includeC',`<math.h>`],[],
302
['functionm','void',``.`C2F(`.fname.`)`,
303
[['double',[op(listarg)]],['int',[ij[3,nent+1]]],
304
['double',[`*v`]],['int',[`*mn`]]],
305
[op(dcl),[equalC,mn[1],m], [equalC,mn[2],n],
306
['matrixm','ij',linalg[transpose](ind)],
307
['matrixm','v',ent]]]];
310
if assigned(optimized) then
311
soptimized:=optimized;
314
optimized:=soptimized;
315
autodeclare:='double';
320
# This procedure generates the Scilab function "fname" which calls
321
# the fortran subroutine "fname".
323
`maple2scilab/make_scilab_interface`:=proc(fname,maplematrix,arguments,code)
324
local a,chain,ff,first,k,kk,l1,l2,naargs,nent,rest,snd,ss:
327
naargs:=nops(arguments);
329
if arguments<>[] then
330
ff:=cat(ff,arguments[1]);
333
ff:=cat(ff,`,`,arguments[k]); k:=k+1;
337
_scicall:=cat(`out=`,fname,ff);
338
ff:=cat(`function [out]=`,fname,ff);
341
if length(ff)>70 then
342
while length(rest)>70 do
343
first[l1]:=cat(substring(rest,1..70),`...`);
345
first[l1]:=substring(rest,71..length(rest));
353
ss:=cat(`out=fort(`,`'`,fname,`',`);
354
elif _ifunc='sparse' then
355
ss:=cat(`[ij,v,mn]=fort(`,`'`,fname,`',`);
358
if arguments<>[] then
359
for kk in arguments do
361
if type(eval(kk),matrix) and code='c' then a:=cat(a,`'`); fi;
362
chain:=cat(a,`,`,k,`,`,`'d',`);
367
ss:=cat(ss,`'out',`);
369
ss:=cat(ss,`[`,linalg[rowdim](maplematrix),`,`,
370
linalg[coldim](maplematrix),`],`,naargs+1,`,'d')`);
371
elif _ifunc='sparse' then
372
nent:=nops([entries(maplematrix)]);
373
ss:=cat(ss,`[`,nent,`,`,2,`],`,naargs+1,`,'i',`,
374
`[`,nent,`,1],`,naargs+2,`,'d',`,
375
`[2,1],`,naargs+3,`,'i')`);
379
if length(ss)>70 then
380
while length(rest)>70 do
381
snd[l2]:=cat(substring(rest,1..70),`...`);
383
snd[l2]:=substring(rest,71..length(rest));
390
lprint(`// Function generated by Maple to Scilab interface`);
391
for k from 1 to l1 do lprint(first[k]); od;
392
for k from 0 to l2 do lprint(snd[k]); od;
393
if _ifunc='sparse' then
394
lprint(`out=sparse(ij,v,mn)`);
398
# This procedure generates directly the Scilab function
399
# corresponding to the maple expression "e".
400
# The Scilab function is fname(x1,x2,...,xn).
401
# Each argument can be a maple scalar, vector or matrix which should be
402
# in the list "arguments".
404
`maple2scilab/scilab` := proc(fname,e,file,arguments)
406
bres := traperror(`scilab/scilab1`(fname,e,file,arguments));
408
if bres = lasterror then print(`maple2scilab/scilab`,lasterror) fi;
411
`scilab/scilab1` := proc(fname,e,file,arguments)
412
global _ifunc,_scicall,_scilab_buffer,_scilab_level;
413
local ent,ind,k,naargs,str;
416
if type(e,'procedure') and type(e,'name') then
417
ERROR(`unable to translate a procedure to Scilab`,e);
419
naargs:=nops(arguments);
421
if arguments<>[] then
422
str:=cat(str,arguments[1]);
425
str:=cat(str,`,`,arguments[k]); k:=k+1;
429
_scicall:=cat(`out=`,fname,str);
430
str:=cat(`function [out]=`,fname,str);
431
`scilab/lprint`(str);
432
str := `// Function generated by Maple to Scilab interface`;
433
`scilab/lprint`(str);
435
_scilab_buffer := `out=`;
436
`scilab/expression`(e);
437
`scilab/lprint`(_scilab_buffer);
438
elif _ifunc='sparse' then
439
ind:=matrix([indices(e)]);
440
ent:=vector(map(op,[entries(e)]));
441
_scilab_buffer := `ij=`;
442
`scilab/expression`(ind);
443
`scilab/lprint`(_scilab_buffer);
444
_scilab_buffer := `v=`;
445
`scilab/expression`(ent);
446
`scilab/lprint`(_scilab_buffer);
447
str := cat(`out=sparse(ij,v,[`,linalg[rowdim](e),`,`,
448
linalg[coldim](e),`])`);
449
`scilab/lprint`(str);
454
`scilab/space` := proc(n)
455
if n = 0 then `` else map(cat,` `$n) fi
458
`scilab/lprint` := proc(str)
459
global _scilab_level;
461
stro := cat(`scilab/space`(_scilab_level),str);
465
`scilab/write` := proc(e) local d, l, maxl, stro;
466
global _scilab_buffer,_scilab_level;
469
stro := cat(`scilab/space`(_scilab_level),_scilab_buffer);
470
d := length(stro) + l - (maxl - 2);
471
if d <= 0 then _scilab_buffer := cat(_scilab_buffer,e);
473
_scilab_buffer := cat(stro,substring(e,1..l-d),`..`);
474
lprint(_scilab_buffer);
475
_scilab_buffer := substring(e,l-d+1..l);
479
`scilab/expression` := proc(e) local a;
480
if type(e,'array') and type(e,name) then `scilab/array`(e)
481
elif type(e,'array') then a:=e; `scilab/array`(a)
482
elif type(e,'algebraic') then `scilab/alg`(e);
483
elif type(e,'list') then `scilab/list`(e);
485
ERROR(`unable to translate to Scilab`,e);
489
`scilab/array` := proc(a) local i,j,ins,d,i1,i2,j1,j2;
490
global _scilab_buffer;
494
`scilab/write`(`[`); `scilab/lprint`(_scilab_buffer);
495
for i from op(1,ins) to op(2,ins) do
498
`scilab/lprint`(``._scilab_buffer.`;`);
501
`scilab/lprint`(`]`);
503
`scilab/write`(`[[`); `scilab/lprint`(_scilab_buffer);
504
j1 := op(1,op(2,[ins]));
505
j2 := op(2,op(2,[ins]));
506
i1 := op(1,op(1,[ins]));
507
i2 := op(2,op(1,[ins]));
508
for j from j1 to j2 do
509
for i from i1 to i2 do
511
`scilab/alg`(a[i,j]);
512
`scilab/lprint`(``._scilab_buffer.`;`);
516
`scilab/lprint`(`],[`) fi;
519
`scilab/lprint`(`]]`);
521
ERROR(`unable to translate to Scilab`);
525
`scilab/alg` := proc(e) local k,p,s;
526
if type(e,'float') then `scilab/write`(`scilab/float`(evalf(e)))
527
elif type(e,'integer') then `scilab/write`(`scilab/integer`(e))
528
elif (e = Pi) then `scilab/write`(`%pi`)
529
elif (e = E) then `scilab/write`(`%e`)
530
elif (e = I) then `scilab/write`(`%i`)
532
elif type(e,`*`) then
534
if op(1,e) + 1 = 0 then
536
p := nops(e) = 2 and `scilab/precedence`(op(2,e)) <= 50;
537
if p then `scilab/write`(`(`) fi;
538
`scilab/alg`(subsop(1=1,e));
539
if p then `scilab/write`(`)`) fi;
541
elif type(op(1,e),'fraction') and
542
(op(1,op(1,e)) = 1 or op(1,op(1,e)) = -1) then
543
if op(1,e) < 0 then `scilab/write`(`-`) fi;
544
p := nops(e) = 2 and `scilab/precedence`(op(2,e)) <= 50;
545
if p then `scilab/write`(`(`) fi;
546
`scilab/alg`(subsop(1=1,e));
547
if p then `scilab/write`(`)`) fi;
548
`scilab/write`(`/`.(op(2,op(1,e))));
552
p := `scilab/precedence`(e,1);
553
if p then `scilab/write`(`(`) fi;
554
`scilab/alg`(op(1,e));
555
if p then `scilab/write`(`)`) fi;
556
for k from 2 to nops(e) do
557
if type(op(k,e),`^`) and type(op(2,op(k,e)),'numeric')
558
and sign(op(2,op(k,e))) = -1
559
then s := op(1,op(k,e))^(-op(2,op(k,e)));
561
else s := op(k,e); `scilab/write`(`*`)
563
p := `scilab/precedence`(s) < `scilab/precedence`(e);
564
if p then `scilab/write`(`(`) fi;
566
if p then `scilab/write`(`)`) fi;
569
elif type(e,`^`) then
571
if type(op(2,e),'rational') and op(2,e) < 0 then
572
p := `scilab/precedence`(op(1,e));
573
`scilab/write`(`1/`);
574
if p < 70 then `scilab/write`(`(`) fi;
575
`scilab/alg`(op(1,e)^(-op(2,e)));
576
if p < 70 then `scilab/write`(`)`) fi;
577
elif type(op(1,e),'name') and type(op(2,e),'integer') then
578
`scilab/write`(cat(convert(op(1,e),string),`**`,op(2,e)) )
579
elif type(op(2,e),'fraction') and op(2,op(2,e))=2 then
580
s := op(1,e)^op(1,op(2,e));
581
`scilab/alg`('sqrt'(s))
582
else p := `scilab/precedence`(e,1);
583
if p then `scilab/write`(`(`) fi;
584
`scilab/alg`(op(1,e));
585
if p then `scilab/write`(`)`) fi;
586
`scilab/write`(`**`);
587
p := `scilab/precedence`(e,2);
588
if p then `scilab/write`(`(`) fi;
589
`scilab/alg`(op(2,e));
590
if p then `scilab/write`(`)`) fi;
593
elif type(e,`+`) then
594
p := `scilab/precedence`(e,1);
595
if p then `scilab/write`(`(`) fi;
596
`scilab/alg`(op(1,e));
597
if p then `scilab/write`(`)`) fi;
598
for k from 2 to nops(e) do
599
if not (type(op(k,e),'numeric') and op(k,e) < 0 or
600
type(op(k,e),`*`) and type(op(1,op(k,e)),'numeric')
601
and sign(op(1,op(k,e))) = -1)
602
then `scilab/write`(`+`) fi;
603
p := `scilab/precedence`(e,k);
604
if p then `scilab/write`(`(`) fi;
605
`scilab/alg`(op(k,e));
606
if p then `scilab/write`(`)`) fi;
609
elif type(e,'function') then
610
`scilab/function`(op(0,e),op(e))
612
elif type(e,'indexed') then
613
if (op(0,e) = `&args`) then
614
`scilab/write`(_larg[op(1,op(1,e))])
615
elif (op(0,e) = `&local`) then
616
`scilab/write`(_lcal[op(1,op(1,e))])
618
`scilab/alg`(op(0,e));
620
if type(op(1,e),'function') and (op(0,op(1,e)) = `&expseq`) then
623
`scilab/alg`(op(1,s));
624
for k from 2 to nops(s) do
626
`scilab/alg`(op(k,s))
631
elif type(e,'name') then `scilab/write`(e)
633
elif type(e,'fraction') then
634
`scilab/alg`(evalf(op(1,e)));
635
`scilab/write`('`/`');
636
`scilab/alg`(evalf(op(2,e)));
638
else ERROR(`unable to translate to Scilab`,e);
643
`scilab/function` := proc(f) local k;
644
if (nargs > 1) and type(args[2],'function') and
645
(op(0,args[2]) = `&expseq`) then
646
`scilab/function`(args[1],op(args[2]))
647
elif f = `&ev` then `scilab/ev`(args[2])
648
elif f = 'evalm' then `scilab/evalm`(args[2..nargs])
652
`scilab/alg`(args[2]);
653
for k from 3 to nargs do
655
`scilab/alg`(args[k])
659
elif f = 'multiply' then
662
`scilab/alg`(args[2]);
663
for k from 3 to nargs do
665
`scilab/alg`(args[k])
669
elif f = 'inverse' then
670
`scilab/write`(`(1/`);
671
if nargs < 2 then ERROR(`inverse must have one argument`) fi;
672
`scilab/alg`(args[2]);
675
`scilab/function_name`(f));
678
if type(args[2],'integer')
679
then `scilab/write`(`scilab/float`(evalf(args[2])))
680
else `scilab/alg`(args[2])
682
for k from 3 to nargs do
684
if type(args[k],'integer')
685
then `scilab/write`(`scilab/float`(evalf(args[k])))
686
else `scilab/alg`(args[k])
691
if (f = 'transpose') or (f = linalg['transpose']) then
692
`scilab/write`(`'`) fi
696
`scilab/evalm` := proc()
697
ERROR(`unable to translate evalm to Scilab`);
700
`scilab/list` := proc(e) local k,s;
701
`scilab/write`(`list(`);
703
if type(op(1,e),'function') and (op(0,op(1,e)) = `&expseq`) then
706
`scilab/expression`(op(1,s));
707
for k from 2 to nops(s) do
709
`scilab/expression`(op(k,s))
715
`scilab/precedence` := proc(e,k)
716
option `Copyright 1989 by the University of Waterloo`;
719
if type(e,'name') then 99
720
elif type(e,'integer') and e > 0 then 99
721
elif type(e,`*`) then 70
722
elif type(e,`+`) then 50
723
elif type(e,`^`) then 80
724
elif type(e,'float') and e > 0 then 99
725
elif type(e,'function') or type(e,'indexed') then 99
726
elif type(e,'rational') then 70
727
elif type(e,'integer') then 60
728
elif type(e,'float') then 60
729
elif type(e,`=`) or type(e,`<`) or type(e,`<=`) or type(e,`<>`) then 40
730
elif type(e,`not`) then 30
731
elif type(e,`and`) then 20
732
elif type(e,`or`) then 10
735
elif type(e,`*`) and k = 1 and type(op(1,e),'numeric') then false
736
elif type(e,`^`) and k = 1 and type(op(1,e),`^`) then true
737
else `scilab/precedence`(e) > `scilab/precedence`(op(k,e))
742
`scilab/float` := proc(f) local mantissa,exponent,letter,quotient,prefix;
744
then mantissa := 0; exponent := 0
745
else mantissa := op(1,f); exponent := op(2,f) fi;
746
if exponent = 0 and mantissa < 1000000 then
747
RETURN( cat(mantissa,`.0`) )
752
mantissa := -mantissa
755
while irem(mantissa,10,'quotient') = 0 do
756
mantissa := quotient;
757
exponent := exponent+1
759
exponent := exponent+length(mantissa);
760
cat(prefix,mantissa,letter,exponent)
763
`scilab/integer` := proc(e)
764
if length(e) > Digits then
765
`m_fortran/float`(evalf(e))
770
`scilab/bool` := proc(c)
771
if member(whattype(c),{`=`,`<`,`>`,`<=`,`>=`,`<>`}) then
772
`scilab/alg`(op(1,c));
773
`scilab/write`(whattype(c));
774
`scilab/alg`(op(2,c));
776
`scilab/write`(`1=1`)
778
`scilab/write`(`1=0`)
779
else ERROR(`unable to translate to Scilab`,c)
783
`scilab/function_name` := proc(f) f end:
785
`scilab/function_name`('arctanh') := 'atanh':
786
`scilab/function_name`('arctan') := 'atan':
787
`scilab/function_name`('arcsin') := 'asin':
788
`scilab/function_name`('arcsinh') := 'asinh':
789
`scilab/function_name`('arccos') := 'acos':
790
`scilab/function_name`('arccosh') := 'acosh':
791
`scilab/function_name`('cot') := 'cotg':
792
`scilab/function_name`('ln') := 'log':
793
`scilab/function_name`('transpose') := ``: