Doug Meade

 

Doug

---------------------------------------------------------------------
Douglas B. Meade <><
Math, USC, Columbia, SC 29208 E-mail: mailto:meade@math.sc.edu
Phone: (803) 777-6183 URL: http://www.math.sc.edu

MaplePrimes Activity


These are replies submitted by Doug Meade

The same ideas should apply here as well. The only information needed to complete this is to know how to change the GET command that is sent to yahoo. I don't know how to convert the URL into what looks like an FTP command.

If you have the corresponding URL for your previous request, maybe you can see how this gets translated into the string sent via the socket. In that case, the socket sends

cat("GET /table.csv?s=", ticker, "&a=", startMonth-1, "&b=",
startDay, "&c=", startYear, "&d=", endMonth-1, "&e=",
endDay, "&f=", endYear, "&g=", timeStep, "&ignore=.csv
HTTP/1.0 \n\n"))

which will look like

GET /table.csv?s=^gpsc&a=1&b=1&c=2009&d=8&e=24&f=2009&g=m&ignore=.csv HTTP/1.0

What is the corresponding GET command for the complete set of stocks on the S&P 500? (If you don't know, this is what you need to get from your contact at Maplesoft.)

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

The same ideas should apply here as well. The only information needed to complete this is to know how to change the GET command that is sent to yahoo. I don't know how to convert the URL into what looks like an FTP command.

If you have the corresponding URL for your previous request, maybe you can see how this gets translated into the string sent via the socket. In that case, the socket sends

cat("GET /table.csv?s=", ticker, "&a=", startMonth-1, "&b=",
startDay, "&c=", startYear, "&d=", endMonth-1, "&e=",
endDay, "&f=", endYear, "&g=", timeStep, "&ignore=.csv
HTTP/1.0 \n\n"))

which will look like

GET /table.csv?s=^gpsc&a=1&b=1&c=2009&d=8&e=24&f=2009&g=m&ignore=.csv HTTP/1.0

What is the corresponding GET command for the complete set of stocks on the S&P 500? (If you don't know, this is what you need to get from your contact at Maplesoft.)

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Robert is correct, as far as I know.

Now, through the Component Properties pop-up, you can set the lower and upper limits, and the spacing of major and minor tickmarks. But, you cannot set the formatting of the numbers. I can see why you are making this request, and believe it would be a nice feature to add to a future release of Maple. It should not be too difficult to implement, probably making use of the Typesetting package.

Wishing I had better news to report,

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Robert is correct, as far as I know.

Now, through the Component Properties pop-up, you can set the lower and upper limits, and the spacing of major and minor tickmarks. But, you cannot set the formatting of the numbers. I can see why you are making this request, and believe it would be a nice feature to add to a future release of Maple. It should not be too difficult to implement, probably making use of the Typesetting package.

Wishing I had better news to report,

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Minor tickmarks can be added in the same way, you just have to ask for more of them. Below I do this, and also make these points smaller. I also added a label for t=0 - I just changed the starting index from 1 to 0. You can change this back if you want. Here's my latest code:

with( plots ):
P := plot( [cos(t),sin(t), t=0..2*Pi] ):
P2 := plot( [seq([cos(k),sin(k)], k=0..6)],
            style=point, symbol=solidcircle, symbolsize=18, color=blue ):
P3 := plot( [seq([cos(k/10),sin(k/10)], k=0..62)],
            style=point, symbol=solidcircle, symbolsize=12, color=blue ):
T := textplot( [seq([cos(k),sin(k),"t="||k], k=0..6)],
               align=[right,above] ):
display( [P,P2,P3,T] );

As far as hiding the code, personally I would export the plot to GIF or JPEG and print that file (right click on the plot and Export is the last entry in the list). Or, copy the plot to another application (Word?) and print that file.

There are a couple ways to hide the code within Maple as well.

First, you can hide all input by selecting Show/Hide Contents under the View menu. In the list that appears, uncheck Input, then click OK and all of your input disappears (but is not removed). Of course, re-checking Input will make the input visible.

A second way to hide the input is to put everything in a "section". To do this, have the cursor anywhere in the code and click the "enclose the selection in a section" icon (to the right of the insert prompt [> icon). Next, put the cursor at the end of the input and open the Edit menu; move down to Split or Join, then select Split Section and release the mouse button. You will now have two sections. You can put titles on each (Code and Plot, maybe). Click on the triangle to close a section (click again to re-open it).

Between these I think you will find what you need.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Minor tickmarks can be added in the same way, you just have to ask for more of them. Below I do this, and also make these points smaller. I also added a label for t=0 - I just changed the starting index from 1 to 0. You can change this back if you want. Here's my latest code:

with( plots ):
P := plot( [cos(t),sin(t), t=0..2*Pi] ):
P2 := plot( [seq([cos(k),sin(k)], k=0..6)],
            style=point, symbol=solidcircle, symbolsize=18, color=blue ):
P3 := plot( [seq([cos(k/10),sin(k/10)], k=0..62)],
            style=point, symbol=solidcircle, symbolsize=12, color=blue ):
T := textplot( [seq([cos(k),sin(k),"t="||k], k=0..6)],
               align=[right,above] ):
display( [P,P2,P3,T] );

As far as hiding the code, personally I would export the plot to GIF or JPEG and print that file (right click on the plot and Export is the last entry in the list). Or, copy the plot to another application (Word?) and print that file.

There are a couple ways to hide the code within Maple as well.

First, you can hide all input by selecting Show/Hide Contents under the View menu. In the list that appears, uncheck Input, then click OK and all of your input disappears (but is not removed). Of course, re-checking Input will make the input visible.

A second way to hide the input is to put everything in a "section". To do this, have the cursor anywhere in the code and click the "enclose the selection in a section" icon (to the right of the insert prompt [> icon). Next, put the cursor at the end of the input and open the Edit menu; move down to Split or Join, then select Split Section and release the mouse button. You will now have two sections. You can put titles on each (Code and Plot, maybe). Click on the triangle to close a section (click again to re-open it).

Between these I think you will find what you need.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Robert,

See acer's post. My initial thoughts were the same as yours, but my experience was the same as acer's. I think what's important here is that add is redefined in Units:-Standard. The definition of Units:-Standard:-add is pretty straightforward:

showstat( Units:-Standard:-add );

Units:-Standard:-add := proc(x::uneval, y::uneval)
   1   try
   2     eval((':-add')(x,op(1,y) = op(2,y)))
       catch :
   3     error "wrong number (or type) of parameters in function add"
       end try
end proc

I believe this confirms acer's suspicions about the evaluation rules being the root cause of this problem. However, I do not have a simple suggestion to fix this at this time. Maybe someone else can suggest something. Robert? acer?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Robert,

See acer's post. My initial thoughts were the same as yours, but my experience was the same as acer's. I think what's important here is that add is redefined in Units:-Standard. The definition of Units:-Standard:-add is pretty straightforward:

showstat( Units:-Standard:-add );

Units:-Standard:-add := proc(x::uneval, y::uneval)
   1   try
   2     eval((':-add')(x,op(1,y) = op(2,y)))
       catch :
   3     error "wrong number (or type) of parameters in function add"
       end try
end proc

I believe this confirms acer's suspicions about the evaluation rules being the root cause of this problem. However, I do not have a simple suggestion to fix this at this time. Maybe someone else can suggest something. Robert? acer?

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

I thought I tried to use :-add when I was investigating the problem and it gave even worse output. I'm glad to know this does work.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

I thought I tried to use :-add when I was investigating the problem and it gave even worse output. I'm glad to know this does work.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Moses,

This looks strange. It appears as though there is some interference with the Units package. If you do not load the Units package and do not include units in your definitions AND you change sum to add, then all works fine.

The change from sum to add was my original thought about what was causing the problem. You want to use add because you have a finite (and explicit) number of terms to sum; the sum command is reserved for indefinite and infinite sums (it does not add the terms, rather it attempts to find a summation formula to apply).

I hope this is helpful.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Moses,

This looks strange. It appears as though there is some interference with the Units package. If you do not load the Units package and do not include units in your definitions AND you change sum to add, then all works fine.

The change from sum to add was my original thought about what was causing the problem. You want to use add because you have a finite (and explicit) number of terms to sum; the sum command is reserved for indefinite and infinite sums (it does not add the terms, rather it attempts to find a summation formula to apply).

I hope this is helpful.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Looks nice. I'm glad I was able to help, and even more happy that you were then able to make more improvements on  your own.

I would not have used so many calls to Column and Row, instead using the square bracket selection - but this will not have a serious impact on the performance.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Looks nice. I'm glad I was able to help, and even more happy that you were then able to make more improvements on  your own.

I would not have used so many calls to Column and Row, instead using the square bracket selection - but this will not have a serious impact on the performance.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

I will begin by reiterating my suggestion to not try to put everything inside the definition of the maplet.

In this case, I recommend creating a separate proc to create the plot. So, I changed the defintion of action AC to:

Action[AC](Evaluate(P = 'myPlot'))

and defined the proc myPlot as follows:

myPlot := proc()
  local T;
  T := convert(Get('DD'),string);
  plot(x^2, x = 0 .. 10, title = T, font = [times, roman, 14], color = red, thickness = 3);
end proc:

Note that you need to use Get to access the current contents of DD, and that this must be converted to a string (you would need quotes around the names in the data file to make them strings). This is why the names that have spaces caused problems.

This structure should make it much easier for you to build your actual plots.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu
First 23 24 25 26 27 28 29 Last Page 25 of 76