Scot Gould

Scot Gould

732 Reputation

14 Badges

11 years, 150 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

Thanks for adding the ability to call dsove, numerically, with vectorized functions. Between that, and the improvements in the document mode, I see a significant paradigm shift in how I as a college instructor can use Maple as both document of readable "code" and a way for students to code with a minimal amount of teaching code.  

I quickly coded up a example of being able to write vectors differential equations using "dot notation", solve them numerically, and Explore the output using the parameterized option in dsolve, numeric.  Much of it takes advantage of the fact that: 

           Maple math = real math.

Here is a quick screen shot of some of this "coding while writing" 

This additions continue to move improve an impressive product. 

 


Example_vectorized_dsolve_numeric_problem.mw

@Christopher Tocci 

Yep, I missed it. I suspected it was "too good to be true."

Given that it looks like there is only a numerical solution, here is an alternative numerical approach that you might find useful - Explore. I guessed on some ranges. (S = separation, d = diameter..)  

@mmcdara 

I’m with you. I found the use of “ pf := ‘pf’ ” and the statement, “pf is your table” to be confusing. However, your questions and discussions were highly illuminating. The outcome in my mind is that “pf” is re-assigned as a symbol (in case it had already been assigned or later assigned), which is then interpreted by Maple as a table once indexing occurs.

For a 10 item element, I assume the speed of accessing a table vs. a Array or Vector must be negligable, but becomes significant when the size is large.  Hence, I would still think Vector first, though tables are handy. 

@Kitonum 

Is there any advantage or disadvantage to using the "output = listprocedure" option?

For me, it is cleaner because one doesn't need to worry about premature evaluation in calculations: 

@nm I like your use of the term Explore. My version isn't better, but simply adds some features that, until recently, I wasn't aware of and have found useful - particuarly the loop and autorun options.  (Mine is also not as clean as yours, but it demonstrates the difference between integer and real scales.)


Download Explore_function.mw

The process is identical for Windows as an alternative path of creating a PDF. 

@Carl Love Since the task is to write function A(n) where n will be specified, hence the number of terms will be specified before the integral is performed, isn't mul (like add) more appropriate than product?  Hence, I don't see the advantage. 

That said, just like in the case where sum works, which is more readable than add, it is nice that product does work for a definite set of terms. 


 

This calculation calls product

"restart;     A(n):=(∫)[0]^(infinity)(∏)(h(x/(2*m+1))) ⅆx :  h(x):=(sin(x))/(x):     time(seq(A(n), n=0..8));  "

13.515

(1)

"restart;  A(n) := (∫)[0]^(infinity)mul(h(x/(2*m+1)), m=0..n) ⅆx :  h(x) := (sin(x))/(x):    time( seq(A(n), n=0..8) );"

13.359

(2)

restart; h := proc (x) options operator, arrow; sin(x)/x end proc; J := Int(product(h(x/(2*a+1)), a = 0 .. n), x = 0 .. infinity); time(seq(value(eval(J, n = nn)), nn = 0 .. 8))

13.640

(3)

"restart;  f(n) := (∏)(h(x/(2*m+1))):  h(x):=(sin(x))/(x):  time(seq( f(n), n=0..500));"

10.484

(4)

"restart;  f(n) := mul(h(x/(2*m+1)), m = 0..n):  h(x):=(sin(x))/(x):  time(seq( f(n), n=0..500));"

4.171

(5)

``


 

Download Product_vs_Mul.mw

@mmcdara With a smile on my face, I'll say that from a physicist's stand point, the normal distrbution is the most natural. It allows me to control the width of the distribution curve as well as where it peaks. However, I admit I'm not as familiar with the binomial distribution much beyond counting coin flips or win-losses in sports. Would you be willing to recommend code that would substitute for win_prob as a function of the three variables?

@graleo Mathematica?

@graleo  Are you sure about the equations? If one define qeq as 1.001*P and not 1.001*P^(1/8.758), the solutions can be plotted. 

@Carl Love If the row labels are positive integers, but are clearly not the index numbers, sorting by RowLabels works perfectly.  I wanted to post this "caution" to complete this discussion. 

@Carl Love , @Joe Riel .  Thanks again for your help with the sort within a sort of DataFrames problems I possed. Back in August. In writing up an example, I came across an unexpected outcome, which caused me to question. The 'key' that Carl suggested works, however, if the row labels don't quite match the row number, Maple will get confused in the sort.  Consequenty, sorting by RowLabels does work most of the time, but not aways, but it appears sorting the row numbers always works. 
 

restart; interface(rtablesize = [5, 6]); poll_data := Import("https://www.electoral-vote.com/evp2020/Pres/pres_polls.csv")

_m2111003542336

(1)

First line is a the headers, so it is removed. poll_data is redefined starting at line 2.

poll_data := poll_data[2 .. (), () .. ()]

_m2110993532416

(2)

Sort by row labels fails. In this example, the primary value is the negative of value in the first column (a type of descending sort), and the secondary value is from column 3 (by state names).

poll_data[sort(RowLabels(poll_data), 'key' = (proc (n) options operator, arrow; [-poll_data[n, 1], poll_data[n, 3]] end proc)), () .. ()]

_m2111031661216

(3)

Sort by row numbers works.

poll_data[sort([seq(1 .. upperbound(poll_data, 1))], 'key' = (proc (n) options operator, arrow; [-poll_data[n, 1], poll_data[n, 3]] end proc)), () .. ()]

_m2111033833344

(4)


poll_data rows are re-labeled starting from 1. Now sorting by row labels works.

poll_data := DataFrame(poll_data, 'rows' = [seq(1 .. upperbound(poll_data, 1))]); poll_data[sort(RowLabels(poll_data), 'key' = (proc (n) options operator, arrow; [-poll_data[n, 1], poll_data[n, 3]] end proc)), () .. ()]

_m2111100827264

(5)

``


 

Download Large_data_double_sort_by_row_label_-_row_number.mw

@graleo   It appears this is the first time you have posted to MaplePrimes.  There are folks here who are happy to help.

Use the green "up arrow" to upload your worksheet. It is likely the problem is found in the definition of the "sys2" variable. 

@acer An unexpected discovery. I am pleased to report that so far, in working with new Maple users, this unexpected behavior has not arisen. I suspect that is because the use of the arrow definition is not taught. However, it is important for the more experienced user to know when teaching Maple.

@Lenny Here is an example of using the prime notation within the 2D Maple input.  I used the variable y instead of f to make it more readable, but it works with f
 

ode := diff(y(x), x, x, x)+a*(diff(y(x), x, x)) = b

diff(diff(diff(y(x), x), x), x)+a*(diff(diff(y(x), x), x)) = b

(1)

 

cond_eqns := ((D@@2)(y))(w) = 0, (D(y))(w) = 0, y(w) = c

((D@@2)(y))(w) = 0, (D(y))(w) = 0, y(w) = c

(2)

 

sols := dsolve({ode, cond_eqns}, y(x))

y(x) = (1/2)*b*x^2/a-b*exp(-a*x)/(a^3*exp(-a*w))-b*(a*w+1)*x/a^2+(1/2)*(a^2*b*w^2+2*a^3*c+2*a*b*w+2*b)/a^3

(3)


 

Download ODE_example.mw

First 10 11 12 13 14 15 16 Last Page 12 of 23