Scot Gould

Scot Gould

512 Reputation

14 Badges

10 years, 45 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 answers submitted by Scot Gould

I prefer to use the elementwise operator ~. I find it more readable than using map.

outList := lhs~(eq1)

 

My guess is that the variable x has been assigned a value of 1.71. So, use a different variable in your plot

  plot(f(x1), x1 = -0.667 .. 1.71, -5..20, gridlines)

No need to label the vertical axis because it really isn't the variable in the vertical direction. 

The magenta error of death tells us the equation in fsolve is being evaluated before it is ever used. Put a single quote around the equation in fsolve and it will work.

h := y -> fsolve( ' f(x__0) = y', x__0 = Range)

I can empathize. Students in my class last week struggled with the same issue.  

For them, it was applying the slope (Euler's) numerical method to solve an ordinary

differential equation. If the endpoints were exact, such as 0 and 2, the looping took

forever. However, if the endpoints were floating point approximations such as 0.0

and/or 2.0, the calculations were instantaneous.

Because of these struggles, it has become ingrained in their head they must enter

constants in numerical calculations as floating-point numbers. And maybe that is

the best one can hope for since I agree with others, there probably is no way to

force Maple to see all numbers as approximations.

Regarding integrals, there is no need to memorize evalf or the option numeric.

Simply set the endpoints to floating point numbers, and Maple will generate a

floating point outcome. For example:

 

Exact integral:

int(exp(-x^2), x = 0 .. infinity)

(1/2)*Pi^(1/2)

(1)

 

Using the floating-point approximation.

int(exp(-x^2), x = 0. .. infinity)

.8862269255

(2)

   ``

Download Forcing_floating_point_approximations.mw

It is my experience that full-precision equations usually lead to full-precision answers, if possible.  If you prefer a "floating point approximation", change one of the numbers from a whole number in your equation to a floating point value. For example, 4 to 4. or 4.0.  Maple will report a floating point result. 

If you don't obtain a floating point result after making the modification, as suggested, take the result and evaluate it to a floating point value using the evalf procedure. 

It is late, so the experts probably are asleep. Here is a quick reply.

 

As I read what you uploaded, the PDE is not a PDE but a 2nd order ODE with a parameter k in the initial conditions.

 

restart; interface(imaginaryunit = 'I')

Rewriting the PDE as an ODE for which the variable u is a function of time:

ode := (10*I)*(diff(u(t), t))+diff(u(t), t, t)-16*u(t) = 0

And setting the initial conditions at t = 0

ices := u(0) = sqrt((1/2)*Pi)*csch((1/2)*Pi*k), (D(u))(0) = -(1/4)*sqrt(2)*Pi^(3/2)*csch((1/2)*Pi*k)*coth((1/2)*Pi*k)

Solve numerically, but let k be a floating parameter one can adjust on the fly:

 

sols := dsolve({ices, ode}, numeric, output = listprocedure, parameters = [k])

Extracting out the variables:

u := eval(u(t), sols); u_dot := eval(diff(u(t), t), sols)

 

Since k can be anything but appears to be somewhere between 0 and 100, make a plotting procedure that plots the magnitude of u and the u-dot for "t = 0 to 1." (Both variables are complex, so adjust to suit your interest.)

 

"PlotVariables := proc(k::float)        global sols, u, u_dot;         sols(parameters = [k]);         plot([|u(t)|, |u_dot(t)|], t= 0..1, legend = ['u', '(u)']);     end proc:  "

Now explore:

Explore(PlotVariables(k), parameters = [k = 0 .. 100.0], initialvalues = [k = 50.0])

Play with the slider and satisfy the other conditions.

 


 

Download ODE_or_PDE_solution.mw

Try this help page to load the suggested commands:

https://www.maplesoft.com/support/help/maple/view.aspx?path=worksheet%2Freference%2Finitialization

See if the procedure error() works for you.

@zenterix For fun, I was playing around with the plots package.  It almost mimics your first plot.  However, to see it properly, download it. 

restart; with(plots); symbolsize := 12

display(pointplot([seq(`<,>`(x, x-1), x = -1 .. 5)], 'symbolsize' = symbolsize, symbol = circle, color = blue), plot(floor(x), x = -2 .. 5, color = blue, thickness = 4), pointplot([seq(`<,>`(x, x), x = -2 .. 4)], 'symbolsize' = symbolsize, symbol = solidcircle, color = blue), scaling = constrained, tickmarks = [8, 0], view = [-3 .. 6.5, -3 .. 5], arrow(`<,>`(-3, 0), `<,>`(9.5, 0), color = green, width = 1/100, head_width = 1/8, head_length = 1/7), arrow(`<,>`(0, -3), `<,>`(0, 8), color = green, width = 1/100, head_width = 1/8, head_length = 1/7), labels = [" ", " "], textplot([5.4, 4, "g", font = ["times", 20]], color = blue), size = [600, 600])

 

``

NULL

Download Plot_Floor.mw

Under Tools->Options (or Preferences on the Mac), at the bottom of the first page of the popup box is where you can control how often Maple saves a backup copy and if it keeps every copy of a backup file. I believe it the default is 3 minutes, but you can set it to any value. In addition, Maple  keeps every copy of the backup file. Personally, I turn off the "Keep files" so that the folder isn't filled with backup copies I don't need to use. If you safely close the file, it deletes the backup copy. But if you don't, the backup copy is still there. That makes it much easier to find the backup file of needed. 

However, when one uses File -> Restore Backup, one can ask to display the details of the files which allows you to sort by when the file was created. 

IMO, the system is much improved over the previous backup system. 

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

1 2 3 4 Page 1 of 4