Mac Dude

1556 Reputation

17 Badges

13 years, 251 days

MaplePrimes Activity


These are replies submitted by Mac Dude

@itsme Well, my first motivation for "use" was to find an equivalent to Mma's With[] to port this code. I know "subs" well and use it often, but I do find it clumsy at times, and it only substitutes in the expression given, so it is not really equivalent to With[]. So I stumbled across "use" & it seemed to fit the bill; also, I thought there is a construct I haven't used before, maybe it can be helpful beyond this specific task. Now I am not so sure as it seems to be quite limited in what it does, not what I imagined (which was a kind of subs across the "in" part of the "use" construct).

M.D.

@itsme Ok, let me try to show you a piece of it here. It only shows a couple of the rather deeply nested With[] construct. But you get the idea: it is a bunch of variables being initialized and later on they will be used in the code in the construct. Nothing super-fancy, and in Mma the nested With constructs don't look as clumsy as the nexted "use...in..end use" constructs look like in Maple. I haven't completed the port yet so I do not know yet whether my straight-forward using "use...in...end use" will work. But since I started porting this I have tried "use" in different, much smaller projects and so far have had very little luck with it.

I'll also upload a text version of the Mma notebook since Primes does not allow upload of .nb files. I edited some junk & a lot of graphics data out. I do not know and cannot check whether this is still valid Mma code; but to a large extent it should be. ipsim_03_ed.txt

Thanks in advance,M.D.

----------------

With[{
locnSensitivity={100.*^-6,200.*^-6,500.*^-6,1.*^-3,2.*^-3,5.*^-3},
locnSensWaitCycles=10,
locnVarMin=.1^2,
locnVarMax=1^2,
pidle={4,4,4}, (* cycles *)
pjump={2,.2,5*^-6}, (* microns *)
pwalk={True,True,True},
locnSign=-1,
locnNoisOff={0,0,0} (* noise offset, volts *),
locnNoisRms={1,1,1}.0001 (* rms noise, volts *),
sqrt2=Sqrt[2],
dithTolerance=.1,
dithChangeMax=.3,
dithWaitCycles=30
},
With[{
numSens=Length[locnSensitivity],
dTolLo=1-dithTolerance,
dTolHi=1+dithTolerance,
dChLo=1-dithChangeMax,
dChHi=1+dithChangeMax
},
... etc (more Mma code).

 

@bryon Ok, I am trying to reply...

Whohoo! Yes, it works (well, at least this time).

Heartfelt thanks!

M.D.

@roserope 

As for reading material on Maple, there is quite a bit on the Web. A number of these are from University classes. One I downloaded and used is Problem Solving with Maple, by Carl Eberhart, carl@ms.uky.edu from U. of Kentucky. There are others as well. Google is your friend. Also depends a little on what you need (e.g. calculus vs linear algebra).

A number of these are relatively old and use earlier Maple versions all the way back to Maple V. But do not let this discourage you; the basics have not changed that much. The Maple docs (User guide and Programming guide & whatever else there is) are actually useful as well and available online at Maplesoft.com.

You do want to peruse the Help facility often. While not perfect there is a lot of good info in there.

Finally, start with simpler problems even if you can do them faster by hand. In that way you'll get the hang of Maple & its idiosyncrasies. For more complicated problems it almost always pays off to break them down into steps & guide Maple along. Maple won't solve a biggie for you in one command (at least not usually). But if you take it through the steps it may well get to the solution and avoid tripping up on details as we humans are often prone to do.

Maple is a sophisticated tool that comes with a learning curve so you'll need to invest some time. If you work or will want to work in a technical/scientific field, this investment will pay off big time, though.

Mac Dude

@roserope 

As for reading material on Maple, there is quite a bit on the Web. A number of these are from University classes. One I downloaded and used is Problem Solving with Maple, by Carl Eberhart, carl@ms.uky.edu from U. of Kentucky. There are others as well. Google is your friend. Also depends a little on what you need (e.g. calculus vs linear algebra).

A number of these are relatively old and use earlier Maple versions all the way back to Maple V. But do not let this discourage you; the basics have not changed that much. The Maple docs (User guide and Programming guide & whatever else there is) are actually useful as well and available online at Maplesoft.com.

You do want to peruse the Help facility often. While not perfect there is a lot of good info in there.

Finally, start with simpler problems even if you can do them faster by hand. In that way you'll get the hang of Maple & its idiosyncrasies. For more complicated problems it almost always pays off to break them down into steps & guide Maple along. Maple won't solve a biggie for you in one command (at least not usually). But if you take it through the steps it may well get to the solution and avoid tripping up on details as we humans are often prone to do.

Maple is a sophisticated tool that comes with a learning curve so you'll need to invest some time. If you work or will want to work in a technical/scientific field, this investment will pay off big time, though.

Mac Dude

So I tried your sheets and, sure enough, everything works just fine on the machine exhibiting the problem. I then reloaded my original sheet, and it works now, too. This was with a fresh Maple instance running.

So I am reminded that sometimes Maple has to be restarted from scratch. Just starting sheets with "restart" is not always enough. What threw me off was that I have seen this font problem before so I did not think it to be a temporary issue.

Well, live and learn. And thanks, PatrickT, for looking ito this.

 

Mac Dude

So I tried your sheets and, sure enough, everything works just fine on the machine exhibiting the problem. I then reloaded my original sheet, and it works now, too. This was with a fresh Maple instance running.

So I am reminded that sometimes Maple has to be restarted from scratch. Just starting sheets with "restart" is not always enough. What threw me off was that I have seen this font problem before so I did not think it to be a temporary issue.

Well, live and learn. And thanks, PatrickT, for looking ito this.

 

Mac Dude

Edit: Oops, just saw that Joe already pointed that out. So there you have it...

It seems that with the "units" keyword the conversion is differential, i.e. only taking into account the slope.

M.D.

Edit: Oops, just saw that Joe already pointed that out. So there you have it...

It seems that with the "units" keyword the conversion is differential, i.e. only taking into account the slope.

M.D.

That example fails even without the quotes. I actually do not understand your example: parse is trying to interpret your string as a Maple statement, which in your example it is not.

But surely you know that.

This works:

str3:="print(\"parse test\")";
parse(str3);
eval(parse(str3));

Mac Dude

That example fails even without the quotes. I actually do not understand your example: parse is trying to interpret your string as a Maple statement, which in your example it is not.

But surely you know that.

This works:

str3:="print(\"parse test\")";
parse(str3);
eval(parse(str3));

Mac Dude

@Alejandro Jakubi @Preben Alsholm

Thanks everybody. I will try to work with Preben's applyrule1 since that approach seems most general to me. Using the inert form is a definite possibility also.

Overwriting the Maple library version of applyrule seems to invite hard-to-diagbose bugs and is not something I would do, at least not until I get so overconfident as to believe I have actually mastered Maple. Right now I am far away from that state...

M.D.

@Alejandro Jakubi @Preben Alsholm

Thanks everybody. I will try to work with Preben's applyrule1 since that approach seems most general to me. Using the inert form is a definite possibility also.

Overwriting the Maple library version of applyrule seems to invite hard-to-diagbose bugs and is not something I would do, at least not until I get so overconfident as to believe I have actually mastered Maple. Right now I am far away from that state...

M.D.

Thanks to all for your good suggestions, which will solve probems of this nature. Maple is a complex beast & I still have a lot to learn.

Alejandro's suggestion of a distributive rule reminds me that my problem is structurally similar to one I had some time ago, involving sums, which was solved right here on Mapleprimes with a similar approach. Some of us need to be taught more than once, I guess :-)

frontend, freeze and thaw are completely, utterly new to me. Thanks for pointing these out.

As for the output format: I was aware that pasting 2-d output is not optimal but did not know how to fix it. I was looking for the equivalent of InputForm in Mma, but Maple does not have that. Well, lprint is it, so next time I will have to use a different excuse.

M.D.

Thanks to all for your good suggestions, which will solve probems of this nature. Maple is a complex beast & I still have a lot to learn.

Alejandro's suggestion of a distributive rule reminds me that my problem is structurally similar to one I had some time ago, involving sums, which was solved right here on Mapleprimes with a similar approach. Some of us need to be taught more than once, I guess :-)

frontend, freeze and thaw are completely, utterly new to me. Thanks for pointing these out.

As for the output format: I was aware that pasting 2-d output is not optimal but did not know how to fix it. I was looking for the equivalent of InputForm in Mma, but Maple does not have that. Well, lprint is it, so next time I will have to use a different excuse.

M.D.

First 34 35 36 37 38 39 40 Page 36 of 42