PatrickT

Dr. Patrick T

2108 Reputation

18 Badges

16 years, 301 days

MaplePrimes Activity


These are replies submitted by PatrickT

@acer 

You're right, there's only one image there. I hadn't noticed, thanks a lot acer for pointing this out. I know what happened. My images were named:

127477-Maple-Resolution-Problem_p50.gif
127477-Maple-Resolution-Problem_p500.gif
127477-Maple-Resolution-Problem_p5000.gif

and mapleprimes cannot handle long file names. I can't remember now, but I think the limit is 18 or 20 characters, so it couldn't tell the difference between them and, as a result, would only keep one of them at a time. I experienced this problem a few months ago but had forgotten about it. Thanks.

Apparently ImportMatrix has problems importing the data ExportMatrix created...


Error, (in ImportMatrix) cannot interpret file


The same datafile manually cleaned up of the lines containing

1.#QNAN00000000000e+000,1.#QNAN00000000000e+000,1.#QNAN00000000000e+000

can be reimported without any problem.

Thus I need to find a way to clean up the plot Arrays BEFORE exporting the data with ExportMatrix.

Apparently ImportMatrix has problems importing the data ExportMatrix created...


Error, (in ImportMatrix) cannot interpret file


The same datafile manually cleaned up of the lines containing

1.#QNAN00000000000e+000,1.#QNAN00000000000e+000,1.#QNAN00000000000e+000

can be reimported without any problem.

Thus I need to find a way to clean up the plot Arrays BEFORE exporting the data with ExportMatrix.

@Markiyan Hirnyk 

Here are the exported plots, as explained above, p5000, p500, p50, Can you really see in which order I have included them?

EDIT: url fixed

@Markiyan Hirnyk 

Here are the exported plots, as explained above, p5000, p500, p50, Can you really see in which order I have included them?

EDIT: url fixed

The following exports the colors from the sequence of plots, in a single column data file with 50 entries:

ExportColors := proc(p::evaln)
  local thecolors, thedir, thename, i, n :
  thedir := cat(currentdir(),kernelopts(dirsep),data,kernelopts(dirsep)) :
  thename := cat(convert(p,string),"_",colors,".txt") :
  n := nops([eval(p)]);
  thecolors := Matrix(n,1):
  for i from 1 to n do
    thecolors[i] := op([eval(i),-1],[eval(p)]);
    ExportMatrix(cat(thedir,thename), thecolors, delimiter=",");
  end do;
end proc:
ExportColors(myPlot);

The following exports the colors from the sequence of plots, in a single column data file with 50 entries:

ExportColors := proc(p::evaln)
  local thecolors, thedir, thename, i, n :
  thedir := cat(currentdir(),kernelopts(dirsep),data,kernelopts(dirsep)) :
  thename := cat(convert(p,string),"_",colors,".txt") :
  n := nops([eval(p)]);
  thecolors := Matrix(n,1):
  for i from 1 to n do
    thecolors[i] := op([eval(i),-1],[eval(p)]);
    ExportMatrix(cat(thedir,thename), thecolors, delimiter=",");
  end do;
end proc:
ExportColors(myPlot);

Preben, thanks a lot, this is working great!

As I have N:=50; trajectories to export, I wrote a loop, to export each trajectory into a file named data_i.txt:

thedata := plottools:-getdata~([myPlot]):

for i from 1 to N do
  thedir := cat(currentdir(),kernelopts(dirsep),data,kernelopts(dirsep)) :
  thename := cat(data,"_",convert(i,string),".txt") :
  ExportMatrix(cat(thedir,thename), op([i,-1],thedata), delimiter=",");
  end do :

I then wrote a procedure, to make it applicable to other plot data I want to export:

ExportData := proc(p::evaln)
  local thedata, thedir, thename, i, n :
  thedata := plottools:-getdata~([eval(p)]) :
  thedir := cat(currentdir(),kernelopts(dirsep),data,kernelopts(dirsep)) :
  n := nops([eval(p)]);
  for i from 1 to n do
    thename := cat(convert(p,string),"_",i,".txt") :
    ExportMatrix(cat(thedir,thename), op([eval(i),-1],thedata), delimiter=",");
  end do;
end proc:
ExportData(myPlot);

I'm sure there are awkward bits in the procedure code, but it appears to work.

[ Note: I used proc(p::evaln) because that appeared to be the way to have the procedure return the name of the plot sequence as part of the name of the exported data file, as in "myPlot_1" ... "myPlot_50", but above all because I couldn't get the proc to work without it, but as a result I had to write eval(p) and eval(i) in place of simply p and i. ]

My next task will be to clean up the datasets (before or after export, whichever works first), by removing all the lines of the form

1.#QNAN00000000000e+000,1.#QNAN00000000000e+000,1.#QNAN00000000000e+000

These lines appear to be associated with values inside the Array of the form [HFloat(undefined),HFloat(undefined),HFloat(undefined)]. My Array contains, literally, thousands of those instances (a little over 2000 of them!). Probably the result of something silly I'm doing when generating the odeplot. I can probably use selectremove or something similar to remove them, I need to look into it.

For the record, I can export the color of the lines from my plot sequence as follows.

op([1,-1],[myPlot]);

I'll try to remember this.

thanks Preben, you've helped me a gread deal.

Preben, thanks a lot, this is working great!

As I have N:=50; trajectories to export, I wrote a loop, to export each trajectory into a file named data_i.txt:

thedata := plottools:-getdata~([myPlot]):

for i from 1 to N do
  thedir := cat(currentdir(),kernelopts(dirsep),data,kernelopts(dirsep)) :
  thename := cat(data,"_",convert(i,string),".txt") :
  ExportMatrix(cat(thedir,thename), op([i,-1],thedata), delimiter=",");
  end do :

I then wrote a procedure, to make it applicable to other plot data I want to export:

ExportData := proc(p::evaln)
  local thedata, thedir, thename, i, n :
  thedata := plottools:-getdata~([eval(p)]) :
  thedir := cat(currentdir(),kernelopts(dirsep),data,kernelopts(dirsep)) :
  n := nops([eval(p)]);
  for i from 1 to n do
    thename := cat(convert(p,string),"_",i,".txt") :
    ExportMatrix(cat(thedir,thename), op([eval(i),-1],thedata), delimiter=",");
  end do;
end proc:
ExportData(myPlot);

I'm sure there are awkward bits in the procedure code, but it appears to work.

[ Note: I used proc(p::evaln) because that appeared to be the way to have the procedure return the name of the plot sequence as part of the name of the exported data file, as in "myPlot_1" ... "myPlot_50", but above all because I couldn't get the proc to work without it, but as a result I had to write eval(p) and eval(i) in place of simply p and i. ]

My next task will be to clean up the datasets (before or after export, whichever works first), by removing all the lines of the form

1.#QNAN00000000000e+000,1.#QNAN00000000000e+000,1.#QNAN00000000000e+000

These lines appear to be associated with values inside the Array of the form [HFloat(undefined),HFloat(undefined),HFloat(undefined)]. My Array contains, literally, thousands of those instances (a little over 2000 of them!). Probably the result of something silly I'm doing when generating the odeplot. I can probably use selectremove or something similar to remove them, I need to look into it.

For the record, I can export the color of the lines from my plot sequence as follows.

op([1,-1],[myPlot]);

I'll try to remember this.

thanks Preben, you've helped me a gread deal.

http://www.maplesoft.com/support/help/AddOns/view.aspx?path=plottools/getdata

And one more question, if I may, can I output the data as comma-delimited?

-0.002804, 0.066712, 0.074842,
-0.000001, 0.066718, 0.066718,

thanks again!

This is great. While I don't teach probability nor finance, I do teach economics, a subject in which a basic understanding of risk and probability is essential. While the graduate students can handle some math, the undergraduates often can't, and so most undergraduate classes in economics are old-fashioned textbook-based, with not much software use. Asking students to plot data and run mini simulations with an Excel worksheet is considered pushing to the frontier (I don't teach at MIT). The great thing about your application is that I'm confident that our undergrads could handle it, and I would very happily use it as teaching support in class

... if it were portable and not Maple-dependent!

Our lecture theatres have default Windows software and little else. Our labs have the math software, but while the lecture theatres can host 200 students, the labs only about 20 or 30, and undergraduate classes usually have at least 100 students, so labs are simply not an option. Moreover, the computers are set up such that after you restart them, everything that you may have done, like installing software or copying files, is wiped out.

Wouldn't it be great if there were a way to convert this application to something that could be viewed with a quickly-installed viewer? Off the usb sort of thing.

I guess making a movie (.avi) would be feasible (by an expert like you, not by me), if not interactive.

Thanks Joe, very useful.

Thanks Joe, very useful.

thanks Preben, this is shorter.

thanks Preben, this is shorter.

First 26 27 28 29 30 31 32 Last Page 28 of 93