Mac Dude

1561 Reputation

17 Badges

12 years, 268 days

MaplePrimes Activity

These are replies submitted by Mac Dude

@MortenZdk Yes, I meant with().

As far as reading the file using "./<filename>" I suggest you test it. I personally have not use this construct. I do remember having had some initial struggles as the Maple GUI does not have a concept of home directory.

I thought there was a way to read a .mw worksheet into another one, but I have never done it.


While in your purely numeric case your only real issue was the use of the wrong symbol for the imaginary unit (you used i,whereas Maple' imaginary unit is I), be aware that for Maple any symbol a prriori can have comples values. This implies that

z:= a+b*I;

returns |a+b*I| rather than what you might expect. You can use evalc() to tell Maple to evaluate for real-valued symbls:


which returns sqrt(a^2+b^2).


Mac Dude

@John Fredsted Hmm... strange; I was using Maple 2015 for this.

I blew the sheet away already and am not in a position right now to try again. I may try again later this eve.

Now, when I left the local declaration in; I remember getting a message telling me that I can get at the name in the normal namespace by pre-pending :-. But in the example of the OP, the local declaration does not make too much sense.



@Carl Love The point here should be that Maple has two initialization files (not counting the one for the GUI). There is one that gets read for every user on a system that starts up Maple. On a true multi-user system, only the sysadmin would have write-access to that. Then there is the user-specific one, and it is >that< one that Les and all us other mortals should use. That one goes into the home directory at least on Unix and OS X. So in that sense we agree: Les should NOT use C:\Program Files (x86)\Maple 2015\lib\ maple.ini, which appears to be the system init file, but rather C:\Users\Leslie\maple.ini.

I assume—but have not verified—that Maple runs the system init file first (if it exists) and then the user init file (if that exists).

Of course many of us will use Maple on what in essence are single-user systems, in which case the difference is a bit academic.



@Carl Love Actually, it is a bit more restrictive: On Mac OS X; the global initialization file is $MAPLE/lib/init. Every user on that system executes that upon Maple startup. The local, user-specific initialization file is in $HOME/.mapleinit (the leading dot preventing display in the finder or in cmdshell ls commands.

On Windows the scheme is similar as outlined in the Help page (Create Maple Initialization File). Since I don't know Windows I should not spew FUD here.

The directories as far as I can tell are not optional but fixed. Although it seems like if I start Maple from the cmdline I can use the -i qualifier to specify a different init file. On OS X I can probably edit the plist file to change the location of .mapleinit (although it is not clear why I woud want to do that). On Windows I don't know. Maybe edit the Registry?

Bottom line (for the OP): read the Help pages and put you init file into the location for the user init file and give it the right name.


@Joe Riel Obviously this works. However; I have run into trouble doing it this way as sooner or later I'd want to use the same variable name in a different context, and maybe not even evaluated. So I have resolved to put things like this into a Package. Either I load it using with() or I use the long form (like Package:-k_) if I don't want to clutter up my namespace.

Doing it that way does incur the extra work of creating a .mla file from the source and putting it somewhere Maple can find it. I suppose the module could also be defined in the init file; I have never tried that.

Just my $0.02,



@Traruh Synred Actually, the ASCII code for blank is hex 20. Hex 00 would indicate something actually wiped the file. Or the allocation tables got corrupted, but in that case I would expect you'd have more trouble with your computer. Did you try a disk analyis & repair program? (and do analysis only; don't even dream of repairing anything until you have a complete, fresh clone of the disk somewhere safe).

Be that as it may; at this point about the only other thing you could try would be to inspect the disk blocks and see if there were pieces of your data around on that disk somewhere, using a block-level disk editor. Given the size of modern disks that is not a trivial undertaking; I have not done this for decades (literally).

I am not sure it has anything to do with SSD vs rotational media. Sure, SSDs are not infallible, just like spinning disks although they may have different failure modes. I really don't know; all I know is that I have had SSDs in my laptops for about 5 years without any problems. And I have had rotational disks that lived for 10 years or more; others failed after a year.

You are doing the right thing to look for a backup solution, and automatic is certainly the best and easiest. Whether an online solution is right depends on the amount you need to back up; personally I deal with TB (terabytes) of data so I use a local disk as any affordable internet solution would simply be impractically slow. A few gigs? No problem. Over the short term, however, any internet way to backup your daily work should work very well.

Sorry for not being of more help; but it seems all of us have to have such an experience once in our life. I lost a disk with weeks worth of data reduction and analysis as a grad. student; no fun at all. Life has its way of teaching us lessons...

Mac Dude


@Traruh Synred Are you sure your file system is ok? As you may guess, I am not familiar with Windows; but while eons ago I think I had a corrupted Maple file I do not remember ever to have had a totally empty one, or one "filled with blanks" (whatever that exacly means).

A decent tactics would be to start each day by making a copy of the file and append the date to the name. If things go bad you know what  to fall back to. I do this for important stuff.

And you do have a backup scheme for your HD, don't you? If not, be aware that you are living on borrowed time.


@Traruh Synred I did a quick test with a random MAS file that happened to lie around on my disk.

I opened it in Emacs. Clearly this was an XML file and seemed to have the correct structure for a Maple Worksheet (esp. the <Worksheet> and </Worksheet> tags were there). So I saved it as a .mw file; upon which Maple dutifully opened it and it all seemed to work.

So, if you have Emacs, or some other editor that is willing to open it, you can check on its state. It should begin with something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/> ...

and end with


If the closing tag is missing then your sheet is incomplete. In principle you can fix this by adding the closing tag by hand, however, you have to at least close all other tags in the correct order for this to work. If your file is large that is not a trivial task. I tried that once and did not succeed (so I reverted back to my last saved file).


@Traruh Synred Maple actually maintains backup copies of files being worked on; they are named ..._MAS.bak and would be in the same folder as your working .mw file. I have never used these; someone else has to chime in on how to recover from one of these.

What I do is to regularly (like several times/day) save backup copies of stuff I am actively working on, be it a large Maple project or be it that all-important talk I need to give on Thursday. This is in addition to regular backups of the whole disk that I do maybe once/week. This does not help you with your problem now, but in the future you'll be well advised to adopt such a scheme, the only drawback being that you litter your space with older files. While being quite reliable these days, hard- and software can and does fail (just as other things like appliances and cars). Operating without any backup is simply not a smart move if you value your work.

For the record: It has been years since I ran into file-corruption issues with Maple despite daily use and having done a few quite large projects (with MB-size files; libraries and multi-GB of RAM space needs). But again; a file with the most recent working state is never far... that is why I have not needed to use Maple's backup copies.


@MrYouMath If you use % within an execution group then you are guaranteed to get the previous line as the whole group is executed always. I do not recommend using % across execution groups for, as Carl stated, you get the result of the last statement executed, which in principle can be everywhere in the worksheet, even below the line with the %.


@tomleslie Thanks much for checking this.

In the meantime I verified the error in my original file still to be present in Maple 2015.Your version does avoid the error. However, I do not like using "assume" as I tend to get confused by it. One immediate problem is that it seems to put the assumption on all elements of pV. This was not my intent (even if in my particular case one might argue that such an assumption would in fact be fulfilled for all elements of pV).

Anyway, I'll SCR this one; but in the meantime maybe I have to brave "assume" again...

Thanks much,


using the big green arrow in the posting editor.

The 2nd and 3rd errors simply mean that P[0] and PP were never assigned a plot structure. Most likely due to an error upstream of the assignments. This implies that the plots:-display statement is in the same execution group as the assignment to P[0] and PP. I suggest you put the plotting statements into separate eecution groups so you can figure out where things go off the rails.

The first error means that plots:-display was given a plot structure as an argument, but it has an object "circle" in it that display does not know what to do with it. The problem then depends on how "circle" was generated. You may be able to inspect "circle" in the variables list in the panel on the left side.



@Carl Love Although thoroughly off-topic here, the reason for using a fake handle is simple:

Once upon a time it happened that I googled myself.
And it showed me a large number of entries under my name.
And these were mostly comments posted to a certain mailing list that I would frequent (not MaplePrimes).
And as it happened, not all of these were comments of great wisdom.
And I got quite concerned, for it also happened that prospective employers would google applicants.
And I did not want such entries be as they were.
So I committed right then to no longer post under my real name.

Mac Dude.


@Carl Love Looking at the file with Emacs indicates it is truncated and is missing closing tags at the end. I was able to add closing tags until Emacs' XML checker no longer complained (so I think I got the order right), but Maple (2015 in my case) still will not open the file.

One of the problems is that the file is so bloody big that Emacs gets slow as molasses (probably due to the XML checking), and one cannot get an overview of what exactly is still missing.

The OP could try finding out what is wrong with the commands from the Worksheet package; but it is not going to be an easy task to recover this, just because of its sheer size.

The morale is (a) back up an active worksheet every-so-often so you have a fall-back and (b) split up worksheets that get too big. I have routinely run into problems with sheets that get larger than a few MB (this one is 9 MB).



First 12 13 14 15 16 17 18 Last Page 14 of 42