Paul

530 Reputation

10 Badges

19 years, 208 days
Paul DeMarco is the Director of Development at Maplesoft, a position that has him involved with technical planning and development of Maple and the various core technologies that use Maple as a computation engine. He joined Maplesoft in September 1996 while studying at the University of Waterloo in the CS/EEE program -- a track that combines core math and computer science courses with electrical engineering electives. Paul's development work in the Math and Kernel Groups over the years touches a wide variety of areas, including algorithms, data structures, and connectivity with other products. He is also involved with core Maple as well as Maple T.A.

MaplePrimes Activity


These are Posts that have been published by Paul

The Canadian Press reported last week the fortune of 13 women working on the 13th floor of an Edmonton bank tower winning a $50-million lottery jackpot. Combine this with the recently released version 13 of Maple and one might claim that notorious number 13's luck is changing.

Early in the development of Maple 13 the question of whether to use "13" was raised. From Apollo 13 to hotels with a missing floor, superstition surrounds this number.  Microsoft Office 2010 is slated to be released as version 14.0; the previous version was 12.0. Corel's WordPerfect Office marketed their version 13 as "X3" -- combining a roman numeral and decimal digit.

In a previous post I described how to call OpenMaple from a C# application (see: Using OpenMaple with C#) Now, I'd like to tackle the reverse problem: how do I call a C# .dll from within Maple? The way to do this involves using Component Object Model (COM) interoperability in the Microsoft .NET Framework. Because Maple's kernel is written in an "unmanaged" language, a wrapper is needed in order to bridge to your managed C# code. This article will outline the steps needed to create this bridge and get Maple talking to C#.

I wanted to see how difficult it would be to use the OpenMaple API from a C# program.  It turns out that it is pretty easy to access C .dlls from C#.  I was able to reproduce a commandline equivalent (minus the command history and editing features). 

The source code can be found here: openmaple.cs

Attached (sim.mpl) is a simple game simulation with data from last years World Series champion Red Sox. Bump up infolevel to see what's going on during a game (as shown below). In the "Maple Baseball" post I wanted to see if the number of runs our team was scoring was appropriate. Obviously, the rule of thumb, 3-hits = 1 run is poor at best. What I really want to find out is if there is a way to improve our scoring chances. The standard baseball batting-order uses the following heuristic:

  • lead off with someone with a high on-base percentage (and who can maybe steal a base)
  • next 2 are good contact hitters
  • batter 4 is your "clean-up" hitter; someone with power
  • etc.
Early this season, after the Maplesoft team came out on the wrong side of a 13-6 loss, we were frustrated by the team's inability to score more runs. The previous year we averaged 14 runs a game. This started me wondering, just how many runs can our team expect with a given lineup? Suppose you assume that it takes three hits in an inning to start scoring runs. Now, let's assume you have five .500 hitters coming up to bat. What is the probability that you'll get 3 hits among those five batters, thus scoring one run?
1 2 Page 2 of 2