MrMarc

3093 Reputation

16 Badges

9 years, 269 days

MaplePrimes Activity


These are Posts that have been published by MrMarc

The purpose of this post is to review how well-designed Maple 2017 GUI is for a Microsoft surface pro 4 tablet touch screen with windows 10 pro (64-bit) and to determine the performance of Maple 2017 on my tablet which has a m3 CPU with a 0.9 GHZ base frequency and 4 GB RAM.

First, my experience is that 4 GB of RAM is far from enough. Under heavy load I have had problems before on other software with 4 GB of RAM. 68 % of my RAM and 41% of the CPU is already gone by simply running Maple and my web browser at the same time before I have even instructed Maple to do any calculations.

 

I think a tablet with at least 8 GB of RAM would be preferred. If you only want to use Maple as an expensive calculator then you would most likely not even need 4 GB of RAM. I find that the surface pro 4 to be overpriced for the hardware it provides. I think eve windows 10 tablet http://eve-tech.com/ with up to 16 GB of RAM and with a much cheaper price looks much more promising than the Microsoft surface pro 4. When I use the surface pro 4 with word 2016 and the reference manager zotero word plugin I sometime notice a trailing line when I sweep up or down in a document with a lot of references which I suspect is because of the low amount of RAM. When I played with Maple 2017 on my surface pro I noticed the same trailing line which again indicates to me that there is not enough RAM. However, I am not certain that low RAM is the cause of such problem.  

Secondly, I managed to increase the size of the Maple icons under the File, Edit etc. menu so now they have a perfect size for a touch screen tablet. Very cool!

 

However, as you can see words in the text menu File, Edit etc. are way too small for a touch screen tablet. There is a lot of room to the right so the words could easily be increased in size. I am also a missing a menu item called maplet where you can attach your own maplets for easy access. It appears that Maple 2017 GUI has not been designed with a touch screen tablet in mind. I wish the words in the text menu File, Edit etc. would have increased when I increased the size of the icons. The text and icons in the sidebar are also way too small for a touch screen tablet. The name of the open tabs is also to small and x that you tap on to close the worksheet is also to small. It is almost impossible to close a worksheet because the x is so small. 

I thinks there are ways in windows 10 to increase the text size in the menus but I have only been able to increase the text size and icon size for all software at the same time. Since, Maple is more or less the only software that I have where the menu text is too small this is not an optimal solution.   

The table of content for Maple help files also has too small text as seen in the below picture. However, the biggest problem is not the small words it is the row spacing of the table of content. Some of the words appear almost to be on top of each other. I think the row spacing need to be increased. The text within the help files itself displays beautifully and is in the perfect size.   

 

Another problem is that when you swipe up or down on the touch screen you dont go up or down in the maple document. You just highlight text as seen in the picture below. This needs to be fixed. Highlighting should be done by a long tap on the screen as in word 2017 on a touch screen devices.

 

 

The norm today might be to use Maple on a desktop computer or on a laptop but I am convinced that in the future touch screen tablet will become more and more powerful making them an excellent computers to run Maple on because they are so light and portable. I think Maplesoft must have this in mind when they design the GUI.

Now to test the performance of Maple 2017 on my tablet I decided to generate 1 000 000 random number and see how long it takes. Since I dont have a benchmark it becomes very hard to comment on how fast maple 2017 is on my tablet but I am hoping that someone can run the same code on their machine and comment on this post so we can get a benchmark.        

time(rand()$1000000)

Maple 2017 claims that running such code took about 50 seconds on my tablet however when I timed it with a stop watch it only took around 30 seconds hence I am a bit confused as to where the 20 seconds difference comes from?  

 

I am thinking about buying maple 2017 however there are only 4 different categories to choose from when you want to buy: student, commercial, academic and government. I dont belong to any of them! Also the price difference is huge! I am on disability benefits and the academic license cost more or less the same amount that I get in disability benifts each month to cover my food, rent and medicines which is approximatly 1 100 usd. The price for a student licens is completely realistic and is a price that I am willing to pay but I am not a student and I dont feel comfortable claiming that I am even though everyone is a student as long as they live. When you stop learning you life is more or less over anyway. If I am forced to pay around 1 000 usd then I am not going to buy maple 2017. Then I am just going to continue using MathPapa free algbra calculator https://www.mathpapa.com/ because to be honest I dont really need maple that much in my research today but there are a couple of reaons why I want to buy. 1) I would like to support maplesoft because I think you have the best and most userfriendly mathematical software on the market. 2) I want to hedge my bets. My needs might change in the future. 3) I want to be able to run my large number of old worksheets and see if I can improve them. 4) I want to see what changes and improvments have been made to maple 2017 compared to let say 5 years ago and to assess if these changes provide any value to me. 

LL_104)_NASDAQ.mw
Portfolio_Optimization.txt

Portfolio Optimization with Google Spreadsheet and Maple
 

I will in this post show how to manage data and do portfolio optimization in Maple by using google spreadsheet.

You can either use a direct link to the data:

https://docs.google.com/spreadsheets/d/1L5-yUB0EWeBdJNMdELKBRmBQ1JJ0QymrtDLkVhHCVn8/pub?gid=649021574&single=true&output=csv

or you can set up your own google spreadsheet. If you choice to set up your own spreedsheet follow the below road map:

1) select which market you want to follow:

NASDAQ

http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NASDAQ&render=download

NYSE

http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NYSE&render=download

AMEX

http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=AMEX&render=download


2) Create a new google spreadsheet and name two sheets Blad1 and Panel. In the first cell of Blad1 you put the formula:

=IMPORTDATA("http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NASDAQ&render=download")

you need to change the url to match your selection in 1).


3) In the first cell of Panel you put the name "Ticker" and then you copy all the ticker names from Blad1.

4) In the script editor you put in the below java script code:


function PanelCreation_Stock() 

{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sourceSheet = ss.getSheetByName("Blad1");
var dstSheet = ss.getSheetByName("Panel");
var curDat = new Date();
var day1 = curDat.getDay();
if(day1 == 0 || day1 == 1)
{
return;
}
var lCol = dstSheet.getLastColumn();
var srcdate = dstSheet.getRange(1, 1, 1, lCol).getValues();

for(var k=1;k<=srcdate[0].length-1;k++)
{
if(Utilities.formatDate(srcdate[0][k],"GMT", "dd-MMM-yy") == Utilities.formatDate(curDat,"GMT", "dd-MMM-yy"))
{
return;
}
}
var snRows = sourceSheet.getLastRow();
var dnRows = dstSheet.getLastRow();

var srcStock = sourceSheet.getRange("A2:A" + snRows).getValues();
var srcLastSale = sourceSheet.getRange("C2:C" + snRows).getValues();

var dstStock = dstSheet.getRange("A2:A" + dnRows).getValues();
var dstLastSale = dstSheet.getRange("Z2:Z" + dnRows).getValues();

for(var j=0;j<dnRows-1;j++)
{
dstLastSale[j][0]="n/a";
}
var flag = "true";
var foundStock;
for(var i=0;i<snRows-1;i++) //snRows
{
var sStockVal = srcStock[i][0];

//var foundStock = ArrayLib.indexOf(dstStock,0, sStockVal);

flag="false";
for(var j=0;j<dnRows-1;j++)
{
if(dstStock[j][0].toString().toUpperCase() == srcStock[i][0].toString().toUpperCase())
{
flag = "true";
foundStock = j;
break;
}
}
if(flag=="true")
{
dstLastSale[foundStock][0] = srcLastSale[i][0];
}
else
{
var dnRows1 = dstSheet.getLastRow()+1;
dstSheet.getRange("A" + dnRows1).setValue(srcStock[i][0]);
dstSheet.getRange(dnRows1,lCol+1,1,1).setValue(srcLastSale[i][0]);
for(var k=2;k<=lCol;k++)
{
if(dstSheet.getRange(dnRows1, k).getValue()=="")
{
dstSheet.getRange(dnRows1, k).setValue("n/a");
}
}
}
}
dstSheet.getRange(1,lCol+1).setValue(curDat);
dstSheet.getRange(2, lCol+1, dstLastSale.length, 1).setValues(dstLastSale);
}

 
5) Set it to run each day at 12:00. The code will save the new last sale price for monday to friday with one days lag.

Now we can move on to Maple.


In Maple run the following code to load the data:

 

X := proc (Url) local theDLL, URLDownloadToFile, myDirectory, myFile, Destination, DL;

 

theDLL := "C:\\WINDOWS\\SYSTEM32\\urlmon.dll";

 

URLDownloadToFile := define_external('URLDownloadToFileA', pCaller::(integer[4]), szURL::string, szFileName::string, dwReserved::(integer[4]), lpfnCB::(integer[4]), 'RETURN'::(integer[4]), LIB = theDLL);

 

if FileTools[Exists]("C:\\mydir") = true then FileTools:-RemoveDirectory("C:\\mydir", recurse = true, forceremove = true) else end if;

 

FileTools:-MakeDirectory("C:\\mydir");
myDirectory := "C:\\mydir";
myFile := "data1.csv";
Destination := cat(myDirectory, "\\", myFile);

 

DL := proc () local M;

 

URLDownloadToFile(0, Url, Destination, 0, 0);
M := ImportMatrix("C:\\mydir\\data1.csv", delimiter = ",", datatype = string);
M := Matrix(M, datatype = anything)

 

end proc;

 

return DL()

 

end proc:

 

data := X("https://docs.google.com/spreadsheets/d/1L5-yUB0EWeBdJNMdELKBRmBQ1JJ0QymrtDLkVhHCVn8/pub?gid=649021574&single=true&output=csv");
L := LinearAlgebra:-Transpose(data);

If you use your own spreadsheet you need to change the url to match that spreadsheet.
Select File -> Publish to the web in google spreadsheet

We can now run the portfolio optimization in Maple:

with(Statistics):
with(ListTools):
with(LinearAlgebra):
with(Optimization):
with(plots):

 

Nr, Nc := ArrayTools:-Size(L):
symb := L[1 .. 1, 2 .. Nc]:
LL := L[2 .. Nr, 2 .. Nc]:
Nr, Nc := ArrayTools:-Size(LL):

 

# Removing stocks with missing observations
for i to Nc do if Occurrences("n/a", convert(Column(LL, i), list)) >= 1 then AA[i] := i else AA[i] := 0 end if
end do;

 

DD := RemoveInRange([seq(AA[i], i = 1 .. Nc)], 0 .. 1):
symbb := DeleteColumn(symb, DD):
LLL := map(parse, DeleteColumn(LL, DD)):
Nr, Nc := ArrayTools:-Size(LLL):

 

# Calculate Return
for j to Nc do
for i from 2 to Nr do

 

r[i, j] := (LLL[i, j]-LLL[i-1, j])/LLL[i-1, j]

 

end do
end do;

 

RR := Matrix([seq([seq(r[i, j], j = 1 .. Nc)], i = 2 .. Nr)], datatype = float[8]);
n, nstock := ArrayTools:-Size(RR):

 

# Portfolio Optimization
W := Vector(nstock, symbol = w):
y := Vector(n, fill = 2, datatype = float[8]):
s1 := Optimization[LSSolve]([y, RR])[2];
Nr, Nc := ArrayTools:-Size(s1):

 

j := 0:
for i to Nr do if s1[i] <> 0 then j := j+1; ss1[j] := symbb[1, i] = s1[i] end if end do;

 

Vector(j, proc (i) options operator, arrow; ss1[i] end proc);
LineChart(s1);

 

 

 

quandl (http://www.quandl.com/) has a great feature called superset (you need a free acount)
where the user can combine different data variables (4 000 000 to choice from) into a big
dataset (csv file) that can be downloaded from a permenant web url. This a great data feed
for maple. The problem is however that you have to use stringtools (quite messy) in maple to
extract the data. Hence, it would be great to have a simple procedure that only needs the web

Fridays Killer Questions 7city Learning:

Question) The number sequence is: 2 1 3 6 5 11 18 17 which number should come after 17?
Answer) 35

1 2 3 4 5 6 7 Page 1 of 8