1080 Reputation

9 Badges

16 years, 265 days

MaplePrimes Activity

These are answers submitted by GeorgeJ

I just now realized that it was the inner proceedure that was being declared local, not the variable i. It does seem strange that MAPLE couldn't figure out that a proceedure declared inside another proceedure was intended to be local. Why the need to declare the inner proceedure name as a local variable?
Thanks for taking the time to answer. I'm learning new things about MAPLE all the time. Look at this c:=14: b:=c: b 14 b:=12 b:=12 c 14 So changing b didn't cause MAPLE to "go backwards" and change c But with records that seems to happen rec1:=Record('f','g'):rec1:-f:=10 f:=10 rec2:=rec1: rec2:-f :=20 f:=20 rec1:-f 20 In some cases this is what I want, but not always. How would I tell MAPLE "Please create a new record rec3 which has the same fields as rec1, and whose inital values are the same as the corresponding values of those of rec1, but I want to be able to change rec3 without changing rec1" ? I suppose you could make assignment statements for each field but is there a shorter way?
I meant to post the above msg in a different thread. Please disregard it. This is a good time to repeat a question I asked earlier. Is there any way to delete one's post in this forum?
Well if that doesn’t take the cake!!! Here I am blathering on about how MAPLE shouldn’t abandon the doc mode, and I run into a problem and get needed help from someone who has little use for the doc mode! I hope I will not be too annoying if I suggest that at some point I would love to know why that worked. I think knowing that would enhance my understanding of the doc mode -regards
Well if that doesn’t take the cake!!! Here I am blathering on about how MAPLE shouldn’t abandon the doc mode, and I run into a problem and get needed help from someone who has little use for the doc mode! I hope I will not be too annoying if I suggest that at some point I would love to know why that worked. I think knowing that would enhance my understanding of the doc mode -regards
I agree w the opinion expressed here that the doc mode is problematic and should be avoided by someone new to MAPLE. However, I think that while in its present incarnation its quirky & greatly in need of improvement, the concept of a doc mode for MAPLE is valid. I spend hours each day using Excel (I’m in the Investment Business. Math is a hobby for me – I’m a dabbler here, so take what I say w a grain of salt ). One of the things I really like about Excel is the fact that an Excel workbook, the apppearance of which is presentation quality, contains all of the logic and data used to generate the visible results. One doesn’t have to use Excel to develop a model and then dump the results into some other program to get presentation quality. In Excel, normally only the value in a cell is visible. The user can click on the cell and see the cell’s formula in the upper left of the screen. One can move around clicking on cells and see excatly how the model was constructed. If someone e-mails me an Excel file I can see exactly what the assumptions are and change them if I want. I think it would be a good idea if a symbolic math program such as MAPLE has this feature, and I think doc mode is a worthwhile step in this direction. In doc mode, you can collapse an execution group and just see the output. I think a properly constructed MAPLE worksheet in doc mode has what I would call “psuedo presentation quality”. No, it doesn’t have as good appearance as is possible by dumping the output into another program (such as WORD). But the MAPLE worksheet contains the underlying logic, the same way an Excel workbook does. Some time ago I was reading Feynmann’s lectures on Physics and I came to a section on planetary motion. In a footnote the book explained that the derivation of the elliptical orbit from the inverse square law of gravitational attraction would not be presented in the lectures. Feynmann made a joke about wanting to leave the math dept with something to do. Anyway, I tried to derive it and the result was a hopeless mess. For one thing I was using Cartesian coordinates (talk about dumb!). So I finally did the reasonable thing, I went to Wikipedia and found a derivation of Keppler’s law of ellipses from the inverse square law. I admit I found the Wikipedia presentation challenging. It was sparse, and it took me while to figure how the equations fit together. I got the idea “I wonder if I could construct a MAPLE worksheet which would look almost as good as the Wikipedia presentation, but would contain the underlying logic so the interested reader could see how all the equations fit together without having to go through all the work I did.” The result is the file uploaded with this post. Go to any blue equation and click “view/expand execution block” and you can see the equation from which it was derived. Then you can collapse it again with “view/collapse execution block”. There are some quirks I wasn’t able to get rid of, such as the double appearance of the label (7). My perhaps biased opinion is that the worksheet doesn’t look too bad. Maybe I’d give it a B- on appearance. I’d be interested in anyone’s comments. I have it cast-iron ego, so if anyone thinks my worksheet sucks, they can tell me so without danger of starting a flame war . P.S. It appears that the original WIKIPEDIA presentation, which I used as a launching point for my derivation, has been substantially changed since I first saw it. View on MapleNet or Download
View file details
I just found the problem - a whitespace between map and the '(' symbol. As Emily Litella (Gilda Radner) would say......"Never Mind".. BTW, is it possible to delete a post before anyone has responded to it?
Thomas, that was most helpful. I haven't been able to find any documentation on that either in the printed material or the help files. If for some reason MAPLEPRIMES ever temporarily shuts down, I pity the person trying to learn MAPLE .
OK folks. Just when I think that the number next to my leaf (108 as of now) entitles me to think of myself as beyond the newbie stage, someone points out to me something about MAPLE that blows me away. Two weeks ago it was "evalhf". Last week "frontend". Now "autocompile". If someone had asked me about MAPLE a few weeks ago I might have replied "great on symbolic math, great on generating graphs, sort of sucks on any kind of time intensive numberic processing." Well, my introduction to "autocompile" significantly changes my outlook on this last point. I had no idea that this software came with an embedded C compiler and a translator from MAPLE to C. Thank you very much, Joe, for making me aware of autocompile. BTW, I realize my algorithm left something to be desired. I left in the sqrt function to tax the routine to get better comparison data between MAPLE and VB. Question: to get best performance when using autocompile, does it help to type your variables, e. g. "local i::integer, j::integer" Also, suppose I want to store results in a global Array, say a set of 1000 x 2 datapoints. In C++ this could easily be done w pointers. Is there any problem when you use autocompile if your proc gets data from and puts data into a pre-defined global Array? Should the Array be typed ? Thanks
Thank you Jacques. That was *extremely* helpful. Using your technique, I get to the point where the MAPLE routine is approx 1/2 as fast as the VB routine rather than 1/10 as was the case before. Actually, it appears that MAPLE does a bit better than this comparison would imply, because using a variable type DOUBLE in VB I only get a calculation to 9 places vs. 18 places in MAPLE, which puts MAPLE in the ballpark w/ VB. Is there any way to speed up MAPLE by getting it to use fewer digits with evalh ? I wonder if I might ask you one more question. I notice that the code in you post is of a different type font than the rest of your post. I have been having a difficult time getting code into my posts. I have to copy it to a wb in the document mode, then change it to MAPLE input, then "paste special" to WORD (an regular paste transfers it as a graphic rather than text), select the unformatted option, then reinsert the line feeds. Its tedious and the result doesn't look that good. How do you do it?
In MAPLE the correct form is for i from 1 to 10 do end do for example, the following for i from 1 to 10 do i^2 end do produces 10 lines of output, 1 4 9 16 25 36 49 64 81 100
In reexamining your post, it occurs to me that perhaps your question wasn't about the ability to feed a function directly to a LinearAlgebra routine but rather about the ability to feed such a routine with a matrix containing elements which themselves are functions. I tried this and as in your case Eigenvectors rejected the matrix. Here's some rather cumbersome code which attempts to get around that problem. Perhaps there's a better way. In any event, though the code looks awkward, once written one merely has to copy and paste. restart; with(LinearAlgebra): ctn := proc (x) options operator, arrow; convert(x, name) end proc: isq := proc (x) if x = "`" then true else false end if end proc: A := proc (pp) options operator, arrow; Matrix([[ctn(a1(pp)), 0], [0, ctn(a2(pp))]]) end proc: A(g); S := Eigenvectors(A(g)): S2 := seq(evalm(convert(S[i], string)), i = 1 .. 2): S := seq(StringTools[Remove](isq, S2[i]), i = 1 .. 2): S2 := seq(parse(S[i]), i = 1 .. 2):S2;
I'm not sure what's causing the problem in your worksheet, but the following works and indicates that, at least in some cases, it is possible to acheive the desired result by passing a function to one of the routines in LinearAlgebra B := Matrix([[1, 4], [2, 7]]); with(LinearAlgebra): Transp := proc (p) options operator, arrow; p^%T end proc: C := Transp(B): Eigenvectors(Transp(B)); Eigenvectors(C);
Thank you for your response. Maybe I'm doing something wrong, but I couldn't get your code to work. Uploaded with this post is a newer copy of my file. In this newer worksheet I have created a procedure AssignVariable2(x) which contains your code. As sent, the worksheet does not run this code. There is a command line towards the end of the worksheet which starts with the character #. If you remove this character the worksheet will run your code. It appears that your code does not do what I want it to do. Furthermore, and to my surprise, once I run your procedure mine wont run properly and I have to restart. I hope this doesn't sound rude because I really appreciate your help. Its possible that I've misunderstood how to run your code. In any event, you are right - I don't really have a handle on how MAPLE interprets lhs(x) in various situations. View 2292_Unassign within a on MapleNet or Download 2292_Unassign within a
View file details
Thank you. That was very helpful.
1 2 3 4 5 Page 3 of 5