On 02.08.2018 18:42, Riccardo GUIDA wrote:
...
>
> PS2: could you give a link to the asymptote wrapper?
>
I've searched a while, unfortunately only parts of it were rediscovered.
The "asy" package works interactively (i.e. you need the 'pipe' package which
requires SBCL exclusively at the moment), however, I couldn't find the Asymptote
package itself (must be on a drive at home, will revert when back). A
non-interactive "asy" (e.g. graph) should work along the lines of gnudraw or
gle.spad (attached). Feel free to provide one ;-)
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.
)abbrev package GLE GraphicsLayoutEngine
++ Author:
++ Ideas from GDRAW by Bill Page and David Cyganski
++ Date: November 11, 2014
++ Description:
++ This package provides support for GLE.
EF ==> Expression Float
SBF ==> SegmentBinding Float
DROP ==> DrawOption
DROP0 ==> DrawOptionFunctions0
STR ==> String
LDF ==> List DoubleFloat
GraphicsLayoutEngine(): with
GLE:(EF, SBF, SBF, STR, List DROP)->Void
++ \spad{GLE} provides 3d surface plotting with options
GLE:(EF, SBF, SBF, STR)->Void
++ \spad{GLE} provides 3d surface plotting, default options
== add
-- 3-d plotting
GLE(f:EF,segbind1:SBF, segbind2:SBF, filename:STR, opts:List DROP):Void ==
import SubSpace, ThreeSpace DoubleFloat, TopLevelDrawFunctions EF
datfile:STR:=concat [filename,".dat"]
glefile:STR:=concat [filename,".gle"]
zfile:STR :=concat [filename,".z"]
f1:TextFile:=open(datfile::FileName,"output")
-- process optional parameters
---writeLine!(f1,concat(["set title _"",title(opts,"")$DROP0,"_""]))
---writeLine!(f1,"splot '-' title '' with pm3d")
-- extract data as List List Point DoubleFloat
p2:=mesh(subspace(draw(f, segbind1, segbind2)));
for p1 in p2 repeat
for p in p1 repeat
writeLine!(f1,concat([unparse(convert(p.1)@InputForm)," ",
unparse(convert(p.2)@InputForm)," ",
unparse(convert(p.3)@InputForm)]))
--writeLine!(f1); -- blank line need to mark a "branch"
close! f1
f2:TextFile:=open(glefile::FileName,"output")
writeLine!(f2,"begin fitz")
writeLine!(f2,concat[" data ","_"",datfile,"_""])
writeLine!(f2," x from 0 to 1 step 0.03")
writeLine!(f2," y from 0 to 1 step 0.03")
writeLine!(f2," ncontour 6")
writeLine!(f2,"end fitz")
writeLine!(f2)
writeLine!(f2,"begin surface")
writeLine!(f2," size 18 18")
writeLine!(f2,concat[" data ","_"",zfile,"_""])
writeLine!(f2,concat[" points ","_"",datfile,"_""])
writeLine!(f2,"top color orange")
writeLine!(f2,"underneath color blue")
writeLine!(f2," harray 5000")
writeLine!(f2,"end surface")
close! f2
-- use )sys gle /preview glefile
-- default title is ""
GLE(f:EF,segbind1:SBF, segbind2:SBF, filename:STR):Void ==
GLE(f,segbind1,segbind2,filename,[title("")$DROP])
)lisp (defun |spadPipe| (app &optional args)(let ((proc (sb-ext:run-program app
args :input :stream :output :stream :wait nil :search t)))(when proc
(make-two-way-stream (sb-ext:process-output proc) (sb-ext:process-input
proc)))))
)lisp (defun |readPipe| (stream)(with-output-to-string (out)(loop for c =
(read-char-no-hang stream) while c do (write-char c out))))
--)lisp (load "pipe.lisp")
)abbrev package PIPE SpadPipe
++ Author: Kurt Pagani <[email protected]>
++ Date Created: Mon Nov 23 13:30:24 CET 2015
++ License: BSD
++ Date Last Updated:
++ Keywords:
++ Examples:
++ References:
++ Documentation:
++ Description: interfacing interactive programs
++ Notes: SBCL only at the moment
SpadPipe() : Exports == Implementation where
Exports == with
run : (String,List String) -> SExpression
write : (String,SExpression) -> SExpression
writeln : (String,SExpression) -> SExpression
readNoHang : SExpression -> String
readln : SExpression -> String
close : SExpression -> SExpression
Implementation == add
run(s:String,a:List String):SExpression ==
stream:=spadPipe(s,a)$Lisp
write(s,x) == FORMAT(x,"~a~%",s)$Lisp
writeln(s,x) ==
write(s,x)
FINISH_-OUTPUT(x)$Lisp
readln(x) == READ_-LINE(x)$Lisp
readNoHang(x) == readPipe(x)$Lisp
close(x) == CLOSE(x)$Lisp
-- stream:=run("pure",["-i","-q"])
-- readNoHang(stream)
-- writeln("1+2;",stream)
-- readln(stream)
-- writeln("quit",stream)
-- close(stream)
-- stream:=run("python",["-i"])
-- readNoHang(stream)
-- writeln("1+2",stream)
-- readln(stream)
-- writeln("quit()",stream)
-- close(stream)
-- stream:=run("asy",[])
-- readNoHang(stream)
-- writeln("import graph;",stream)
-- writeln(" size(200,150,IgnoreAspect);",stream)
-- writeln("real[] x={0,1,2,3};",stream)
-- writeln("real[] y=x^2;",stream)
-- writeln("xaxis(\"$x$\",BottomTop,LeftTicks);",stream)
-- writeln("yaxis(\"$y$\",LeftRight,RightTicks(Label(fontsize(8pt)),new
real[]{0,4,9}));",stream)
-- readlnNoHang(stream)
-- writeln("draw(graph(x,y),red);",stream)
--