Exporting data in a 2 by n matrix.

Hi everybody,

I'm using Maple 9.5 on a mandriva station to do some analysis for my PhD. In the end, I get a plot with 2 curves : one is continuous, and the other isn't (it's a kind of Heaviside).

I didn't find a way to do a proper plot, including greek symbols, and formulas in the legends with maple... For this reason, I decided to export the results from my plot to a file containing on each line couples (x, y) and then plot it properly with another tool (gnuplot...).

At first, I thought of including in a single file my different curves, putting on each line (x, y1, y2, ...). I abandonned that idea because I realized that the number of point used for a plot could change depending on the function.

My problem is that when the function is discontinuous (let's say Heaviside(x)), if I try to collect the data into A by :

a:=plot(Heaviside(x), x=-1..1);
A:= op(1, op(1, a));

then, I get only the points from -1 to 0... But not the second part... How can I get everything in? I tried to add "discont = true" into the plot, but it didn't changed anything!

Anyone has an idea?

And the second problem is that I can't explicitly and precisely fix the number of points. if I say numpoints = 200, then it'll take 211 for some function, and if I say 211 points, then it'll take 222 points, etc..

Any idea for that too?

Thanks a lot!

 

With your commands

a:=plot(Heaviside(x), x=-1..1);
A:= op(1, op(1, a));

I get in A a list of [x,y] lists, in the range -1<=x<=1, using both Maple 9.5 and Maple 12.

See ?plot,options, for option adaptive false.

Robert Israel's picture

Why plot?

Why do you need to get the list of points from the plot command?  It would be much simpler to just construct your A directly something like

> A := [seq( [X[i], evalf(f(X[i]))], i = 1 .. nops(X))];

where X is the list of x values you want to use.

Thanks!

Thanks a lot!

I didn't thought of doing a list, but ir worked perfectly fine! And it solved both problems at once!

Thanks again

Zguywood

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}