Mac Dude

1596 Reputation

17 Badges

14 years, 325 days

MaplePrimes Activity


These are replies submitted by Mac Dude

acer, this is pretty much exactly what I want. I did readup on components; however, it wasn't clear to me how I could get them to update while the loop is running. Your example makes this clear.

Thanks much,

M.D.

As for Alejandro's remark: I am not sure this is fully correct: i did once write a wrapper around a read-in procedure to ask me for the directory; that dialog I brought up programmatically (no use of any of the pallettes or such; just plain 1-d input) & the code gets the string handed back. I >did< do this as a Maplet and the main sheet stall during the dialog's being open. The main part I could not see was how I can get a component to update while a loop is running.

Scratch that. Embedded components of course behave differently than Maplets do. Alejandro is correct, can't programmatically create embedded components.

As for Alejandro's 2nd remark: Merci beaucoup, mais non! I have spent way too many hour on terminals and line input; or editing files and then running them. Notebook GUI's, even somewhat sluggish ones (as most are) are great progress & I would not want to go back. Any routine of a more general nature goes into a library, sooner or later, and is there when I need it so my Notebooks are actually not that long. I even stopped my old practice of saving programs as text files to be read-in, in favour of making proper modules or packages. I like this approach in Maple very much, esp. as it can be used in a nearly object-oriented way.

Very interesting post; in fact it confirms my long-standing belief that stop signs are usually a bad thing :-)

But I do have some comments:

In your equation E := 2*(1/2*mass*speed^1); purportedly showing the energy wasted due to the stop there is the obvious error of the exponent being 1 instead of 2; I assume this is just a transcription error. More significant, however: You are counting the energy twice, which I believe to be wrong. You are putting 1/2mv^2 of energy from the tank into the car when you accelerate form 0 to v. However, when you brake, that same energy goes into the brake pads, you do not need gas for that. IOW, when you brake for the stop you do not directly pay; you are simply wasting what you paid for before. You then do pay with gas when you accelerate again. So the enery cost is only one times 1/2mv^2.

You further down talk about the Corolla's average mileage of 26 mpg and state that it increases during acceleration. Well, this belies your Canadian heritage: It is the consumption (liters/100km) that increases, the mpg (miles/gallon) actually decrease. I did not go through your sheet but I hope it is right in there.

Finally; I did not find any efficiency used for the engine. I have no hard data, but I believe thermodynamically you do not get a gasoline engine to do much better than 30...35%, which would have to be factored in when converting the energy in the fuel to kinetic energy of the car (unless the fuel number has that efficiency already built in).

Mac Dude

 

I really doubt it is a question of age of the style file. Looking at your output it appears there is some Maple input and the some "MapleLaTeX", presumably output. It does appear that Maple is doing something ugly here: rather than using LaTeX syntax it uses special commands (presumably defined in Maple2e.sty) and then puts out graphical elements (??). If you can identify what of this gibberish stands for what part of the equation (assuming that you are putting out an equation or expression) you can try deploying strategically placed line breaks (\\). You may have to break up the \mapleinline command for that (or whichver command actually does the inserting). Also note there seems to be a \maplemultiline{} command. If you are familiar with LaTeX styles you could go into the style file & see what is actually happening (but then you might not have posted here...).

Other than that; you could try to break up your expression in Maple (e.g. using op()) and put out the pieces. In LaTeX you may need to do some fiddling to have it come out right.

I have not tried LaTeX output from Maple myself yet, but looking at the gibberish in your post I think I'd just bite the bullet & retype the whole thing in proper LaTeX syntax. If you print out the Maple 1-d form (i.e. the input form) of the output then the transcription should not be too difficult. (In fact, I can see a small Perl routine doing the translation).

Mac Dude.

Great thanks much. Right now, of course the problem does not show up; but at least I am able to get rid of the garish red-blue color scheme:-). If the disappearing-symbols problem is a font issue (which I strongly suspect) then this should do the trick.

M.D.

Great thanks much. Right now, of course the problem does not show up; but at least I am able to get rid of the garish red-blue color scheme:-). If the disappearing-symbols problem is a font issue (which I strongly suspect) then this should do the trick.

M.D.

Alejandro and itsme, you are correct. I messed around even more with "use..." and it just does not appear to do what I want (or what MMa's With[] does either). It seems that the bindings in the first part of "use" are not even local in any sense; at least in a piece of code i have now used it in the bindings are all global.

Now wondering what "use...in...end use" is even good for... but that's more for philosophy class.

Oh well, Modules and Procedures, here I come...

Thanks all,

M.D.

Alejandro and itsme, you are correct. I messed around even more with "use..." and it just does not appear to do what I want (or what MMa's With[] does either). It seems that the bindings in the first part of "use" are not even local in any sense; at least in a piece of code i have now used it in the bindings are all global.

Now wondering what "use...in...end use" is even good for... but that's more for philosophy class.

Oh well, Modules and Procedures, here I come...

Thanks all,

M.D.

@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.

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