Scot Gould

## 517 Reputation

10 years, 160 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.

## Alternative approach: prime notation...

`f''(w) = 0`

For a first derivative condition:

`f'(w) = diff_f_at_w_expression`

## It depends.....

Whether I use an indexed variable vs. an atomic one depends upon the problem I am trying to solve and how I wish to solve it. For example, if I have wish to write or refer to elements in a sequence, list or vector, being able to use indexed variables is quite valuable in readability and worksheet real estate. E.g. seq(a[n]*x^n, n=0..3). Such choices are made when I am writing code, which I perform nearly always within a Code Edit Region.

However, if I am writing mathematical equations that I want non-Maple users to be able to read, particularly if including a subscript is informative, then I use an “atomic variable”. For writing mathematical equations and functions I use 2D-input because it makes the equations more readable and reduces the content on a page. The output of a 2D-input is repetative.

I agree with Carl Love, the atomic variable leads to fewer problems, particularly with new users, which, clearly, you are not. Many of the students in my courses prefer the image of the subscript provided within 2D input, such as F__x or F__Earth. However, when constructing such variables, too often they end up with the equivalent of F[x], only to discover that should they assign a value to x, their worksheet starts producing unexpected outcomes. Thus, I encourage them to avoid subscripts until they are more familiar with Maple.

There is a post on the evaluation of subscripts in Maple by Robert Lopez that might be of interest to readers: https://www.mapleprimes.com/maplesoftblog/208838-The-Saga-Of-The-Subscript

Personally, I enjoy atomic variables. They truly do make Maple input more readable, i.e., more aligned with what one sees in papers and textbooks.

## 2D Input with Calculus Palette...

Use 2D Input. Then, and only then,  the "dot" notation is available and can be found in the Calculus palette.

## Toolbar Icon - Remove section enclosing...

When I am in your situaiton, I hit enter after the "x" to add another line. Then I hit the "Remove section" button on the Toolbar. (It is on the right in the circled region shown below.) This ends Section 1 and steps-left the cursor into the "Chapter 1" section. Then I hit "Insert section" button to add another section and step-right. I find this step-left / step-right structure logical since it is akin to what one uses in Word.

If you end up with more lines in a section then desired, <ctrl>-<delete> (or <command>-<delete> for Mac) works to remove the entire line.

## Neat and useful plot. Here is a start....

I could see using this plot in my own courses. Others here are likely to give you some slicker ideas, but here is a start. All the plots are "plot", but one is of "style=point". I put the commands in a procedure so that you could pass it different functions.

 >

This procedure receives a function, f, that is to be plotted from a to b. N points are shown

 >
 >
 >
 >

(Note - the grid lines don't show up when you execute it.) More work using textplot is needed to add the values of f(x) at x.

## Snip...

Snip the image of the Maple output and paste into your document. It requires nanoseconds of effort.

## How I think of it......

I wasn't sure which form you used, so I prefer the worksheet mode, using 2d-input...
Maple expects you to differentiate first with respect to t, but then use a different variable to substitute in the values...

 >
 >
 (1)
 >

Differentiate first with respect to t, but t1 is the value that you are inserting

 >
 (2)
 >
 >

## Alternative approach: DataFrames...

As an alternative to using a Matrix, might I suggest using DataFrames. They are particularly useful if you plan to continue on with analyzing your data as if it were entered in a spreadsheet. And it is way more readable in manipulation than any spreadsheet.

I'm going to guess that the second column is generated by the probability of an outcome from a binomial distribution: (x choose 8?)   Hence I'll create the formula:

 >

Now to create the DataFrame, it is just like a Matrix, but one can label columns (and rows). The columns counter will help you catch the error that Carl Love points out.

Column 1 is a sequence of numbers from 0 to 8

Column 2 is a sequence of values from the  formula

Column 3 is just of Vector of 0.
'columns' option is the list of labels.

 >
 (1)

If you prefer the "P(x)" column to be floating point values and not rational numbers, all you need to do is to say is that you want to evaluate (individually) as a floating point:

 >
 (2)

Here is what m1 looks like now:

 >
 (3)

To see if what we have makes sense, let's add up the "P(x)" column. It should be 1.

 >
 (4)

Looks good. Time to move on.

To solve for "x*P(x)" This is "#girls"  multiplied (individually) with "P(x)"

 >

Now the DataFrame looks like this:

 >
 (5)

At this point, you can add up the values in the "x*P(x)" column

By the way, sum explicity says it is designed for symbolic summations. Hence the command of add was created. (This can be frustrating until one gets used to it.)

## ?sum...

While I understand your reasoning, as it has been mine, from the help of ?sum:

The sum command (sum) is for symbolic summation.

The italicized term is their emphasis. Hence, it sounds like even for "short" sums of discrete terms, don’t expect logical outputs from sum even if the command doesn’t reject the input. (If you are coming from MATLAB, remembering to switch to add can be maddening.)

## Alternative approach: RHS...

Dr. Lopez correctly states, the output that you label as answer5[1] are a list of two equations: x = 553,  y = 455.  Since the goal is to calculate the value of the arctan, one wants to use "just the values". Hence a technique that I use frequently is to extract the right-hand-side (RHS) of the equations, i.e., the values, and use that output, for the calculations:

 > restart; answer5 := { x= 553.6, y = 455.0 }, {x = 553.6, y = -455.0 };
 (1)
 (2)

And for future angles, use the fact that arctan can identify the quadrant using 2 parameters: y, x. So for the other angle:

 (3)
 >

## with Statistics package...

Since you appear to want to use the Statistics package, which is a good choice for plotting one data set against another, this approach might be more useful. It uses 2 commands: ScatterPlot and Fit.  I've added some options to make it more interesting, but are not required.

 >

The following is the more common way using the "Statistics" package - ScatterPlot

 >

This looks like a straight line. Are the two "vectors" truely identical?

 >
 (1)

Yes, hence the confusion as to why you might want to plot the two against each other.

As others have pointed out, you have a sequence of 110 points. Here is the way I prefer to extract this information: numelems

 >
 (2)

Let us create a new X variable to plot against the Y made up of a sequence of numbers from 1 to 110:

 >

Now we plot, and we can add a possible curve fitting line. I tried a few examples, and this one looks possible given the information provided:

 >

To see the values of a basic curve that fits the data, use Fit in the Statistics package.

 >
 (3)

May I suggest "Getting Started with Maple" 4th edition, by Doug Meade, et. al.. for other examples.

 >

## evalc...

See if the command to evaluate an expression over a complex field,  evalc, does the operation that you asking for.

## Limitations of Context Panel "2D plot" o...

Thank you Paul for posting this question. I feel your post is important because it identifies a problem with the Context Panel.

The reason your projectile doesn't land is because, in the Context Panel option for "2D-plot", the default range for the horizontal term is from -10 to +10.  I suspect that you changed the properties of the axes, "2-finger click>Axes>Properties", and thus were able to change the display to the limits: from 0 to 24. (And the same for the vertical as well.) Unfortunately, that didn't cause the program to calculate the values beyond t = 10.  Until Maplesoft updates/fixes/provides alternative to this property for the graph, I see no other option for this type of problem than for one to write the command that @tomleslie  states: "plot(ex11(t), t=0..30)"

And if you want to know when the function is 0, there appears to be no easy shortcut in the Context Panel. Hence I suggest you try this command: "solve(ex11(t))". I rewrote the expression and used the solve sommand.  You are correct, the final t for it to "return to ground" is 24 time-units.

Example: Height of a Projectile

 (1.1)

This is the default image shown using the Context Panel...

Continuing with this problem:

## Repost - a document mode approach...

I unitentionally deleted my answer to note that I do tend to think more along the lines of @tomleslie

Using document mode

 (1)

 (2)

Here I will use <ctrl>-<L> (for Windows), or <command>-<L> (for Mac) to insert labels

 (3)

Or we can do in one line:

 (4)

Or my personal preference, assign each equation to a variable, and then solve

 (5)

 (6)

 (7)