Mac Dude

1107 Reputation

13 Badges

7 years, 177 days

MaplePrimes Activity


These are replies submitted by Mac Dude

@Ronan You really want to get a (pdf-) copy of Maple's Programming Guide. You can download it from Maplesoft's support pages, specifically, this page has near the bottom a link to the Programming Guide:

http://www.maplesoft.com/documentation_center/

It answers most of your questions (and some you didn't even know you had).

Some easy answers: Yes, you can have a variable number of parameters. You can set defaults for each one. You can use Null as a parameter value when you call a function or procedure. The Programming Guide explains all of that.

As for your types; I have written packages that define and use their own types. So I know the scheme Carl proposed (with the AddType statements in a ModuleLoad proc) works. Make sure you are calling ModuleLoad(); before the end module statement. The module definition and ModuleLoad() can appear anywhere, I think...

I am not sure about your use of the "uses" clause. AFAIK, you just say "uses TypeTools" after which TypeTools is added to the list of namespaces that get searched. In other words: your equation in uses may not work. Personally, I get around such bother by using fully qualified names everywhere in my packages (i.e. TypeTools:-AddType()). Yes, more typing when writing these packages, but much easier to debug & trouble-shoot.

I hope this helps,

M.D.

Edit: Replaced some redundant remarks.

 

I somewhat beg to differ: one confirmation dialog before nuking and post should be ok. After all, one does on occasion hit the wrong button (well, I do at least). It could be argued, however, that similar safety escape can be provided with an undo button that shows up after a deletion (spam or otherwise) of an entry.

M.D.

@Ronan Well, the .help file has to be where Maple can find it. libname has the list of directories (folders) Maple will search. Myself, I prepend the directory with my own files to the others in libname and comingle the .mla code files and the help databases in there. In that way, my own stuff comes first should there be any name clashes (which you really want to avoid).

So, yes, moving the .help file to such a directory matters.

Mac Dude

@acer You can get a catchable error by trying to read a property of the slider. In that way you can set a flag and also instruct the user (i.e. yourself) to setup the slider with the correct name. Not perfect, but at least you don't get the umpteen error windows stacked on top of each other.

I mod'ed your program. If you rename the slider to something other than Slider0 you'll get the mesage but the code runs fine (sans progress bar).

M.D.

prog14-2.mw

@Ronan I see that the Create command is commented out, so you are trying to use an extant .help file. If I recall correctly, that does not work. I believe you need to start with creating a new .help file & then stuff if with the help pages. So leave the first two statements (Create and Add) active and choose a unique name as not to clobber something important.

The help file structure changed not so long ago. I really doubt Maple 2016 introduced another file format. And my 2015 help files work in 2016.

M.D.

 

@Carl Love I always use solve with a list of eqs and a list of variables to solve for. tomleslie's reply below indicates that solve works with sets as well, which I did not know. A quick check of the docs confirms this. Since the OP was in a format I could not cut/paste I did not try myself.

My apologies for spamming MP with a not-well-researched "answer."

M.D.

 

@Carl Love Hmm... while I understand your reasoning I'd hate to implicate a large and somewhat diffuse group like this. So rather than trying to reason it, someone at Maplesoft should look at the logs & ferret out what is really going on & whether there is a pattern.

MaplePrimes is a valuable marketing tool for Maplesoft so I would argue losing it to spammers would not be in the interest of the company. At this point, I don't think this is an overly alarmist statement; if we users stop deleting the spam this board may well become useless and abandoned unless soeone at Maplesoft would step in. But then it is likely more effective to stop the spam at the gate.

M.D.

@Carl Love It would not take long to know whether Captchas would work. I have no idea how complex the programming would be, but they are not that rare so I suspect it is not that difficult. The added work of solving a Captcha at accocunt creation is not that onerous.

I wonder where these spam postings and account creations are coming from, whether all from a few addresses or completely random...? Most follow a quite predictable pattern & blacklisting certain IP addresses may be another way to reduce the amount of spam. Finding the IP addresses of the senders should be as easy as scanning the server logs with correlation to the spam messages.

M.D.

 

@taro The potential problem I see with using .mpl files is that you will likely want to use Maple in Document mode with 2-D input so you get all the nice typesetting Maple is able to do. .mpl files are written in 1-D input. So you get either only the last result from reading and executing the .mpl file, or it would be 1-D Maple input interspersed with the output... that may not be what you want. It is worth to experiment a little with this.

If you can define a set of higher-level commands in a package you will be better off, and potentially your work becomes easier to read. And yes, potentially your calculations become much shorter (although that really depends on the specifics).

When I said I keep my sheets short, what I referred to was that I would use separate worksheets for each section of the whole work; where section can be a chapter or something less. I cannot give a hard rule here; but my sheets of maybe up to 3 MB in general did not cause problems, whereas much longer ones would. It is not fully deterministic; in one case I had to split one into two sections as the whole thing just would not be manageable; with the Maple GUI periodically locking up on it. So it is not a question of the mathematical complexity but rather the complexity of the typesetting involved. It does make referencing to results in other worksheets more awkward: I just inserted the equation numbers as text and maybe put the particular equation or expression in. I do no tknow of a mechanism to dynamically link across sheets. For completeness I should mention that most of my experience in this regard is from Maple 18 and 2015; 2016 may be better.

M.D.

 

Just one clarification: The parameters in a function definition (i.e. a,b anc c in proc(a,b,c)) are not globals but rather formal parameters that get replaced by their values upon a call. Indeed, Maple does not let you assign to these, and while occasionally annoying that probably leads to cleaner and less error-prone coding practice.

I do think you need to declare globals if you want true globals. I often get warnings that such_and_such_name is declared local by default when I run my modules and forgot to declare a name.

Mac Dude

 

@tomleslie  I am relatively certain that the key sequence to recalc. a worksheet is fairly new as I remember looking for it & never finding one.

A quick check on my Maple 15 installation shows that none of ctrl-shift-enter, cmd-shift-enter and friends work here. I think on newer versions (2015; 2016) cmd-shift-enter works (all this is Mac OS X).

Of course, by now I am so used to not have a keyboard shortcut that I always hit the !!! button...

Mac Dude

 

Assuming you are really looking for help I suggest you re-phrase your question in standard English with a minimum of interpunction. Also please tell us what you were  trying to do when the error was encountered.

M.D.

Well, it is trying & not getting anywhere.

I'd be a bit concerned about the a[i] constructs as I have seen Maple tripping up on things like this before. If you use a relatively new version of Maple you can replace the [i] indices by __i, which makes the a__i atomic rather than elements of a table. I do not see an obvious mistake in your code, but names subscripted using [...] are tables for Maple whereas you use them as if they were just names. The "__" form avoids this.

If you have any idea of the rough location of the solution you can enter that as a starting point. RTFM on how to do that.

If possible try a simpler case with only a couple of equations first.

Finally, do you know there is a [real] solution?

M.D.

 

@gubach Thanks much, gives me an idea what you are trying to do. In the meantime, vv has shown with remarkable terseness how Maple can indeed produce such transformed images with much less effort than I thought. I think that gives you most of what you need.

Cheers,

Mac Dude

 

@vv I agree basically with most you say. However, if you apply your conformal function (which is f(w)=w^2 with w=x+I*y) to the image of the horsies you will find that it actually does not work all that well. The resulting dimensions are huge, and the transformed image has "holes" in it due to the discrete nature of the indices. These "holes" have to be filled by (2-d) interpolation and the transformed image will have to be scaled down to a reasonable size. The transformed image is also not rectangular but gets stored in an rtable, so decisions about clipping etc. have to be made. By the time this is all programmed the whole procedure has grown a bit more complicated than just the application of the transformation rule. It may be possible that the 3-d plotting routine of Maple does some of the interpolation itself, but I am not sure of that in this case.

Which serves to impress it on the OP that there is some work needed to produce images like the one he references. I do not know what ImageForwardTransformation in Mma does and how much is left to do; in Maple most of the work has to be programmed by the user. Incidentally, the referenced Mma-generated images do look like the originals had the origin at the center. While translation indeed preserves conformality, the actual transformation result is different as conformal mappings are in general nonlinear.

Mac Dude.

5 6 7 8 9 10 11 Last Page 7 of 37