pagan

5147 Reputation

23 Badges

17 years, 122 days

 

 

"A map that tried to pin down a sheep trail was just credible,

 but it was an optimistic map that tried to fix a the path made by the wind,

 or a path made across the grass by the shadow of flying birds."

                                                                 - _A Walk through H_, Peter Greenaway

 

MaplePrimes Activity


These are replies submitted by pagan

@Alec Mihailovs I think that people are just pulling your leg. Posts about down-votes are pretty tempting bait for joke down-votes.

More seriously, your conclusion doesn't follow with strict logic -- there is a hole in it. Advocating for anonymity does not necessarily imply a self-interest; it could be done on principal. People might disagree with your wish to partially disable anonymity, without themselves wanting to be anonymous.

The subimage in the gravatar lower right corner, denoting Maplesoft employees, looks suspiciously like something off a Toronto Maple Leafs [sic] jersey. If bthur is a Toronto fan, then perhaps that explains it.

How about a mix of red and blue for that subicon, as a peaceful compromise? I wouldn't suggest these for the icon, but the mix has been done before and remained very "Canadian", such as with The Red Maple, The Duality Flag or the Pearson pennant.

Sometimes the best "answer" to a posted Question is found in one of the Comments upon an Answer, made by a different author than the answerer.

Since Comments aren't rated, and since giving the answerer a rating on account of someone else's Comment is weird, the very best "answer" might thus go unrated and not bubble up.

Without actually trying the rewrite it myself right now, I would suggest sticking with Arrays for the shuffling. It's an efficiently mutable data structure, while lists are not.

Also, instead of X||i and X||E1 can't you just use X[i] and X[E1], and similarly for Y? And you can even declare X and Y as Arrays up front, since you know their maximal number of possible entries to get used.

If you rewrite this carefully enough as a procedure, and "type" its parameters and various locals, then you could likely apply Compiler:-Compile to it, and make it very fast. I guess that the easiness there might depend on whether or not you need to have your MC run more iterations than can be counted with a 32bit integer.

Without actually trying the rewrite it myself right now, I would suggest sticking with Arrays for the shuffling. It's an efficiently mutable data structure, while lists are not.

Also, instead of X||i and X||E1 can't you just use X[i] and X[E1], and similarly for Y? And you can even declare X and Y as Arrays up front, since you know their maximal number of possible entries to get used.

If you rewrite this carefully enough as a procedure, and "type" its parameters and various locals, then you could likely apply Compiler:-Compile to it, and make it very fast. I guess that the easiness there might depend on whether or not you need to have your MC run more iterations than can be counted with a 32bit integer.

It's not so much a feature of Explore, as of Components, that you can set this up to have multiple parameters and sliders. The essential trick is simply that adjusting any single one of multiple hooked-in Sliders will cause some code associated with the Plot Component window to re-execute and throw up an updated plot using all the current Slider values.

The code that allows the Explore sheet to work is in collapsed/hidden Document block of the new sheet. But you can make it visible. It should be relatively easy to mimic what it does, back in your original working Document, if you add the right Buttons and Plot components and copy over (and perhaps mildly edit) the code part. Or you can write the Component controlling code by hand.

It's not so much a feature of Explore, as of Components, that you can set this up to have multiple parameters and sliders. The essential trick is simply that adjusting any single one of multiple hooked-in Sliders will cause some code associated with the Plot Component window to re-execute and throw up an updated plot using all the current Slider values.

The code that allows the Explore sheet to work is in collapsed/hidden Document block of the new sheet. But you can make it visible. It should be relatively easy to mimic what it does, back in your original working Document, if you add the right Buttons and Plot components and copy over (and perhaps mildly edit) the code part. Or you can write the Component controlling code by hand.

Yes, in fact there are a variety of ways in which it can be done.

You might look in Embedded Components (Sliders and Plot windows). Or you can look into Maple's plot animation functionality. The parameterization can be done in a few ways, eg, by creating a procedure which uses its argument to fill in for that parameter, or perhaps using dsolve/numeric's own parameter facility.

But just to get you started, so that you know how it might look, you can try this right away.

Explore(plots:-odeplot(dsolve({diff(q(t),t)=piecewise(t<M,3-3*q(t)/10^4,-3*q(t)/10^4),q(0)=0},
                              type=numeric,range=0..16000),refine=1,view=[0..16000,0..10000]));

After you enter that (in Maple 12, 13, or 14 say) you should get a popup window. It asks for ranges of the "unknowns". For unknown M, put in upper and lower values like 0.0 and 16000.0 (making sure to enter float values with the decimal point) and check the "skip" boxes for all other unknowns. Don't bother to check any "floating-point computation" box, as that is already handled by dsolve's 'numeric' option. Then hit the Explore button in the popup, and after a short while you should see a new sheet with the slider and embedded plot window.

Yes, in fact there are a variety of ways in which it can be done.

You might look in Embedded Components (Sliders and Plot windows). Or you can look into Maple's plot animation functionality. The parameterization can be done in a few ways, eg, by creating a procedure which uses its argument to fill in for that parameter, or perhaps using dsolve/numeric's own parameter facility.

But just to get you started, so that you know how it might look, you can try this right away.

Explore(plots:-odeplot(dsolve({diff(q(t),t)=piecewise(t<M,3-3*q(t)/10^4,-3*q(t)/10^4),q(0)=0},
                              type=numeric,range=0..16000),refine=1,view=[0..16000,0..10000]));

After you enter that (in Maple 12, 13, or 14 say) you should get a popup window. It asks for ranges of the "unknowns". For unknown M, put in upper and lower values like 0.0 and 16000.0 (making sure to enter float values with the decimal point) and check the "skip" boxes for all other unknowns. Don't bother to check any "floating-point computation" box, as that is already handled by dsolve's 'numeric' option. Then hit the Explore button in the popup, and after a short while you should see a new sheet with the slider and embedded plot window.

It is your homework; you should be the one to write the procedure. I suggest basing it on the pseudocode of one of the simpler sorting algorithms available and described in the wikipedia links in my earlier response.

It is your homework; you should be the one to write the procedure. I suggest basing it on the pseudocode of one of the simpler sorting algorithms available and described in the wikipedia links in my earlier response.

Thanks.

I was thinking that maybe Hint itself could try to notice the repetition.

I found this particular one while playing with this, just to see whether Calculus1's step-by-step would get it.

It's a safe bet that he's already, umm, seen it.

It's a safe bet that he's already, umm, seen it.

I understood that you wanted the opposite, to be able to disable it in the case that argument x is either unassigned (and perhaps also when the value of x is some other unassigned name). But it is valid Maple.

It was not uncommon programming practice in Maple, especially before multiple-assignment was possible.

The only thing that I can think of right now is that `mint -i 4` should indicate such simple assignments to the argument. See mint. It looks like maplemint will not indicate it.

$ mint -q -i 4 franky.mpl
Procedure f( x ) on lines 1 to 4
  Parameter usage:
      x      was assigned a value
  No functions were called.
Global variables used in this file:
    f      was assigned a procedure
No functions were called.

$ cat franky.mpl
f := proc(x)
x := 7;
end proc:

It gets trickier, if you pass x to yet another routine inside f, or if you use `assign`.

First 43 44 45 46 47 48 49 Last Page 45 of 81