Prof. Scot Gould

## 382 Reputation

8 years, 96 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.

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

## Let Maple do the Math and other suggesti...

For some reason, the website is unable to upload my Maple sheet, so I will leave this comment in the form of a PDF that you should be able to download and read.

Roots.pdf

## Alternative - copy and paste Code Edit R...

For the occasional time that I wish to write "code", i.e., 1-D math input, I prefer to insert a Code Edit Region (CER), and enter the code there. Then, when I wish to paste the code to a Word document, I copy and paste the image of the CER. This process doesn't exactly do what you are asking, but with the coloring and bolding, it does tend to generate a prettier pretty-print.

## eps generation works properly for me....

@mikerostructure  For what it is worth, I generated an eps file version of the plot. As @acer pointed out, it took Maple 2020 more than a minute to generate both the first plot and the second plot.

To reproduce the image, I sent the file to an online EPS viewer and it worked fine.

## Suggestion - 2D input...

If what you want is Maple code to appear as "real math", have you considered using "2D Input" to input content?  But if you are committed to "Maple Input", does that mean some data that will be entered will not be in SI units?

------------------------------

Note - I would have uploaded the file and the content of the file, but this is what I received multiple times trying to upload this very simple file:

------------------------------
Maple Worksheet - Error

## Feedly works well for me....

I use Feedly on Android and other OSes. And then just "add content" -> "MaplePrimes".  My only complaint about the RSS feed is that the spam  still gets through before someone deletes it. 3 of the last 5 posts have been for pain killing medication, wallpaper and mole removal products.

Or did you not want to use an app like that?

## Problem in Explore...

A quick glance suggests a missing divide command in the "parameters = " expression on the last line.

See attached. Refraction_Demo_Doc_version.mw

Note, this document was constructed as part of my experiment with Maple Cloud.

## Ambiguity in mathematical statement....

As someone who spends time trying to get students to use Maple to solve physics / engineering problems because I would rather have them work on those problems, and not math problems, I can understand your frustrations. There are many times I find Maple coding to be less than "math intuitive."

However, for this situation, let me say, what are you trying to do ? Are you trying to take the derivative of f(x) with respect to x and then set the x in the outcome to be equal to 3? This outcome would be 3.  Or, are you trying to take the derivative of f(x) after you have put in the value of 3 for x? Because that is how I initialy read it. (Think arcsin(sin(x)). Pass x to sine, do the calculations, then do the arcsin of the resulting calculation.) For this reading, the outcome is 0.

Since I'm going to assume the former, then what one needs to know, when Maple sees g(x), x is a variable. However, when Maple see f'(x), it sees the " ' " as the derivative with respect to the variable x.  So for me, the most readable and understandable way to write these statements is:

 >
 (1)
 >
 (2)
 >
 (3)
 >

It performs the calculation of the derivative before it evaluates the outcome using x1 as the value for x.