Scot Gould

Scot Gould

747 Reputation

14 Badges

11 years, 174 days
Claremont McKenna, Pitzer, Scripps College
Professor of Physics
Upland, California, United States
Dr. Scot Gould is a professor of physics in the W.M. Keck Science Department of Claremont McKenna, Pitzer, and 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 using scanning probe microscopes, particularly those involving natural fibers such as spider silk. More recently, he was involved in developing and sustaining AISS. This full-year multi-unit, non-traditional, interdisciplinary undergraduate science education course 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 Maple's computer algebraic and numerical systems to assist students in modeling and visualizing physical and biological systems. His Dirac-notation-based quantum mechanics course is taught solely through Maple.

MaplePrimes Activity


These are replies submitted by Scot Gould

@Carl Love Given the number of topics covered, it is not surprising that my view has been lost in the process.

1) First and foremost, I am a physicist with lots of CS exposure, not a CS researcher/educator. I use, and we teach, top down thinking in physics. (It is also how I approach all research questions.) All applications of physics must be based upon physical principles. Start with the principle and then add a level of details and keep adding details until you have reached the bottom. 

2) And thus, I truly appreciate Maple’s ability to allow me to model through the top-down approach. It is my experience that once the undergraduates reach an understanding, and mode of thinking, using Maple's capabilities, they learn physics more quickly and have a richer understanding of the principles.  As a consequence, when we must move to Python and/or MATLAB, the undergraduates often become frustrated with Python's and MATLAB's bottom-up approach and the one-level evaluation limitations. Yes, it is true they could load some symbolic libraries, but, compared to working with Maple, the usage process ain't pretty.  Many undergraduates return from REUs (research-experience-for-undergraduate programs) telling me how they don't understand why their research group battles with MATLAB when the problem is more easily solved in Maple. 

3) However, since this full level evaluation does not occur in procedure, the pedagogical advantage of Maple is lost when problem solving within procedures. I understand why this is the policy – improved efficiency. And fortunately, now that I know this property of the Maple system,  before I return any of my work using a top-down approach, which is yes, less efficient, I need fully evaluate. It is not a hardship, but I wish I had been aware of this difference years ago because in the vast majority of my work with Maple, I’m expecting, and usually receiving, full evaluation with every statement. Knowing the one-level evaluation would have saved many moments of misunderstanding the reason for the outcome of my procedures. That is on me. And now I know.

4) You wrote, "I think that you've misconstrued the comment about other programming languages. In a language without symbolic variables, it's impossible for there to be any distinction between full and one-level evaluation."  What I meant was, my complaint about the lack of full evaluation capabilities in procedures is unwarranted given that virtually every other language I have used, assembly, FORTRAN (66, 77, 90), Pascal, BASIC, C, C++, Python, MATLAB (I'm sure I'm missing some), possesses only one-level evaluation.  However, it is possible to use a one-level evaluation programming language to construct a full level evaluation language which only produces numerical outcomes.  

I hope this lengthy reply provides you with some contextual understanding about a person whose experiences and approaches mimic a larger percentage of North America’s physical scientists and educators.  I certainly would not have made the effort if I didn’t value your knowledge, experience and efforts to help others here on MaplePrimes

 

@Carl Love If the original function includes the positive square root, then x=-3 is not a root since eq4a(-3) = 2. Yes?  Since he said there are 2 roots and he included line 1.4, I took it that he meant there originally was a square and he had square rooted it to begin his quest for 2 roots. 

@Carl Love  Happy to provide an example.

The following is an example of the approach for nearly every physics problem, from first semester classical mechanics to grad school quantum mechanics:  Atwood’s machine  (not my favorite, but you probably know it).  A diagram can be found here

Two masses attached by a string for which the string is hooked over a pully. One mass is greater than the other. Hence the question is – what is the acceleration of the system?

Pedagogical approach – always start with a first principle, in this case the momentum principle -  that the acceleration of a body is due to the net force on the body divide by the mass of the body.  Next, we note the net force on the body is due to the sum of the forces on it.

Now we apply the principle to each of the two bodies. The net force on each is the combination of the tension of the rope, the other by the gravitational pull of the Earth, i.e., weight.  The weight is a combination of the body’s mass times the near Earth gravitational constant, g.  With this system, we note there are two constraints – the tension in the rope is assume to be the same on both bodies (not true, close enough for this example), and that as one accelerates up, the other accelerates down with the same magnitude.

Solve symbolically.

Evaluate the symbolic result and ask oneself – do the extreme points makes sense (say m2 = 0, etc.)

Then, if provided, evaluate with specific values.
 

restart; peq1 := a1 = F1/m1; peq2 := a2 = F2/m2; F1 := T1-W1; W1 := m1*g; F2 := T2-W2; W2 := m2*g; peq1; peq2

a1 = (-g*m1+T1)/m1

 

a2 = (-g*m2+T2)/m2

(1)

constrainteq1 := abs(T1) = abs(T2); constrainteq2 := a1 = -a2

sol := `assuming`([solve({peq1, peq2, constrainteq1, constrainteq2}, {T1, T2, a1, a2})], [positive])

{T1 = 2*g*m1*m2/(m1+m2), T2 = 2*g*m1*m2/(m1+m2), a1 = -g*(m1-m2)/(m1+m2), a2 = g*(m1-m2)/(m1+m2)}

(2)

eval(sol, {g = 9.8, m1 = 1.1, m2 = 1.2})

{T1 = 11.24869565, T2 = 11.24869565, a1 = .4260869565, a2 = -.4260869565}

(3)


 

Download topdown.mw

As I said – this is the most common approach in thinking about working with a physical system, that it is an example of set of applied physical principles, and what I define as a top-down approach. (Bottom up would be to define all the variables first, then calculate the weight, the tension, the net force, and finally the momentum principle equations.)

 

Now – you do raise a point I recognize – the power of the symbolic approach. However, could not one devise a system, for which space is allocated, but all evaluation is performed numerically at the last step? And if I do misunderstand the statement in Maple, can you provide an example of a language they are referring to?

 

 

@acer Much appreciated with the numerous suggested references. Your comment has motivated me stop being so lazy and  get serious about reading and working with the programming manual beyond the first couple chapters. (I was looking in section 1.4 under evaluation.)  For example, now I truly understand the value of the left apostrophe (`) vs. the right apostrophe (‘).

 

@Carl Love Sadly, my question formulation skillset for Maple has not matched the Help structure. Often I end up with what appear to be random suggestions for pages to look through. (Currently I have 7 help pages open from the web.) 

However, in reading the programming manual and help pages that  @acer provided, I came across a great nugget: the one level evaluation within procedures is how other programming languages work. Of course - this is why after spending time with Maple at the main/global level,  I (and students) find MATLAB and Python quite frustrating. (And hence my frustration as begin to write more complex procedures in Maple.)

IMO, Maple is a wonderful educational tool in the physical sciences, because at the main/global level with its default full evaluation property, it emulates the  top-down thinking process one uses in the physical sciences: principle first, then general properties of example, followed by specificity of the general properties.  

@Carl Love You are correct on the info - one level down at the procedural level. This type of info I assumed was somewhere in the Maple help. However, I thought it would be in the programming manual, but I was unable to find it. (Have you memorized all of Help?) 

I built a procedure which required 6 levels of evaluation necessary, (or so I believe). I timed it with random numbers, and you are correct, there is a bit of an efficiency hit. But it isn't significant - 10%?.  How often does one needs to reach 6 levels down? 

eval_procedures.mw

The process which produced a far greater improvement in performance was to write the code bottom up, rather than top down. I.e., define a before using it with b, rather than define b, then a, and then evaluating b. 

I appreciate any suggestions and corrections. 

@acer  "Why you would expect 20 for the second example's return value?"   Actually, I expected an error, and not what I saw. Why?

In the example below, when I ask for "c", the full expression is evaluated.  But just because "a" and "b" are in the procedure, "b" is not returned evaluated unless I ask for it to be. Is there some sort of advantage to what appears to be an inconsistancy?  


 

restart

c := d+10; d := 20; c

30

(1)

f := proc () local a, b; b := a+10; a := 20; return b, eval(b) end proc

f()

a+10, 30

(2)

 

Radaar's example:

 

a := 10; f2 := proc () b := a+10; a := b; return b, eval(b) end proc

Warning, `b` is implicitly declared local to procedure `f2`

 

Warning, `a` is implicitly declared local to procedure `f2`

 

f2()

Error, (in f2) too many levels of recursion

 

``


 

Download expect.mw

 

 

 

@acer Thank you. Went through the list of "what's new" items for Maple 2020, since I had never seen this issue crop up until this release. Nothing was there.  Apparently I wasn't smart enough to view other options. Frankly, because some information that I wanted was missing in my smartview altered plots, I didn't find smartview particularly helpful. It does a nice job for plots from 0 to infinity. 

Given that symptoms do not appear until 4-5 days after a person has been infected with the virus, SARS-CoV-2, and during that time, the person is contagious, and given that the average period between symptoms appearing and death is about two weeks, it may be several weeks before the death rate returns to its exponentially increasing behavior. And by that time, a significant greater percentage of the population will have been exposed. 

So, what is the cap? Based on the data provided by NY, by April 23, 14% of New Yorkers had been exposed to the virus, and approximately 0.1% of all New Yorkers had died from COVID-19 – both confirmed and probable. My math suggests 0.8-1.2% of all humans could die from the disease. That is until a vaccine is created and disseminated.

My interpretation of the original meaning of the term "flattening the curve" is not of total cases, but of new cases. The concern was that without a change of behavior, the number of new cases, thus deaths, would be a curve with a large positive exponential constant, which is essentially based on the R0 value. This would overwhelm the healthcare system, like it did in some countries and locations in NY state. Rather, by reducing the R0 value, new cases would peak later, and and the graph would be flatter, but longer. I suspect you are correct folks are now interpreting "flattening the curve" as the total number of cases. In the US, that is not happening. I borrowed this simple graph from a 6 week old presentation by Michael Lin at Stanford. https://kottke.org/20/03/excellent-presentation-on-the-latest-covid-19-research-hygiene-tips-and-treatment-options

P.S. Thanks for posting the data. I was modeling it up to 10,000 US deaths and it was frightening then. At that point, the graph was increasing by an order of magnitude every week. The US was about 1 week away from 100,000. But social distancing made a significant impact.  Note, the CDC redifined the number of dead to include not just those confirmed using the virus test, but those who probably died from COVID-19. All death counts increased significantly that day.

@acer You were correct. Maple was being too efficient. After randomizing the limits during each call, the times were more understandable: evalf(Int(..)) was the quickest, int( ) with floating point limits and using integer limits and the numeric option, which I really like, required a bit more time : 7..12%. And even then I'm wondering if some of that is due to memorization.   

@Kitonum Your response caused me  to be curious about what is under the hood of Maple.

I was unaware of the "numeric" option in the int command. I had always assumed that the only way to calculate numerically is through evalf(Int()). This lead to the question - in terms of calculation speed, does the format of the call matter? Based on calculating this function 10,000 times, Maple 2020 showed:

* evalf(Int()) is the fastest
* int(f(x), x=1.0..100.0) requires twice as much time as evalf(Int())
* int(f(x), x=1..100, numeric) requires 3 times as much time as evalf(Int())

Since all 3 complete one integration essentially instantaneiously, it really doesn't matter here, but if speed is essential, are these results constant with the design of Maple? Is there an alternative form that is superior?

@acer Thank you for the explanation of name quotes. I followed up with looking through Chapter 2 of the online Programming Guide.  I appreciate your patience with my ignorance and perception.

@Carl Love 

1. New to me, obviously. I'm glad I did not pull my question once I realized the multiple-dimensions possibility.

2. ifelse fits the bill. I understand the left-quote is used to demarcate names and won't be going away. 

First 15 16 17 18 19 20 21 Page 17 of 23