Scot Gould

Scot Gould

537 Reputation

14 Badges

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

Since I don't know what this looks like, let's make a collection of space curve.


Copy your text data:


restart; xData := [0., 0.4995839572e-1*sin(x), 0.9966865249e-1*sin(x), .1488899476*sin(x), .1973955598*sin(x), .2449786631*sin(x), .2914567945*sin(x), .3366748194*sin(x), .3805063771*sin(x), .4228539261*sin(x), .4636476090*sin(x), .5028432109*sin(x), .5404195003*sin(x), .5763752206*sin(x), .6107259644*sin(x), .6435011088*sin(x), .6747409422*sin(x), .7044940642*sin(x), .7328151018*sin(x), .7597627549*sin(x), .7853981634*sin(x)]

Match with t with the same number of point.

tData := [seq(0.5e-1*n, n = 0 .. upperbound(xData)-1)]


Create a function (using the older version of the MakeFunction procedure) from the data:


xtPoint := unapply([x, xData[n], tData[n]], x, n)

And from each point, make a spaaaaace curve.


xtLine := unapply([seq(xtPoint(x, n), n = 1 .. upperbound(tData))], x)


Next, a generic plot of a collection of space curves


plots:-spacecurve(xtLine(x), x = -Pi .. Pi, size = [500, 500], color = "xkcd:blue", thickness = 3, labels = ["x", "xData", "tData"], labelfont = ["Times New Roman", 15], orientation = [84, 21, 160])


Low-budget version of 3D surface data.


Creating a sequence of points without the option numpoints in the sequence function.

From it, we make "Let's go surfing now; everybody is learning how" data.

N := 100; x0 := -Pi; xf := Pi; dX := (xf-x0)/(N-1); surfData := [seq(xtLine(dX*n+x0, round(n*upperbound(xData)/N+1)), n = 0 .. N-1)]

And plot


plots:-surfdata(surfData, labels = ["x", "xData", "tData"], labelfont = ["Times New Roman", 15], orientation = [84, 21, 160], size = [500, 500])


Note bug in 3D plot. Need to report.




Of course, if you don't understand how to use the palettes, that is a different issue. 

Write out A^T as B and each component of the matrix.


restart; B := Matrix(2, 2, {(1, 1) = a__11, (1, 2) = a__21, (2, 1) = a__12, (2, 2) = a__22}); I2x2 := Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1}); equation1 := 4/(B+2*I2x2) = (Matrix(2, 2, {(1, 1) = 1, (1, 2) = 1, (2, 1) = -3/2, (2, 2) = 1/2}))

Matrix(2, 2, {(1, 1) = a__11, (1, 2) = a__21, (2, 1) = a__12, (2, 2) = a__22})


Matrix(2, 2, {(1, 1) = 1, (1, 2) = 0, (2, 1) = 0, (2, 2) = 1})


Matrix(%id = 36893490656581279980) = Matrix(%id = 36893490656581280100)



Solve for each component.


answer := solve(equation1, {a__11, a__12, a__21, a__22})

{a__11 = -1, a__12 = 3, a__21 = -2, a__22 = 0}



Assign each component the value in answer and then write out A


assign(answer); A := Matrix(2, 2, {(1, 1) = a__11, (1, 2) = a__12, (2, 1) = a__21, (2, 2) = a__22})

Matrix(%id = 36893490656581256964)




Windows: From the menu bar, select Tools followed by Options

Mac: Select Preferences from the menu bar. 

On the first tab, at the bottom of the display, search for auto save every X minutes. Personally, I turn off keep files. I want to keep only those files for which Maple was shut down mid-calculation.  


Check out shortcuts in help. Ctrl-d might work since it deletes all output.

Export has a problem in Windows that is corrected by choosing to print to a PDF. Not as convenient, but it fixes the problem. I suggest you try that.

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)




Using the floating-point approximation.

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





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.




Try this help page to load the suggested commands:

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])





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. 

1 2 3 4 Page 1 of 4