Mac Dude

1122 Reputation

13 Badges

7 years, 213 days

MaplePrimes Activity


These are replies submitted by Mac Dude

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.

@vv  and to the OP: While it is true you can setup an arbitrary transformation this way, conformal (angle-preserving) mappings are tricky, can have infinities, and if done with indices like above one needs to take special care so the result is meaningful, does not have holes, etc. Also, in many cases the origin has to be defined to end up with the desired result.

If the OP were to tell us what he wants to map and the mapping function, maybe we could help implementing it.

I have no idea what Mma does, but I would expect it to be a lot more intricate than the above if it were able to do a conformal mapping in a straightforward way with a minimum of help by the user.

M.D.

@MortenZdk Actually, once setup it is not particularly complicated.

Note that the read() business is not really necessary; for smaller modules you can put the code directly into the file (Lattice.mw in my  case). The directory sequence you setup once. Each time you update your package you run its .mw file and bingo, every sheet uses the updated package (if it has a restart before loading the package). Think of the creation of the .mla file as a compilation step and the .mla as an object library. (There is no real compilation ongoing of course.)

M.D.

@MortenZdk Well, the way I do it is by having one directory that holds all my packages. I then save all my packages in .mla form in that directory and tell Maple where it is in my .mapleinit file.

Specifically:

read("/Applications/Math_Calc/Maple 2015/Packages/Lattice/Lattice4.mpl"); # reads in the code (same as mentioned above in my 1st answer to your question)

LibraryTools:-Save(Lattice,cat(libname[1],"/Lattice.mla")); # this saves it as a package that will autoload upon with()

libname;
 "/Applications/Math_Calc/Maple 2015/My_Maple_Libraries",

   "/Library/Frameworks/Maple.framework/Versions/2015/lib", "."

So libname in my case is a sequence of three directories, the first one being my own. For that reason I use libname[1] in the above cat() statement.

The read and the LibraryTools:-Save re in one small .mw worksheet. Each time I update the package (Lattice) I just run that procedure and it replaces the .mla file which is the oneloaded upon with(Lattice). The small .mw file and the libname list are machine specific, once these are set the rest, including updating, is the same everywhere I run Maple.

The actual code I update using emacs and Joe Riel's maplev mode for emacs.

HTH,

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.

M.D.

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;
abs(z);

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

evalc(abs(z));

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

HTH,

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.

M.D.

(edited).

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

M.D.

 

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

M.D.

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

M.D.

 

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

M.D.

@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

</Worksheet>

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

M.D.

First 6 7 8 9 10 11 12 Last Page 8 of 37