Scot Gould

Prof. Scot Gould

452 Reputation

13 Badges

9 years, 114 days
Claremont, 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 answers submitted by Scot Gould

Or, you can have fun with palettes and write out something that  non-Maple-coders can read:

NULL

"f(x,y) := {[[1,x = 0 and y=0],[(x^(2)+y^(2))^(x),otherwise]]: "

NULL

NULL

eval(`<,>`(diff(f(x, y), x), diff(f(x, y), y)), {x = 1, y = 1})

Vector[column](%id = 36893489998615880996)

(1)

NULL

Download Partial_Diff_with_Palettes.mw

A search of shortcut keys shows no way to create a matrix. This is probably  understandable given the complexity of a matrix.  Also, I suspect there really isn't to much interest in one.  For me, when I want to explain how to create a Matrix without using the palette to new users, I mimic the matrix in the call of the Matrix function:

 

M := Matrix([[1, 2, 3], [0, a, b], [3, 2, 1]])

Matrix(%id = 36893490805376578132)

(1)

 

But later I offer the vectors in columns approach:

 

M := `<|>`(`<,>`(1, 0, 3), `<,>`(2, a, 2), `<,>`(3, b, 1))

Matrix(%id = 36893490805376567764)

(2)

 

At this point, it is a matter of personal preference.

Download Matrix_entry.mw

IMO, using a keyboard shortcut is easy and quick for creating a vector sign above a variable name.
See help on "keyboard shortcuts".

 

Overscript:

Window: <ctrl>  + <shift> + < " >  

Mac:       <command> + <shift>+ <">

 

type varaible, then the keyboard shortcut combination, then add "-" ">" to create a vector:

 

   `#mover(mi("v"),mo("&rarr;"))`

 

It is very handy for writing non-executable mathematical statements in documents. For example:

 

    "&conint; B * d`&ell;`  = &int;((&nabla;) * B ) * dA  = `mu__0` `I__enclosed`  = `mu__0` &int;J * dA "

 

And note, the vector `#mover(mi("v"),mo("&rarr;"))` does not equal the non-vector v.

 

is(`#mover(mi("v"),mo("&rarr;"))` = v)

false

(1)

which means you can define a vector with the same name variable:

`#mover(mi("v"),mo("&rarr;"))` := `<,>`(v, 0, 0); `<,>`(1, 0, 0).`#mover(mi("v"),mo("&rarr;"))`

v

(2)

 

From a readability standpoint, I find the vector sign more informative than making the variable bold because
I cannot always tell if a variable is bolded or not.

 

Download Creating_variables_with_vector_signs.mw

Uninstall and reinstall to version 2021.1  Just a suggestion if possible.

One can control the number format given that the default is 3 values after the decimal, but it appears that changing the Digits does nothing. I have attempted to reproduce Figure 3.7 at the bottom of page 11. 

Regardless, I would hope the next version allows for one to change the interface

If you have several lines of code, you can insert a code-edit-region into your worksheet with the icon to the left of the "T" icon in the icon toolbar. Then, copy and paste the 2d-Math into the code-edit-region.  When you hit enter, it executes.

I was not able to reproduce this error.

However, to work with complex numbers in MapleFlow, the expression is 1+2i, not 1+2*i. (Also, 1+2I is viewed as 1+2i). If one types 1+2*i, MapleFlow interprets the letter "i" as a variable. 

What I don't understand is given that the letter "I" is defined as sqrt(-1) in Maple, why the expression (1+2*I) in MapleFlow is not interpreted as a complex number. Instead, "I" is interpreted as a variable. 

(And I don't understand why my pasted response can't be unbolded.) 
 

Carl Love is spot on with his response. And I appreciate the fact he listed a help page for more reference.

 

I'm adding my comments because I sense you are a new user.  Even as an experienced user of Maple, I found learning about DataFrames as, well, not always intuitive. However, now I find DataFrames are wonderful. They are far more useful and powerful than trying to work with spreadsheets. (Alternatively, you can work with R, yet another programming language.)

 

The reason I suspect you are a new user is because you are using 2d Input with the Document mode, Hence I have some suggestions, which you are welcome to ignore.

 

* Until you become an expert, I encourage you to switch to "Worksheet" mode. Go to "Tools" -> "Option", select "Interface" tab and choose "Worksheet" option under "Default format for new worksheets".  

 

"Document" mode is great for writing... documents. They were was heavily used at the recent Maple Conference of 2021:

        https://www.maplesoft.com/mapleconference/2021/agenda.aspx  

And, in the new journal "Maple Transactions":  https://mapletransactions.org/index.php/maple.   

 

But for general use, most new users I work with usually find worksheet mode useful in organizing their ...work.

 

* Maplesoft has a useful guide to DataFrames. See:

      https://www.maplesoft.com/support/help/Maple/view.aspx?path=DataFrame%2fGuide

 

* Two possibly useful examples of working with DataFrames can be found at these postings:

  - https://www.mapleprimes.com/posts/209845-Dataframes--Looking-For-A-New-Flashlight

  - https://www.mapleprimes.com/posts/213367-Timely-DataFrames-Example-2020-US-Presidential

 

 With regards to your problem,

1) may I suggest you reduce some of your work by "Import"ing directly from the CSV file from the website (rather than downloading it first to a separate file.)

 

restart; with(Statistics); rawdata := Import("https://health-infobase.canada.ca/src/data/covidLive/covid19-download.csv")

 

2) In terms of the question you ask, as an alternative to Carl Love's answer,  you may want to refer to the select/remove question in Maplesoft's "A Guide to Data Frames".  https://www.maplesoft.com/support/help/Maple/view.aspx?path=DataFrame%2fGuide#SelectRemoveValues

 

In this example, you want to "select" all data for which the value in the prname column of rawdata for is equivalent to name = "Ontario". Hence you want to evaluate (as a boolean) if the name in the column is "Ontario".

 

ont_data := select(proc (name) options operator, arrow; evalb(name = "Ontario") end proc, rawdata, prname)

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module

(1)

NULL

Download DataFrames_Select.mw

I won't solve your problem, but I get you started with the Maple problem - Explore command. You are missing the "parameters" parameter. (I also suggest adding the "initialvalues" parameter.")  The trough appears correctly for only certain values, so you might want to check the equations. (I added a bogus area function.) If you don't like the area in the caption, it could be put into the title. Trough.mw

Excuse the jpeg, but Mapleprimes will not display the 2021.1 code. 

 

Download simplify_example.mw

 

The protocal is to have Maple solve for y(t) and diff(y(t), t) and use the definition of diff(y(t), t, t) to plot both it and higher order derivatives. Kitonum's answer is the most efficient, but this one allows the reader to see how high order derivatives are generated.

(Note: I wrote this in Document mode with 2021 to try it out.)NULL

 

restart; plots:-setoptions(size = [500, 300], thickness = 2)

 

The second derivative of y(t) with respect to t is defined as:

"y2dot(t):=-y(t)*|y(t)|:"

 

Create the system:

ode := diff(y(t), t, t) = y2dot(t)
conditions := y(0) = 1, (D(y))(0) = 0

diff(diff(y(t), t), t) = -y(t)*abs(y(t))

(1)

 

I prefer to have Maple generate the procedures for each variables because it makes subsequent use of the "functions" more readable (and requires fewer commands to memorize)

solutions := dsolve({ode, conditions}, numeric, output = listprocedure)

 

Extract the functions from the solutions variable

y := eval(y(t), solutions); ydot := eval(diff(y(t), t), solutions)

 

plot([y(t), ydot(t), y2dot(t)], t = 0 .. 10, legend = ['y(t)', 'diff(y(t), t)', 'diff(y(t), t, t)'])

 

 

Calculate all higher derivatives which are defined in terms of lower derivatives. For example:

Y3dot := simplify(diff(y2dot(t), t)); Y4dot := simplify(diff(Y3dot, t))

(-abs(1, y(t))*y(t)-abs(y(t)))*(diff(diff(y(t), t), t))-(diff(y(t), t))^2*(y(t)*signum(1, y(t))+2*abs(1, y(t)))

(2)

NULL

 

Thus the higher order derivative functions are defined as:

"y3dot(t) :=-ydot(t)*(abs(1,y(t))*y(t)+|y(t)|):    y4dot(t):=(-abs(1,y(t)) y(t)-|y(t)|)*(y2dot(t))                            -(ydot(t))^2 *(y(t)* signum(1,y(t))+2*abs(1,y(t))):"

 

plot([y(t), y3dot(t), y4dot(t)], t = 0 .. 10, legend = ['y(t)', 'diff(y(t), t, t, t)', 'diff(y(t), t, t, t, t)'])

 

NULL


 

Download Plotting_higher_derivatives_numerically.mw

I think if the conditions are satisfied, it is solvable. I rewrote the integral in the form of constants. 

print(G) is probably the simpliest to show all the values within G. 

@tomleslie's was spot on. May I suggest an slight modification when you use dsolve - use the "output = listprocedure". Then you can extract out the procedure for x(t) and use it like a function. 

For fun, I tried out your toy problem. In the end, I agree with Tom - I don't see the difference and neither does Maple. I used pdsolve, not dsolve. 
 

restart

 

Write out differential equation and boundary value conditions

eq := diff(u(x), x, x) = u(x); bvc := u(0) = 2, u(1) = 1

sol := pdsolve({bvc, eq})

u(x) = (-2*exp(2*x-1)+2*exp(1)+exp(2*x)-1)*exp(-x+1)/(exp(2)-1)

(1)

u__sol := eval(u(x), sol); d2u__sol := simplify(diff(u__sol, x, x))

(-2*exp(2*x-1)+2*exp(1)+exp(2*x)-1)*exp(-x+1)/(exp(2)-1)

 

(-2*exp(2*x-1)+2*exp(1)+exp(2*x)-1)*exp(-x+1)/(exp(2)-1)

(2)

is(u__sol = d2u__sol)

true

(3)

plot(u__sol, x = 0 .. 1, 0 .. 3)

 

``


 

Download pdsolve.mw

1 2 3 Page 1 of 3