Scot Gould

Scot Gould

517 Reputation

14 Badges

10 years, 152 days
Upland, California, United States
Dr. Scot Gould is a professor of physics in the W.M. Keck Science Department of Claremont McKenna, Pitzer, Scripps colleges - members of The Claremont Colleges in California. He was involved in the early development of the atomic force microscope. His research has included numerous studies and experiments making us of scanning probe microscopes, particularly those which involved natural fibers such as spider silk. More recently, he was involved in developing and sustaining AISS, a full-year multi-unit non-traditional interdisciplinary undergraduate science education course which integrated topics from biology, chemistry, physics, mathematics, and computer science. His current interest is integrating computational topics into the physics curriculum. He teaches the use of the computer algebraic and numerical system Maple to assist students in modeling and visualizing physical, and biological, systems. His Dirac-notation based quantum mechanics course is taught solely through Maple. An avid baseball fan, during his spare time, Dr. Gould is traveling, particularly to locations where he can bicycle on smooth, traffic-free roads, visit beaches and/or mountains, and enjoy good food and drink.

MaplePrimes Activity


These are replies submitted by Scot Gould

The following works for Windows users to ensure that the "Export As" (and the same may be true for "Save As" folder is the same folder in which the .mw file is location

* Go to the folder: c:\Users\<UserID>\Appdata\Roaming\Maple\<version> It is hidden uner the <UserID>, so you will have to enter the directory name in yourself. 

* Edit the file maple.ini with a text editor (Notepad). 

* Search for "Export As="

* It is likely to include a folder name. Delete the folder name so the line say "Export As="

* Make sure that no copies of Maple are running, else you will overwrite your work.

* Save the maple.ini file. 

* Restart Maple and test. 

For more info, see: https://www.maplesoft.com/support/help/Maple/view.aspx?path=worksheet%2freference%2finitialization

 

@krobe8 The File->Save As  command still chooses the same directory, but the all import File->Export As, now choose a directory I was working in the previous day, regardless of the current directory.  The Carl Love suggestion was added to the maple.ini file, (and the maplesys.ini), but that didn't work.

So, in short, what fiddling did you do to fix this problem?  (It is true, I just started working with some files that were created until Maple 2018. 

@amandaandi  I have worked with hundreds of new users, but this is a new one. My only suggestion is that you uninstall and then reinstall.  Or try to find another computer to install it on.

Sorry. I wish I had a better answer. (And nearly all problems I've seen with the installation process have been with Macs.)

Also, how did you activate it? Where did you obtain the activation code? This info might help folks answer your question. 

@acer Why you are at it, and to make this procedure even more useful, how does one modify "G" to print with an optional background color? 

@acer The simple procedures works perfectly - just as I had hoped. Saves me lots of time - much appreciated 

I did find one example of this type of question being asked in 2011, but it was for a command line output.  

Hopefully, the search system of MaplePrimes will point to this thread when the question is asked again. 

@janhardo 

If I understand what your goal, it is to generate output showing “prime” notation, or hopefully a “dot” notation, instead of the differential form.   I suspect that objective is independent of how one enters a statement into Maple. Hence using 1D or 2D Input is irrelevent.  I misunderstood you. I thought you were asking about the input becaust that is what Maple provides.  

Your interest in generating primes or dots in the output is different than mine. Mine is to use 2D Input because 2D Input looks like textbook math, thus it lowers the activation barrier for new users to adopt Maple.   Also, 2D Input is far more readable and understandable. Thus, 2D Input can play the role of 2D Output, simultaneously.

But your question about the dot notation did cause me to spend a little time with it. In the worksheet below, I do use it on vectors to which I obtain a highly readable document for anyone. However, there appear to be some unexpected outcomes. Possibly bugs.  They will be sent to technical support.

A couple separate points. While  I cannot speak for the mathematical world, the physics world, the “primed” notation is nearly always related to performing derivatives with respect to a position, x, and the “dot” notation is nearly always related to performing a derivative with respect to time, t.  Neither notation is viewed to be especially meant for vector calculus. Regardless, I do agree with you, using the notation with vectors does produce equations which appear to be less cluttered.

 

Note: In my opinion, the MaplePrimes document interpreter does not do justice to how nice this document reads. 
 

(Edited for a typo in the worksheet). 


 

In this example, Maple, because of its 2D Input, the worksheet is simply fantastic. It is readable to most anyone, including, and most importantly, to people who have never been exposed to Maple before.

restart

Write out a vector - and it looks like a vector!

 

"r(t) :=<x(t), y(t), z(t)>:    g := <0,-g, 0>:  "

 

Write out differential equation, using the "dot" notation. For most physicists, the dot notatation means differentiate with respect to time, t.   Note: no need to ask for a display of the output because the equation is self explanitory.

 

eq := m*(diff(`#mover(mi("r"),mo("&rarr;"))`(t), t, t)) = m*`#mover(mi("g"),mo("&rarr;"))`-c*(diff(`#mover(mi("r"),mo("&rarr;"))`(t), t))


Now set the initial conditions as one reads it in a paper:

initial_conditions := `#mover(mi("r"),mo("&rarr;"))`(t__0) = `<,>`(x__0, y__0, z__0), eval(diff(`#mover(mi("r"),mo("&rarr;"))`(t), t), t = t__0) = v__0*`<,>`(cos(theta), sin(theta), 0)


Solve the set of equations: eq and initial conditions for `#mover(mi("r"),mo("&rarr;"))`(t)

dsolve({eq, initial_conditions}, `#mover(mi("r"),mo("&rarr;"))`(t))

Vector[column](%id = 18446745964566591598) = Vector[column](%id = 18446745964566571118)

(1)

Absolutely beautiful.  It reads like math, and the derivation returns a vector using vector equations. No need to break up the vector equations into equations of individual component.

``


 

Download Example_2D_Input_of_Vectors_and_Dot_notation.mw

@Carl Love I completely agree that having a “set order” is incredibly useful, one that I have cherished since they modified it from the days when it appeared the order of the solutions was completely random. (Now I understand why that occurred. Much appreciated.)   

In addition, the current implementation of the “set order” is useful when working on physics problems where the mathematics can generate a slew of solutions. Nearly always, the first solution (or occasionally the first 2),  is  the only one that is physically viable. This is handy when discussing solutions in class. 

Hence, I can appreciate and benefit from the implementation of “set order” without spending the time to learn all its rules of it (given that at some point they may change).

@Carl Love If I understand what you wrote, sort uses the value from first entry of a row label's list that it obtains from the key function to order the row labels, but if the two values from the two lists are equal, it uses the values from the second entry to compare. Yes?

This is exactly what I want it to do, and it appears to be readable. However, in looking over examples in Help, I saw only one example of using 'key' so I'm not exactly sure how one would be able to know sort will work with a list of entries in the keys. 

Unless you object, I will suggest Maple add this example to the list of examples in both the "sort" help page and the "DataFrame/sort" page.

@Joe Riel Much appreciation for taking the time to think this out. I had been flailing around until now. This line reaffirms your finding about "setorder": 

{ mykeys } # --> { 9 "aa" + 2, 9 "aa" + 8, ... }

I'm not sure it is worth much time in reading more about the ordering of sets given that "This order could be changed in future versions of Maple, and/or objects could be represented in a different way in future versions. You should not assume that sets will be maintained in any particular order."

@Joe Riel Well, that was a LOL moment. In my excitement  to test the 'key' option, I miss interpreted the column "Batteries", which are integers, as the being the column that I want to use as a the primary sorting column: "B-type", which are strings. Hence when using "B-type", the values of the keys are mixed type of strings and numbers. Hence my confusion - why does it work. Hence your confusion of me asking about strings when your key was clearly multiplying numbers. (I'm familiar with the calculation, hence there was no confusion there. But I appreciate the follow up.)

Minimal version of Flashlight DataFrame:

restart; Flashlight := DataFrame(`<|>`(`<,>`("aa", "ba", "aa", "ba", "aaa"), `<,>`(8, 4, 2, 2, 2), `<,>`(1, 2, 3, 2, 1)), columns = ["b-type", "cost", "batteries"])

_m3174014334240

(1)

Sort first by "b-type", then by "cost" - lowest to highest

Prows := [seq(1 .. upperbound(Flashlight, 1))]; CostMax := max(Flashlight["cost"])


Intentionally pulling out the key function so that we can display the values:

"mykey(n) := Flashlight[n, "b-type"]*(CostMax+1)+Flashlight[n, "cost"];"

proc (n) options operator, arrow, function_assign; Flashlight[n, "b-type"]*(CostMax+1)+Flashlight[n, "cost"] end proc

(2)

 

Sort and reorder...

P := sort(Prows, 'key' = mykey)

Flashlight[P, () .. ()]

P := [3, 1, 5, 4, 2]

 

_m3174052322400

(3)

It appears to work.

 

What are values from the  key function?

mykeys := seq(mykey(n), `in`(n, Prows))

9*"aa"+8, 9*"ba"+4, 9*"aa"+2, 9*"ba"+2, 9*"aaa"+2

(4)

Now compare 2 keys.

is(mykeys[1] < mykeys[2])

FAIL

(5)

``

 

Which leaves with my original question - how come this key appears to work?

 


 

Download Flashlight_sort.mw

@Joe Riel I see the calculation output of the 'key' as a number * string + number, where the string could be "aaa".   I don't see how a string = a cell. Maybe you can point me to a reference in help. 

 And you are correct, I tried to switch the primary and secondary columns, and it failed.

Your next version is closer to what I tried to write. It may not be as "efficient" but it has to be far more efficient than a solution that uses recusion. 

@Joe Riel Thank you. Yes, I was trying to use a sorting procedure, but I couldn't get the indexing to work.  'key' is the key.  But more than that, I would never have guessed the multiplication of a string by a number could be used to compare elements. 

@DoingMath2018 I agree that I would like to see more examples in the help pages of Maple.  This is something that MATLAB does better. 

May I suggest a couple ideas for helping you find answers to your questions in the future. 

1) Search MaplePrimes. I entered "procedure multiple plots" and found this post from 2011: https://www.mapleprimes.com/questions/126163-Writing-A-Procedure-To-Output-Multiple-Plots .  This appears to ask essentially the same question that you have asked.  And @acer provided the answer then.

2) Open the Maple Portal worksheet (Toolbar: Help -> Maple Portal) and then select the series, "How do I.."  I refered to one of the tutorials in the list today.

@achreftabet , late last night I read the error in your version of my worksheet too quickly and missed what it says. In addition,  as @acer correctly points out, you are using Maple 18, which was released in 2014. (Maplesoft changed the numbering system to yearly, hence Maple 2018 was released in 2018.) As a consequence of your version, it appears the "rand" function call I used in the post to Kitonum, was one which your version could not execute. 

I don't have access to a copy of Maple 18, so I'm going to guess what needs to be done to correct the error in the line. In addition, I'm going to guess that you have limited experience with Maple, so I'll be more descriptive in my response.

The line in question is: 

a := Array(0..N, 0..N, (i, j) -> rand(-1.0..1.0)) ;

where N is defined as 10.  What this means is that I want to assign (define) to the name (or variable), an array of 2 dimensions for which the indices range from to 0 to 10. In defining this array,  each element, which is labeled by the indicies (i, j), there will be a random floating point number which falls somewhere between -1.0 and 1.0.  The goal of this line is to place some numerical values into each element of the array.

What can you do to make it work on your end?  It appears that if you change the line to say it selects a random integer in a range of -integer to +integer, then it might work. For example:

a := Array( 0..N, 0..N, (i, j) -> rand(-1000..1000)/1000.0 )

But you could also have fun and play around with array by putting numbers into your array using a formula. For example, what if we want the elements to count. 

a := Array(0..N, 0..N, (i, j) -> i*N + j )

If you plan to use Maple more than this one exercise, I suggest investing time to learn about the basics. I believe there is a good Users manual that comes with Maple 18. You can find it under Help. And there are lots of videos at Maplesoft. A good "give me the basics" book I can recommend is "Getting Started with Maple" by Meade, et.al. 

 

 

4 5 6 7 8 9 10 Last Page 6 of 15