List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Re: plots from Maple
| [MUG] Re: plots from Maple |
|
Author: Maple User Group
Posted: Tue, 22 Oct 2002 17:03:16 -0400
|
>> From: Maple User Group "maple_gr"
| >> From: Malte HENKEL "henkel"
| Now, HOW do I get the data created by this plot into a text file
| and in the form:
| 1st column with values of x 2nd column with values of f(x)
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 18 Oct 2002 17:20:45 -0700 (PDT)
From: Robert Israel "israel"
To: "maple-list"
Subject: plots from Maple
Maple 4? I hope you mean Maple V Release 4.
If you examine the plot structure created by this command, you find
that the first operand is a CURVES object, whose first operand is the
list of points you want. You can print the points in the format
you want using fprintf. For Release 4, you need to use a name (delimited
by `...`) rather than a string ("...") which you would use in more modern
versions. For example:
> maple_to_file:= proc(P, fname)
local L, pt;
L:= op([1,1],P);
for pt in L do
fprintf(fname, `%f %f\n`, pt[1], pt[2])
od;
fclose(fname);
end;
Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sat, 19 Oct 2002 15:03:46 -0800
To: "maple-list"
From: "Mark Fitch" "afmaf"
Subject: plots from Maple
The output of any plot command is a PLOT structure which includes the list
of points. You only need to discard the extra parameters before writing
them to file.
Mark A. Fitch
"The heavens declare the glory of God" Psalm 19
"mfitch"
3321 E. 42nd Ave. Apt. C, Anchorage AK, 99508 USA
(907) 562-2528
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: Stanley J Houghton "S.J.Houghton"
Date: Mon, 21 Oct 2002 13:23:01 +0100
To: "henkel" "maple-list"
Subject: plots from Maple
Try someting along the lines of
> f := x-> sin(x*Pi);
> a:=plot(f(x),x=0..1):
> b:=op([1,1],select(has,[op(a)],`CURVES`)):
> fd := open("c:/TestFile.txt",WRITE):
> for i to nops(b) do
> fprintf(fd,"%f,%f\n",b[i][1],b[i][2])
> od:
> close(fd);
I have long since disposed of my Maple 4 but if op([1,1],e) doesn't
work, try op(1,op(1,e)) instead.
For different formatting see the help pages for function fprintf.
Hope it helps
Stan
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Mon, 21 Oct 2002 14:43:07 -0400 (EDT)
From: Carl Devore "devore"
To: "maple-list"
Subject: plots from Maple
maple_to_file:= (p,f)-> writedata(f,op([1,1],p));
|
[View Complete Thread]
Previous by date: [MUG] Re: convert question, Carl Eberhart
Next by date: [MUG] Matrix and filling it up, Caroline Ibrahim
Previous thread: [MUG] Maple and Octave, Brad Camroux
Next thread: [MUG] Matrix and filling it up, Caroline Ibrahim
|