Marcus Davidsson: New Applications
http://www.maplesoft.com/applications/author.aspx?mid=87231
en-us2014 Maplesoft, A Division of Waterloo Maple Inc.Maplesoft Document SystemSun, 26 Oct 2014 03:14:06 GMTSun, 26 Oct 2014 03:14:06 GMTNew applications published by Marcus Davidssonhttp://www.mapleprimes.com/images/mapleapps.gifMarcus Davidsson: New Applications
http://www.maplesoft.com/applications/author.aspx?mid=87231
The Curse of Dimensionality
http://www.maplesoft.com/applications/view.aspx?SID=153482&ref=Feed
<p>We will in this worksheet shortly explore the Curse of Dimensionality<br />which plays an important role in ie portfolio theory.</p><img src="/view.aspx?si=153482/ffc9658f8bbbf859cc17f5d03c5a790b.gif" alt="The Curse of Dimensionality" align="left"/><p>We will in this worksheet shortly explore the Curse of Dimensionality<br />which plays an important role in ie portfolio theory.</p>153482Fri, 20 Dec 2013 05:00:00 ZMarcus DavidssonMarcus DavidssonPoker Calculator
http://www.maplesoft.com/applications/view.aspx?SID=147711&ref=Feed
<p>We will in this worksheet calculate the pr-flop probability of <br />wining for player-1 given a random par of cards for a two <br />person poker game. <br /><br />Any combination of aces are superior if you want to win the game :-)<br /><br /></p><img src="/applications/images/app_image_blank_lg.jpg" alt="Poker Calculator" align="left"/><p>We will in this worksheet calculate the pr-flop probability of <br />wining for player-1 given a random par of cards for a two <br />person poker game. <br /><br />Any combination of aces are superior if you want to win the game :-)<br /><br /></p>147711Sun, 26 May 2013 04:00:00 ZMarcus DavidssonMarcus DavidssonPortfolio Optimization in Practice
http://www.maplesoft.com/applications/view.aspx?SID=147209&ref=Feed
<p>We will in this worksheet show how portfolio optimization can <br />be done for a large universe of stocks (in our case approx 8400)<br />in Maple. The results are promising.</p><img src="/view.aspx?si=147209/pp.jpg" alt="Portfolio Optimization in Practice" align="left"/><p>We will in this worksheet show how portfolio optimization can <br />be done for a large universe of stocks (in our case approx 8400)<br />in Maple. The results are promising.</p>147209Wed, 15 May 2013 04:00:00 ZMarcus DavidssonMarcus DavidssonMyFinance
http://www.maplesoft.com/applications/view.aspx?SID=146473&ref=Feed
<p>The MyFinance module solves three major problems:<br /><br />1) A procedure to calculate percentage returns for a price matrix in Maple.<br /><br />2) Get data straight into Maple from both http and https urls*<br />pointing to a csv file (Maple's HTTP:-Get() only works with http at best)<br />(This core code for this procedure was written by Axel Vogt)<br /><br />3) A CleanData procedure. Empirical financial data <br />(especially free data) is know to have "outliers" that can distort<br />the calculations. This procedure nullifies such observations.<br /><br />Copy the two files (.mla and .hdb) to maple's lib folder ie in my <br />case C:\Program Files (x86)\Maple 16\lib then you are set to go!<br /><br />* Note this procedures uses C:\\WINDOWS\\SYSTEM32<br />However I have a 64 bit computer and it still seems to works for me :-)</p><img src="/view.aspx?si=146473/6ca950bde41cbe3d97d8205cecf3c8d0.gif" alt="MyFinance" align="left"/><p>The MyFinance module solves three major problems:<br /><br />1) A procedure to calculate percentage returns for a price matrix in Maple.<br /><br />2) Get data straight into Maple from both http and https urls*<br />pointing to a csv file (Maple's HTTP:-Get() only works with http at best)<br />(This core code for this procedure was written by Axel Vogt)<br /><br />3) A CleanData procedure. Empirical financial data <br />(especially free data) is know to have "outliers" that can distort<br />the calculations. This procedure nullifies such observations.<br /><br />Copy the two files (.mla and .hdb) to maple's lib folder ie in my <br />case C:\Program Files (x86)\Maple 16\lib then you are set to go!<br /><br />* Note this procedures uses C:\\WINDOWS\\SYSTEM32<br />However I have a 64 bit computer and it still seems to works for me :-)</p>146473Fri, 10 May 2013 04:00:00 ZMarcus DavidssonMarcus DavidssonUnit Root with GARCH Variance
http://www.maplesoft.com/applications/view.aspx?SID=146469&ref=Feed
<p>We will in this worksheet explore the somewhat elusive General <br />Autoregressive Conditional Heteroskedasticity (GARCH) model. <br />The model was introduced by Robert Engle who later (in 2003) <br />won a nobel price for his work.</p>
<p>Engle, R (1982) ARCH with Estimates of Variance of United Kingdom Inflation, <br /> <em>Econometrica</em>, 50:987-1008</p><img src="/view.aspx?si=146469/146469.png" alt="Unit Root with GARCH Variance" align="left"/><p>We will in this worksheet explore the somewhat elusive General <br />Autoregressive Conditional Heteroskedasticity (GARCH) model. <br />The model was introduced by Robert Engle who later (in 2003) <br />won a nobel price for his work.</p>
<p>Engle, R (1982) ARCH with Estimates of Variance of United Kingdom Inflation, <br /> <em>Econometrica</em>, 50:987-1008</p>146469Mon, 29 Apr 2013 04:00:00 ZMarcus DavidssonMarcus DavidssonErgodicity and Game Theory
http://www.maplesoft.com/applications/view.aspx?SID=139255&ref=Feed
<p>Some mathematicians argue that arithmetic means (compared to geometric means) <br />are deeply rooted in society and especially economic theory. <br />This worksheet will introduce Ergodic <span class="st">theory. </span></p><img src="/view.aspx?si=139255/bd4fb24b548365d04ed2bee481e2d191.gif" alt="Ergodicity and Game Theory" align="left"/><p>Some mathematicians argue that arithmetic means (compared to geometric means) <br />are deeply rooted in society and especially economic theory. <br />This worksheet will introduce Ergodic <span class="st">theory. </span></p>139255Tue, 06 Nov 2012 05:00:00 ZMarcus DavidssonMarcus DavidssonLeast Squares and QP Optimization
http://www.maplesoft.com/applications/view.aspx?SID=129826&ref=Feed
<p>We will in this worksheet discuss Least Squares (LS) <br /> and its relationship to Quadratic Programming (QP) <br /> when we have a column-dominated matrix. We will <br /> also discuss the normal equation and the problem <br /> with using such equations for a non-square matrix.</p><img src="/view.aspx?si=129826/maple-gf.jpg" alt="Least Squares and QP Optimization" align="left"/><p>We will in this worksheet discuss Least Squares (LS) <br /> and its relationship to Quadratic Programming (QP) <br /> when we have a column-dominated matrix. We will <br /> also discuss the normal equation and the problem <br /> with using such equations for a non-square matrix.</p>129826Thu, 19 Jan 2012 05:00:00 ZMarcus DavidssonMarcus DavidssonRegression in Maple
http://www.maplesoft.com/applications/view.aspx?SID=129021&ref=Feed
I have always thought that regressions has been too complicated in Maple. The Fit command is too fiddly ie you have to specify too many things and it is easy to get it wrong plus the statistical output you get is far from mainstream ie you dont get t-values, p-values, R, R^2, Adj R^2 etc etc.
I have therefore designed a new procedure called Reg() which only needs one input and that is a datamatrix.<img src="/view.aspx?si=129021/regression_sm.jpg" alt="Regression in Maple" align="left"/>I have always thought that regressions has been too complicated in Maple. The Fit command is too fiddly ie you have to specify too many things and it is easy to get it wrong plus the statistical output you get is far from mainstream ie you dont get t-values, p-values, R, R^2, Adj R^2 etc etc.
I have therefore designed a new procedure called Reg() which only needs one input and that is a datamatrix.129021Thu, 22 Dec 2011 05:00:00 ZMarcus DavidssonMarcus DavidssonAre you a Genius or not?
http://www.maplesoft.com/applications/view.aspx?SID=103260&ref=Feed
<p>I was watching "What Makes a Genius" on BBC Horizon.<br />There Marcus du Sautoy, professor of mathematics at the <br />University of Oxford, tries to answer the question whether <br />geniuses are born or made?!<br /><br />I one section of the program a coloured spots test, performed <br />at John Hopkins University, tries to show if people have a <br />natural talent for mathematics.<br /><br />Since I had not done any programming in Maple for a while<br />I decided it could be a fun challenge :-)</p><img src="/view.aspx?si=103260/322829\71168ae8d71a5a45203c9cc10ec3c228.gif" alt="Are you a Genius or not?" align="left"/><p>I was watching "What Makes a Genius" on BBC Horizon.<br />There Marcus du Sautoy, professor of mathematics at the <br />University of Oxford, tries to answer the question whether <br />geniuses are born or made?!<br /><br />I one section of the program a coloured spots test, performed <br />at John Hopkins University, tries to show if people have a <br />natural talent for mathematics.<br /><br />Since I had not done any programming in Maple for a while<br />I decided it could be a fun challenge :-)</p>103260Tue, 29 Mar 2011 04:00:00 ZMarcus DavidssonMarcus DavidssonPortfolio Simulation and Quadratic Programming
http://www.maplesoft.com/applications/view.aspx?SID=100604&ref=Feed
<p>We will in this maple worksheet explore portfolio theory and quadratic optimization.<br />We will start by simulating some data for 50 stocks and then optimize the portfolio.<br />We will also use empirical data to backtest our portfolio strategy.</p><img src="/view.aspx?si=100604/maple_icon.jpg" alt="Portfolio Simulation and Quadratic Programming" align="left"/><p>We will in this maple worksheet explore portfolio theory and quadratic optimization.<br />We will start by simulating some data for 50 stocks and then optimize the portfolio.<br />We will also use empirical data to backtest our portfolio strategy.</p>100604Mon, 03 Jan 2011 05:00:00 ZMarcus DavidssonMarcus DavidssonThe Knapsack Problem
http://www.maplesoft.com/applications/view.aspx?SID=100353&ref=Feed
<p>This maple worksheet will explore the 0/1 knapsack problem <br />which is a famous problem in combinatorial optimization. <br />We will solve the problem by using dynamic programming. <br />We will then confirm such a solution graphically by using <br />Maples combinat() package.</p><img src="/view.aspx?si=100353/maple_icon.jpg" alt="The Knapsack Problem" align="left"/><p>This maple worksheet will explore the 0/1 knapsack problem <br />which is a famous problem in combinatorial optimization. <br />We will solve the problem by using dynamic programming. <br />We will then confirm such a solution graphically by using <br />Maples combinat() package.</p>100353Mon, 20 Dec 2010 05:00:00 ZMarcus DavidssonMarcus DavidssonOptimal Stopping - Take Two
http://www.maplesoft.com/applications/view.aspx?SID=99621&ref=Feed
<p>This application will discuss optimal stopping both<br />when we maximize the expected value recursively <br />and when we maximize the probability of success <br />i.e. the secretary problem</p><img src="/view.aspx?si=99621/maple_icon.jpg" alt="Optimal Stopping - Take Two" align="left"/><p>This application will discuss optimal stopping both<br />when we maximize the expected value recursively <br />and when we maximize the probability of success <br />i.e. the secretary problem</p>99621Tue, 30 Nov 2010 05:00:00 ZMarcus DavidssonMarcus DavidssonUniversal Portfolio
http://www.maplesoft.com/applications/view.aspx?SID=97487&ref=Feed
<p>The reason why I started to get interested in this universal <br />portfolio stuff was because of Brian Chen's paper <em>Review </em><br /><em>of Universal Portfolios with Side Information</em> where he writes:<br /><br />"A key insight in the development of these universal <br />portfolios is that the average of a set of exponentials <br />grows exponentially as fast as the largest exponential"<br /><br />The purpose of this worksheet is to test if this is true.</p><img src="/view.aspx?si=97487/maple_icon.jpg" alt="Universal Portfolio" align="left"/><p>The reason why I started to get interested in this universal <br />portfolio stuff was because of Brian Chen's paper <em>Review </em><br /><em>of Universal Portfolios with Side Information</em> where he writes:<br /><br />"A key insight in the development of these universal <br />portfolios is that the average of a set of exponentials <br />grows exponentially as fast as the largest exponential"<br /><br />The purpose of this worksheet is to test if this is true.</p>97487Tue, 05 Oct 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonOptimal Stopping Theorem
http://www.maplesoft.com/applications/view.aspx?SID=97244&ref=Feed
<p>I will in this Maple worksheet try to explore the <br />optimal stopping concepts introduced by: <br /><br />Bruss, T (2000) Sum the Odds to One and Stop, <br /><em>The Annals of Probability</em>, Vol 28, No 3, pp 1394 -1391 <br /><br />One important question that we will answer is : <br />How many times do we need to roll a dice if we want <br />to maximize the probability of finding one six?</p><img src="/view.aspx?si=97244/maple_icon.jpg" alt="Optimal Stopping Theorem" align="left"/><p>I will in this Maple worksheet try to explore the <br />optimal stopping concepts introduced by: <br /><br />Bruss, T (2000) Sum the Odds to One and Stop, <br /><em>The Annals of Probability</em>, Vol 28, No 3, pp 1394 -1391 <br /><br />One important question that we will answer is : <br />How many times do we need to roll a dice if we want <br />to maximize the probability of finding one six?</p>97244Tue, 28 Sep 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonVaR and Portfolio Rebalancing
http://www.maplesoft.com/applications/view.aspx?SID=96564&ref=Feed
<p>I will in this worksheet first of all show that a <br />portfolio's VaR is a function of the portfolio <br />variance but also the portfolio expected return.<br /><br />I will then show that a simple diversified <br />50% bond and 50% momentum strategy can<br /> explains a lot of the portfolio returns. <br />The universe consists of 23 global stockmarket<br /> indicies.<br /><br />Such universe is very small but it still manage<br /> to produce attractive returns which is good <br />news for a disciplined small time investor.</p><img src="/applications/images/app_image_blank_lg.jpg" alt="VaR and Portfolio Rebalancing" align="left"/><p>I will in this worksheet first of all show that a <br />portfolio's VaR is a function of the portfolio <br />variance but also the portfolio expected return.<br /><br />I will then show that a simple diversified <br />50% bond and 50% momentum strategy can<br /> explains a lot of the portfolio returns. <br />The universe consists of 23 global stockmarket<br /> indicies.<br /><br />Such universe is very small but it still manage<br /> to produce attractive returns which is good <br />news for a disciplined small time investor.</p>96564Wed, 01 Sep 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonPicking the Largest Number
http://www.maplesoft.com/applications/view.aspx?SID=95033&ref=Feed
<p>In 1987 Thomas M. Cover introduced what is known as the z-strategy. <br />Such a strategy can be used to gain an advantage in a stochastic<br />game where the goal is to select the largest number. I will in this<br />Maple worksheet explore such a z-strategy in more detail. </p><img src="/view.aspx?si=95033/278030\e67a15175fbfa4b2034efdc8efeb3752.gif" alt="Picking the Largest Number" align="left"/><p>In 1987 Thomas M. Cover introduced what is known as the z-strategy. <br />Such a strategy can be used to gain an advantage in a stochastic<br />game where the goal is to select the largest number. I will in this<br />Maple worksheet explore such a z-strategy in more detail. </p>95033Tue, 13 Jul 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonCoin Tossing and Cross Correlation
http://www.maplesoft.com/applications/view.aspx?SID=94787&ref=Feed
<p>I will in this application explore expected values, variance, covaraince and<br />cross correlation properties for Bernoulli random variables</p><img src="/view.aspx?si=94787/277516\e0b828ec01c358c19fa8a4db45e2e3c0.gif" alt="Coin Tossing and Cross Correlation" align="left"/><p>I will in this application explore expected values, variance, covaraince and<br />cross correlation properties for Bernoulli random variables</p>94787Mon, 05 Jul 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonCooperative Games - The Hat Puzzle
http://www.maplesoft.com/applications/view.aspx?SID=87615&ref=Feed
<p>I will in this Maple worksheet discuss a simple example in <br />
Cooperative Game theory called the hat puzzle. There are a <br />
couple of important lessons learned from the game. <br />
<br />
i) Teamwork is highly important<br />
<br />
ii) If someone knows more than you do then it is optimal to keep quite.</p><img src="/view.aspx?si=87615/0\images\Cooperative_Games_-__1.gif" alt="Cooperative Games - The Hat Puzzle" align="left"/><p>I will in this Maple worksheet discuss a simple example in <br />
Cooperative Game theory called the hat puzzle. There are a <br />
couple of important lessons learned from the game. <br />
<br />
i) Teamwork is highly important<br />
<br />
ii) If someone knows more than you do then it is optimal to keep quite.</p>87615Mon, 10 May 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonA Coin Toss Game with Bluffing
http://www.maplesoft.com/applications/view.aspx?SID=70277&ref=Feed
<p>This Maple worksheet outlines a simple coin toss game <br />
where the player can bluff. Mixed strategies, saddle path<br />
equilibriums and entropy are also discussed.</p><img src="/view.aspx?si=70277/0\images\A_Coin_Toss_Game_wit_1.gif" alt="A Coin Toss Game with Bluffing" align="left"/><p>This Maple worksheet outlines a simple coin toss game <br />
where the player can bluff. Mixed strategies, saddle path<br />
equilibriums and entropy are also discussed.</p>70277Mon, 03 May 2010 04:00:00 ZMarcus DavidssonMarcus DavidssonOptimal Commodity Taxation
http://www.maplesoft.com/applications/view.aspx?SID=35351&ref=Feed
<p><br />
I will in this Maple worksheet discuss commodity taxation from an <br />
economic perspective. This means discussing consumer and <br />
government optimization, price elasticity of demand and dead weight loss etc</p><img src="/view.aspx?si=35351/0\images\Commodity_Taxatio_1.gif" alt="Optimal Commodity Taxation" align="left"/><p><br />
I will in this Maple worksheet discuss commodity taxation from an <br />
economic perspective. This means discussing consumer and <br />
government optimization, price elasticity of demand and dead weight loss etc</p>35351Fri, 09 Apr 2010 04:00:00 ZMarcus DavidssonMarcus Davidsson