epostma

1579 Reputation

19 Badges

17 years, 49 days
Maplesoft

Social Networks and Content at Maplesoft.com

Maple Application Center
I am the manager of the Mathematical Software Group, working mostly on the Maple library. I have been working at Maplesoft since 2007, mostly on the Statistics and Units packages and on contract work with industry users. My background is in abstract algebra, in which I completed a PhD at Eindhoven University of Technology. During my studies I was always searching for interesting questions at the crossroads of math and computer science. When I came to Canada in 2007, I had nothing but a work permit, some contacts at Maplesoft (whom I had met at a computer algebra conference a year earlier), and a plan to travel around beautiful Canada for a few months. Since Maplesoft is a company that solves more interesting math and computer science related questions than just about anywhere else, I was quite eager to join them, and after about three months, I could start.

MaplePrimes Activity


These are replies submitted by epostma

This is what I would do:

with(Statistics):
X := RandomVariable(Normal(mu, sigma)):
ExpectedValue(1-exp(-phi*X));

which returns:

(exp(mu*phi)-exp(1/2*phi^2*sigma^2))*exp(-mu*phi)

Agreed on the issue with the calling sequence with the second argument, acer; I'll have a look.

Erik Postma
Maplesoft.

This is what I would do:

with(Statistics):
X := RandomVariable(Normal(mu, sigma)):
ExpectedValue(1-exp(-phi*X));

which returns:

(exp(mu*phi)-exp(1/2*phi^2*sigma^2))*exp(-mu*phi)

Agreed on the issue with the calling sequence with the second argument, acer; I'll have a look.

Erik Postma
Maplesoft.

@sund0002 : At this stage, it bites you that you have Arrays instead of Vectors. You'll get the right plot if you replace your definition of pp with:

pp := pointplot(convert(V, Vector), convert(C, Vector), symbolsize=5, color=green);

There are a few alternatives that might be more appropriate in some circumstances. If you would do this repeatedly with huge data sets, you'd want to use ?ArrayTools/Alias for efficiency. If you need to fit the code in as few keystrokes as possible you'd just use Vector(V) instead of the convert calling sequence. You could convert Data to a Matrix instead. But from what we've seen so far, the above command may well be fine for your situation.

Hope this helps,

Erik Postma
Maplesoft.

@sund0002 : At this stage, it bites you that you have Arrays instead of Vectors. You'll get the right plot if you replace your definition of pp with:

pp := pointplot(convert(V, Vector), convert(C, Vector), symbolsize=5, color=green);

There are a few alternatives that might be more appropriate in some circumstances. If you would do this repeatedly with huge data sets, you'd want to use ?ArrayTools/Alias for efficiency. If you need to fit the code in as few keystrokes as possible you'd just use Vector(V) instead of the convert calling sequence. You could convert Data to a Matrix instead. But from what we've seen so far, the above command may well be fine for your situation.

Hope this helps,

Erik Postma
Maplesoft.

@sund0002: I took a look at the worksheet that you posted. This is somewhat tricky business; it looks like Maple has decided that the first line that it is complaining about consists of two separate halves, and the split between the two occurs in between "pp" and ":=". So Maple sees a line starting with ":=". It might be best to insert a new execution group there (using for example the ">" button on the toolbar, or hitting Ctrl-J or Ctrl-K) and retype that line.

The more difficult and more interesting question is how that split line came about. Do you have any theories?
I don't know too much about how the GUI works, but here's something that might help. In general, I think if you're working with "Maple Input" (the 1-D, "text-only", "red Maple" style of input, as opposed to the 2-D typeset input), it works most reliably if you insert new execution groups in one of the ways I describe above (with the ">" button, Ctrl-J, or Ctrl-K), and set Tools -> Options -> Display -> Input display to Maple notation.

I believe the new execution groups come about sort of automatically if you open a new "Worksheet"; if you create a "Document", you have to do it in one of the ways described above.

Hope this helps,

Erik Postma
Maplesoft.

@sund0002: I took a look at the worksheet that you posted. This is somewhat tricky business; it looks like Maple has decided that the first line that it is complaining about consists of two separate halves, and the split between the two occurs in between "pp" and ":=". So Maple sees a line starting with ":=". It might be best to insert a new execution group there (using for example the ">" button on the toolbar, or hitting Ctrl-J or Ctrl-K) and retype that line.

The more difficult and more interesting question is how that split line came about. Do you have any theories?
I don't know too much about how the GUI works, but here's something that might help. In general, I think if you're working with "Maple Input" (the 1-D, "text-only", "red Maple" style of input, as opposed to the 2-D typeset input), it works most reliably if you insert new execution groups in one of the ways I describe above (with the ">" button, Ctrl-J, or Ctrl-K), and set Tools -> Options -> Display -> Input display to Maple notation.

I believe the new execution groups come about sort of automatically if you open a new "Worksheet"; if you create a "Document", you have to do it in one of the ways described above.

Hope this helps,

Erik Postma
Maplesoft.

@pagan : You're absolutely right - I stand corrected. The thing is, I started working with Maple shortly before the release of Maple 12, so for me it's essentially been true forever.

Erik.

@pagan : You're absolutely right - I stand corrected. The thing is, I started working with Maple shortly before the release of Maple 12, so for me it's essentially been true forever.

Erik.

@sund0002 : You typed data[.., 2] instead of Data[.., 2], and furthermore you can see that again you haven't loaded the Statistics and plots packages (as in this thread). Both of these are clear from what Maple prints as returned values: the Fit and pointplot calls just return unevaluated (the result still looks like Fit(...) and display(...)), and clearly the data[.., 2] that is returned looks very different from the thing that says 1 .. 18 Array.

As a general rule, looking at what Maple returns is a great first step to figuring out what's going on, possibly even before asking a question on MaplePrimes.

Erik Postma
Maplesoft.

@sund0002 : You typed data[.., 2] instead of Data[.., 2], and furthermore you can see that again you haven't loaded the Statistics and plots packages (as in this thread). Both of these are clear from what Maple prints as returned values: the Fit and pointplot calls just return unevaluated (the result still looks like Fit(...) and display(...)), and clearly the data[.., 2] that is returned looks very different from the thing that says 1 .. 18 Array.

As a general rule, looking at what Maple returns is a great first step to figuring out what's going on, possibly even before asking a question on MaplePrimes.

Erik Postma
Maplesoft.

Absolutely, pagan, that's what I would suggest as well. Tiny note: I think 'N*m' is redundant; AddSystem will use whatever the last unit for a given dimension is, so kN*m will override N*m (just as it will override the jouleSI returned by GetSystem).

Erik Postma
Maplesoft.

Absolutely, pagan, that's what I would suggest as well. Tiny note: I think 'N*m' is redundant; AddSystem will use whatever the last unit for a given dimension is, so kN*m will override N*m (just as it will override the jouleSI returned by GetSystem).

Erik Postma
Maplesoft.

A tiny optimization in the number of characters you need to type: you could use

V,C := Data[..,1], Data[..,2];

instead of your assignment. The defaults for start and end of a range in indexing are always the minimum and maximum valid values.

Erik Postma
Maplesoft.

A tiny optimization in the number of characters you need to type: you could use

V,C := Data[..,1], Data[..,2];

instead of your assignment. The defaults for start and end of a range in indexing are always the minimum and maximum valid values.

Erik Postma
Maplesoft.

@sund0002 : if I open your worksheet and hit the 'three exclamation marks' button in the tool bar, it all works except for the definitions of answer1 and plot1 (which is because you used X, Y there, instead of V, C). It looks like you didn't evaluate the line that says with(Statistics), because the Fit(...) command returns as Fit(...), which means it doesn't call Statistics[Fit].

As to your Excel question: I never work with Excel, but I know we have an ?ExcelTools package which can presumably do that, and also a data import assistant ("Tools" menu -> "Assistants" -> "Import Data ...") which can read Excel sheets.

Erik.

First 10 11 12 13 14 15 16 Last Page 12 of 22