## 1429 Reputation

14 years, 117 days
Maplesoft

## Social Networks and Content at Maplesoft.com

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.

## Looks like you haven't defined 'sys'...

That's the first problem. The next is, the entries of S cannot be substituted into anything - what you need is equations of the form variablename = value. So you could define S as:

`S := [seq(seq([h1 = h1vals[ii], h2 = h2vals[ii], h3 = h3vals[ii], h4 = h4vals[ii], h5 = h5vals[ii], h6 = h6vals[ii],                     w = wvals[jj]], jj = 1 .. 4), ii = 1 .. 4)];`

assuming that sys is a system of (polynomial) equations in the variables h1, h2, ..., h6, and w.

If your system of equations is multivariate and not polynomial (and it does look like that from the rest of your worksheet), try using ?fsolve instead of ?RootFinding/Isolate.

Hope this helps,

Erik Postma.

## In particular: vi, emacs, jedit...

There are three editors that I know support editing Maple source code (more than an arbitrary programming editor): vi and emacs (of course), and a java-based editor called jEdit. Google will find them immediately. Any one of these will make you much happier than your current solution.

Erik Postma.

## In particular: vi, emacs, jedit...

There are three editors that I know support editing Maple source code (more than an arbitrary programming editor): vi and emacs (of course), and a java-based editor called jEdit. Google will find them immediately. Any one of these will make you much happier than your current solution.

Erik Postma.

## Thanks...

@Christopher2222 and @acer: Thanks for bringing these issues to my attention - I fixed the documentation and implementation; these changes should make it into a future version of Maple.

Erik.

## Thanks...

@Christopher2222 and @acer: Thanks for bringing these issues to my attention - I fixed the documentation and implementation; these changes should make it into a future version of Maple.

Erik.

## What's the kurtosis of a function that's...

Hi john2,

I'm familiar with the notion of kurtosis only for probability distributions (in fact there are two very similar definitions - see the Wikipedia page). In particular, you'd need to have equal to one and all function values nonnegative. I can imagine that you could relax the nonnegativity constraints without problem, and if the integral is finite you could scale the function to make it one, but for your example the result is undefined and even the Cauchy principal value is infinite.

What is the definition of kurtosis for such functions?

Erik Postma
Maplesoft.

## Mistake...

@Markiyan Hirnyk : You're right - I made a mistake! Thanks for pointing that out. (I didn't get notification emails for your comments though - only when your second answer was posted...)

There is a mapping going on, from the set you describe in R^4 into "my" cube in R^3, in which the angles do not get preserved. However, the mapping is a nontrivial linear mapping, so parallel faces remain parallel and no new faces get introduced. (In theory some faces could get mapped into the same plane, so faces could be removed.) So for the octahedron, you'd need to have every face of the 3d cube and the two faces of the planes determined by the relation.

I think an argument can be made about the graph structure of vertices and edges of the object before the mapping and after the mapping, which excludes the octahedron. (Probably that is enough - maybe we need the full tripartite incidence graph where vertices, edges, and faces of the solids become vertices of the graph, and two vertices are adjacent if the corresponding objects in the solid are incident with each other.) I'm still working on it. The tetrahedron is wide open, though.

Erik.

## Mistake...

@Markiyan Hirnyk : You're right - I made a mistake! Thanks for pointing that out. (I didn't get notification emails for your comments though - only when your second answer was posted...)

There is a mapping going on, from the set you describe in R^4 into "my" cube in R^3, in which the angles do not get preserved. However, the mapping is a nontrivial linear mapping, so parallel faces remain parallel and no new faces get introduced. (In theory some faces could get mapped into the same plane, so faces could be removed.) So for the octahedron, you'd need to have every face of the 3d cube and the two faces of the planes determined by the relation.

I think an argument can be made about the graph structure of vertices and edges of the object before the mapping and after the mapping, which excludes the octahedron. (Probably that is enough - maybe we need the full tripartite incidence graph where vertices, edges, and faces of the solids become vertices of the graph, and two vertices are adjacent if the corresponding objects in the solid are incident with each other.) I'm still working on it. The tetrahedron is wide open, though.

Erik.

## Scope resolution...

@jerbertz : it's called the "member selection" or "scope resolution" operator, and is explained on its help page: ?:-. This particular case uses the version explained in the second bullet point.

Hope this helps,

Erik Postma
Maplesoft.

## Scope resolution...

@jerbertz : it's called the "member selection" or "scope resolution" operator, and is explained on its help page: ?:-. This particular case uses the version explained in the second bullet point.

Hope this helps,

Erik Postma
Maplesoft.

## unapply...

For this case, the result can easily be obtained by evaluating the integral before the assignment to f: then indeed x is gone from f:

f := unapply(int(a*x, x=0..1), a);
int(f(x), x);

returns x^2/4. The difficulty comes when on the one hand you want to already perform the integration, but on the other hand you want to use a recursive definition that is evaluated on the fly.

Hope this helps,

Erik Postma
Maplesoft.

## unapply...

For this case, the result can easily be obtained by evaluating the integral before the assignment to f: then indeed x is gone from f:

f := unapply(int(a*x, x=0..1), a);
int(f(x), x);

returns x^2/4. The difficulty comes when on the one hand you want to already perform the integration, but on the other hand you want to use a recursive definition that is evaluated on the fly.

Hope this helps,

Erik Postma
Maplesoft.

## Not sure what would cause g(0) to be une...

Hi steweb,

I'm not sure what would cause the phenomena you're describing; could you show us the full definition of g that you're using?

Re: your side note. I understand your point, but unfortunately we have to consider how the evaluation proceeds in order to get to a solution. You're correct that function application is not exactly the same as substitution, not in Maple and certainly not mathematically, but it's pretty close to what the Maple kernel does when a function call is evaluated. And if we want to use a computer to do math for us, there's not too much we can change about that. What we can change is which value is substituted in and what that value is substituted into.

If you define f := a -> int(a * x, x = 0 .. 1) then int is not yet called - the call to int is just recorded verbatim in f. Later, if you evaluate f(x), a already has the value x, so int receives the two arguments x^2 and x = 0 .. 1.

What you seem to have in mind is to first evaluate the integral and then evaluate the result at a = x. That process would be easy to do for simple expressions using unapply, but less so for more complicated situations where you want to do the definition recursively. So let's try to get absolutely clear what you want to do first.

Finally about your last question: making x a local in g ensures that there is nothing inside Maple that depends on that particular x, so in this case, once int gets called, its first argument is the product of the local x created for that particular invocation of g and something which cannot contain that x (unless you do your best to break it). x cannot be a local to int: you are passing it into int yourself, whereas local variables are created by Maple at invocation time and are available only from that point onwards.

Hope that helps,

Erik Postma
Maplesoft.

## Not sure what would cause g(0) to be une...

Hi steweb,

I'm not sure what would cause the phenomena you're describing; could you show us the full definition of g that you're using?

Re: your side note. I understand your point, but unfortunately we have to consider how the evaluation proceeds in order to get to a solution. You're correct that function application is not exactly the same as substitution, not in Maple and certainly not mathematically, but it's pretty close to what the Maple kernel does when a function call is evaluated. And if we want to use a computer to do math for us, there's not too much we can change about that. What we can change is which value is substituted in and what that value is substituted into.

If you define f := a -> int(a * x, x = 0 .. 1) then int is not yet called - the call to int is just recorded verbatim in f. Later, if you evaluate f(x), a already has the value x, so int receives the two arguments x^2 and x = 0 .. 1.

What you seem to have in mind is to first evaluate the integral and then evaluate the result at a = x. That process would be easy to do for simple expressions using unapply, but less so for more complicated situations where you want to do the definition recursively. So let's try to get absolutely clear what you want to do first.

Finally about your last question: making x a local in g ensures that there is nothing inside Maple that depends on that particular x, so in this case, once int gets called, its first argument is the product of the local x created for that particular invocation of g and something which cannot contain that x (unless you do your best to break it). x cannot be a local to int: you are passing it into int yourself, whereas local variables are created by Maple at invocation time and are available only from that point onwards.

Hope that helps,

Erik Postma
Maplesoft.

## Try this...

@steweb : seeing your replies now (I had some things distracting me between starting to answer your question and finishing it), why don't you try this:

`g:=proc(j)local x;  if j=0 then    y->int(y*x,x=0..1)  else    y->int(y*g(j-1)(x),x=0..1)  end if:end proc:`

Hope this helps,

Erik Postma
Maplesoft.

﻿