acer

32348 Reputation

29 Badges

19 years, 329 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@afeddersen ExpectedValue computes the integral of x*f(x) for density function f, where the `x` weight is unstated (ie. implicit) but automatically inserted. So if you want to replace that implicit weight x by U(x), while using a new random variable to supply directly to ExpectedValue, then its PDF must be weighted by U(x)/x. It'd look like this, then,

with(Statistics):
assume(mu::real,sigma>0);
X:=RandomVariable(Normal(mu,sigma)):
Y:=RandomVariable(Distribution(PDF=subs(f=unapply(PDF(X,T),T),t->(1-exp(-phi*t))/t*f(t)))):
EY:=ExpectedValue(Y);

and it does indeed get the same result.

I enjoyed the content of this post, and give it the thumbs up vote.

But I have a few comments on the Mapleprimes technical side of things.

These technical blogs would look much better if the baseline for 2D math inlined into regular text paragraphs was fixed. Currently, it typesets much too high, and as a consequence the end result looks amateurish (no matter how great the content might be).

In Table 2, named "Matrix Action: 2D" there is a Component which currently contains just the name A. Is it instead supposed to show the printed entries of some Matrix A?

When viewed in firefox, the buttons in Tables (presumably corresponding to Component Buttons in an original worksheet) seem to act like html buttons. They can be pressed. But doing so just causes the worksheet to redisplay. So it gives a confusing impression, of potential interaction.

acer

See here.

acer

See the help-page ?ln for what Maple is taking as the principal branch.

acer

See the help-page ?ln for what Maple is taking as the principal branch.

acer

I thought that it would work because there are buttons for such markup on the editing bar of the post-editor. That's how I added in a centered h2 header, by using the editing bar's buttons. It seems strange to have several layout buttons in the site's editor if they add html markup which only ever causes the affected text to be stripped out.

That list of allowed tags is useful, thanks! Maybe it could be added to the MaplePrimes Help page.

acer

@Alejandro Jakubi Ok, sure, although I was thinking about where CompileTools:-Copy was forcibly copying the shared object file. One might not want to have the location of saved Compile'd procs's shared objects be the same as for all other temporary ones (or of anything else that might use that location). Thanks for mentioning it, though, as it may be useful in ways not yet considered.

Perhaps you could show an example in a comment, of what Maple wouldn't run through when some of the names were not assigned numeric values, so we could take a crack at it. It may be possible to work around that in another way. (Maybe it would be possible to call `solve` and specify which names to solve for, or use `eliminate`, or fsolve, or convert to rationals, etc.)

acer

Perhaps you could show an example in a comment, of what Maple wouldn't run through when some of the names were not assigned numeric values, so we could take a crack at it. It may be possible to work around that in another way. (Maybe it would be possible to call `solve` and specify which names to solve for, or use `eliminate`, or fsolve, or convert to rationals, etc.)

acer

These are just a few thoughts.

Right now, that CompileTools:-Copy routine places the shared libary (external) file into a location that is not platform specific. But it could, instead, put it into a platform specfic directory such as,

  cat("bin.",StringTools:-CharacterMap(" ","_",kernelopts(system)));

Alongside that, the new version of the user-defined Maple routine (here,`sqr`) could be different. Instead of having the external shared library location be hard coded inside a permanent, new version of `sqr`, perhaps the new `sqr` could be a routine which redefines itself (without being a protected member of any module, though). That way, the first time `sqr` gets called in every fresh session it could determine the running platform and overwrite itself with an explicit call_external that used the right binary. And if no appropriate external library was found for that platform, an error could be raised.

If the .mla archive containing the CompileTools package were placed in a special location, then its location would be automatically added to libname. One can discover the following special locations by experiment. (One might have to replace some forward-slashes with kernelopts(dirsep), I didn't check.)

  cat(kernelopts(homedir),kernelopts(dirsep),
"maple/toolbox/lib");

cat(kernelopts(homedir),"/maple/toolbox/",
StringTools:-Split(StringTools:-Split(kernelopts(version),".")[1]," ")[2],
"/lib");

The way it is all set up in the original post, the new `sqr` routine gets savelib'd to a .mla archive with no special location. That seems like good behaviour which could be retained even if `sqr` were self-defining. One should have to explicitly, deliberately add that location to libname, in order to have the precompiled functions assigned to the user-level names like `sqr` be defined in any new session. Otherwise they'd often get in the way.

If the CompileTools ,mla archive were actually going to be stored in a special location (eg. .../toolbox/CompileTools/) then that folder might be also be a convenient place for any platform specific bin.XXX subfolders.

acer

@Joe Riel Hi Joe, might your response about saving a compiled procedure be a good candidate for Branch to New Post?

@Joe Riel Hi Joe, might your response about saving a compiled procedure be a good candidate for Branch to New Post?

@Joe Riel Joe, I'd label applying the subsindets version onto such examples as user error, not a code bug. It's just obviously the wrong tool for the job, isn't it?

I'd accept the idea, that the discussion heretofore was about examples where the intended deepest entries were numeric, say. I think that it's reasonable to suppose that this is about code for some known situation, if not that particular one.

Look at the first suggestion, map(op,L). That was clearly only intended for the known case that L was a list (or maybe a set), as it doesn't do much good when applied to all kinds of piecewise or other structure instead.

And isn't that what happens so often in practice? One writes code in which a given, inner situation is known. There's no need to take the performance hit to check the deep typing of list L. But for L of a given type (which one's own known code might well have produced its very self) some faster method may apply.

Isn't coding like that one possible ideal, in the absence of an optimizing symbolic compiler?

That's why I think that the subsindets version is notable. For a known and commonly occuring class, it is quite a bit faster.

acer

@Joe Riel Joe, I'd label applying the subsindets version onto such examples as user error, not a code bug. It's just obviously the wrong tool for the job, isn't it?

I'd accept the idea, that the discussion heretofore was about examples where the intended deepest entries were numeric, say. I think that it's reasonable to suppose that this is about code for some known situation, if not that particular one.

Look at the first suggestion, map(op,L). That was clearly only intended for the known case that L was a list (or maybe a set), as it doesn't do much good when applied to all kinds of piecewise or other structure instead.

And isn't that what happens so often in practice? One writes code in which a given, inner situation is known. There's no need to take the performance hit to check the deep typing of list L. But for L of a given type (which one's own known code might well have produced its very self) some faster method may apply.

Isn't coding like that one possible ideal, in the absence of an optimizing symbolic compiler?

That's why I think that the subsindets version is notable. For a known and commonly occuring class, it is quite a bit faster.

acer

What exactly is meant, when you write that you cannot simplify the piecewise under assumptions, "...because that value of q[S] is still dependent of another variable"? Why can't that other variable be included in the assumption(s), and the assumption(s) be whatever is need to trigger a given conditional (but no conditional earlier in the piecewise)?

acer

First 454 455 456 457 458 459 460 Last Page 456 of 592