cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Table as input

AL_10420170
5-Regular Member

Table as input

 

AL_10420170_1-1663329226699.png

Hello, I'm new on mathcad; I'm trying to repeat a physics exercise founded online.

I think It was builded using an old version.

My firest problem is the F assignation: as far I have understood, in the picture values from table are assigned to F. If I try to do that I get a red square mark as missing value for F.

What am I missing?

 

1 ACCEPTED SOLUTION

Accepted Solutions

The picture shows something done in Mathcad 15 or older. To input the data and assign it to F the option "Insert-Data-Table" was used. This convenient way is not available in Prime, which I assume is what you are using.

Prime has a lot of limitations and drawbacks compared to the older real Mathcad, but in your case this can be fixed quite easily. Simply use a matrix and assign it to variable F and not a table. Tables in Prime are something completely different as they were in Mathcad.

You can create a matrix by typing Ctrl-M or via the appropriate menu. You enter a value and pressing Crtl-Space adds a second column. With Ctrl-Enter you can add rows to type in your numbers.

Werner_E_1-1663333429558.png

 

But ... if you really want to do so, you can also use a Prime table to input your data.

Use the menu ribbon  "Matrices/Tables" - "Insert Table", chose a table with two columns and some rows (you always can add rows by pressing Ctrl-Enter). The headers of your tables must be named F<0> and F<1>, whereas F<0> means using the column selector you get by pressing Ctlr-C after typing F.

Werner_E_2-1663333454156.png

 

As you are using Mathcad/Prime I would suggest using units and meaningful names right from the start. You can do this by assigning the distance and velocity values separately to single vectors or by using a Prime table the way shown in the pic below. I guess there is no need anymore for the combined matrix F, but if you really need it you can always use F:=augment(dist, FSmooth). BTW, the latter would not be possible in older Mathcad versions because they won't allow values of different dimensions (length, speed) in one matrix. So even though Prime is quite inferior to the older Mathcad versions on the whole, it does have a few advantages here and there.

Werner_E_0-1663334442086.png

 

 

Prime6 sheet attached

 

View solution in original post

19 REPLIES 19

Hi,

Can you please upload your worksheet.  Thank you.

Cheers

Terry

The picture shows something done in Mathcad 15 or older. To input the data and assign it to F the option "Insert-Data-Table" was used. This convenient way is not available in Prime, which I assume is what you are using.

Prime has a lot of limitations and drawbacks compared to the older real Mathcad, but in your case this can be fixed quite easily. Simply use a matrix and assign it to variable F and not a table. Tables in Prime are something completely different as they were in Mathcad.

You can create a matrix by typing Ctrl-M or via the appropriate menu. You enter a value and pressing Crtl-Space adds a second column. With Ctrl-Enter you can add rows to type in your numbers.

Werner_E_1-1663333429558.png

 

But ... if you really want to do so, you can also use a Prime table to input your data.

Use the menu ribbon  "Matrices/Tables" - "Insert Table", chose a table with two columns and some rows (you always can add rows by pressing Ctrl-Enter). The headers of your tables must be named F<0> and F<1>, whereas F<0> means using the column selector you get by pressing Ctlr-C after typing F.

Werner_E_2-1663333454156.png

 

As you are using Mathcad/Prime I would suggest using units and meaningful names right from the start. You can do this by assigning the distance and velocity values separately to single vectors or by using a Prime table the way shown in the pic below. I guess there is no need anymore for the combined matrix F, but if you really need it you can always use F:=augment(dist, FSmooth). BTW, the latter would not be possible in older Mathcad versions because they won't allow values of different dimensions (length, speed) in one matrix. So even though Prime is quite inferior to the older Mathcad versions on the whole, it does have a few advantages here and there.

Werner_E_0-1663334442086.png

 

 

Prime6 sheet attached

 

AL_10420170
5-Regular Member
(To:Werner_E)

Thanks!! This is exactly what I needed!

AL_10420170
5-Regular Member
(To:Werner_E)

I'm facing other iusses, I think because of differeces from the 2 version of Mathcad.

Here the old :

AL_10420170_0-1663344380358.png

and attached my file.

Here the errors:

AL_10420170_1-1663344465894.png

and I can't find the meaning/equivalent for the "vertical line symbol" in the a(v1) assignement.

I'm trying to understand what the guy that wrote it has done, but it's hard if I can't make a working example.

Hi

See enclosed.

The vertical line indicates it is a program.  Go to the programming button on Math Tab | Operators and Symbols section | Programming

 

No, this time its not a problem because of different versions.

 

1) There are two different type of indices. The first one is the literal index. The one you used when you tried to define the vector x. Here the index is just part of the variable name, subscripted. The other type (and this is the one you should have used) is the matrix/vector index. Here the index is used to address the elements of a vector or matrix. You get this index either via the menu "Math - Operators - Vector and Matrix - Matrix Index" or by typing an opening square bracket [.

Unfortunately the two types of index can hardly be distinguished in print, so you need some experience with Mathcad/Prime to know that x[i:=i*10 yd is supposed to create a vector with 121 elements and you have to use the vector index here and not the literal one.

 

2) dx = v(x(t)) dt  was just written here for documentation purposes and possibly to explain the integral in the next step. The expression has no effect on any calculation and the program is here just used as an equation editor to display the equation. To do so you have to use the boolean equal sign (CTRL + on my German keyboard)  instead of the normal one which you use to numerically evaluate expressions. It has no effect on the calculation if you omit this region.

 

3) Definition of the acceleration function a(v1). The vertical bar (a vertical double line in Prime) indicates a program. You get it (closing square bracket on my keyboard) from the "Programming" menu and add lines by simply pressing the Enter key. the left arrow is a local assignment. Again you can get it from the menu or with a keyboard shortcut (AltGr 0 in my case). The root function is set to search for a solution in the range from 5 meter to 1200 meter and I am a little bit confused why meter are used here and not yards/inches as with the rest (like 0 yd to 1200 yd which are used in the root function two lines above). But of course it doesn't matter to Prime.

 

I guess that you will have to extend the initial table of values (F in your screenshot, vectors dist and FSmooth in the current worksheet).

There is at least an entry for 300 yd where we don't see the associated velocity value and we don't know how many entries there finally are (up to 1200 yd maybe?).

 

AL_10420170
5-Regular Member
(To:Werner_E)

Thanks, I tryed to reach the original author of the sheet, but for now no answer, so many part are obscure( I don't know why he mixed yd and meters)

Can you guess the meaning of the declaration of "i:=0..N" ?  It get me the error:Range unit must be specify the second value in the range; 

i:=0..N defines a range variable i. Thats sort of an implicit loop and is used in the next step to define a vector v2 with N+1 velocity values.

But I don't see any definition of N in the screenshot. N must be a positive integer.

I assume that you did not not define N and so N was interpreted as unit Newton (I guess its blue colored in your Prime sheet). The reason behind the error message is that you can define a range with values that have units, but if you do so you must define the second value in the range as well (range := f,s..l  defines a range with f as first, s as second and l as last value). If you don't set a second value, Prime assumes the second value being one more (or less, depending on the last value) than the first one.

In your case the range i is used to index a vector and so it should start at 0, have a stepwidth of 1 and an integer last value N.

So all you need to do is to define N:=... and chose a positive integer for it.

The vector v2 is a vector of velocities ranging from 94% of v.S (approx. 716 mph) up to twice v.S (approx. 1522 mph).

The number N is the number of intervals this range is divided to.

The next step is then the creation of the vector Accel of acceleration values. Note the arrow over a(v2). This is called vectorization and you get it from the menu or via Ctrl-Shift-6.

 

AL_10420170
5-Regular Member
(To:Werner_E)

Get it. Would it possible to plot the results as table and graphicaly of CD vs velocity(expressed in Mach)?

Yes.

Just put the two vectors (CD and velocity) in the placeholders of a 2D plot and type in the appropriate units.

To get the velocity in Mach you have to divide it by the speed of sound v.S. For v2 you should get the range from 0.95 Mach to 2 Mach.

In case you experience problems, post your worksheet and state, which vector you would like to plot over which.

 

AL_10420170
5-Regular Member
(To:Werner_E)

I putted CD on Y (should be without unit), and on X v2/Vs so I should have Mach. But I think I'm messing up with units. Attached the worksheet.

I guess you attached the wrong worksheet. The one you sent still contain the errors which were already corrected (wrong type of index i, missing vectorization when calculating Accel). Furthermore the part where the vector CD0 (which is what should be on the y axis) is calculated using the bullet mass and density of air is missing as is any attempt to plot.

AL_10420170
5-Regular Member
(To:Werner_E)

My bad. This is the right one.

1) You missed an "i" when you defined v2 after N:=50 and i:=0..N

 

2) This is already a problem in the original source. v2 is used twice in the sheet. On top its a vector with 121 elements but later it should be a vector with N+1 elements (and of course with different meaning and different values). You defined N:=50 and so only the first 51 elements of the former vector where overwritten, but the remaining 70 are not deleted that way and this has a strange effect when you later plot 😉
You may either chose a different variable name, redefine v2 to something like v2:="dummy" before you assign the new vector values or use clear(v2) to delete the variable (I have chosen the latter in the sheet attached).

 

3) C.D is a function with four arguments. You can't plot just the function name C.D over the vector v2/V.S. What should be at the y-axis is the vector C.D0 which is the function C.D evaluated with the velocity vector v2 and the correct air density, area and force values of the bullet.

Werner_E_1-1663422385691.png

Note that in the plot you can edit the first, second and last value at each axis to change the tick marks as needed.

 

One word of caution! The whole calculation depends on just six data points (dist, FSmooth). I guess that the table sure should run up to 1200 yards and is not intended to stop at 250 or 300 yards. The values are not seen in the picture you are working from.

Based on these six points a cubic spline  interpolation function v(x) was created but the values it returns for inputs larger than 250 yd can in no way be relied upon!

After that using this interpolating function, a greater number of x- and y-values (121) was calculated, that pile of dots was then smoothed using supsmooth and based on these new points again an interpolation function (named v2  again) was defined. I would call this voodoo and I don't think that it helps anything.

The plot below shows the six initial data points in red. The thin blue line is the first interpolation function based on only these six points (to be able to compare them I renamed it v_(x)). The underlying thick orange line is the function v(x) after applying the aforementioned voodoo spell.

Werner_E_3-1663424021923.png

 

I can spot not improvement or significant difference. I guess you happily could delete all of these regions

Werner_E_2-1663423900616.png

and use the initially created function v(x) right ahead.

But in any case you have to provide more reliable input values for distances larger than 250 yd up to 1200 yd !!
If not, the whole calculation seems to make no sense. I guess the velocity is not supposed to get negative after a distance of approx. 800 yd but thats the case if you use this interpolation function for extrapolation beyond 250 yd.

I guess that the initial values should rather look something like this (I just added a low, but positive velocity value for the distance 1200 yd):

Werner_E_0-1663424765494.png

Of course this also affects the values in the last plot

Werner_E_1-1663424851964.png

 

 

AL_10420170
5-Regular Member
(To:Werner_E)

The original author did not provide other data. So I'm working to get data (range,velocity).

I'm also trying to find Pejsa's books ( this sheet is a part of a "review" of his book) to better understand, but I'm struggling to find it in eu..

Maybe you can complete the data at least approximately using similar data values as here

https://www.mathscinotes.com/2013/12/ballistic-coefficient-rule-of-thumb-example/

or here in Appendix B

https://www.mathscinotes.com/2015/05/pejsas-projectile-drop-versus-distance-formula-part-3-of-3/

This site seems to host other related articles, too and as the author obviously uses real Mathcad there may be a chance you can talk him into giving you the files (you can let them convert by Prime so you can use it) if the are of interest to you.

 

AL_10420170
5-Regular Member
(To:Werner_E)

yep, I'm studing his articles, I mailed him, and I'm waiting for his answer. I tryed to populate the table with data posted in a picture that before I missed, but as you said before, I get more realistic result without interpolation.

AL_10420170
5-Regular Member
(To:AL_10420170)

Thanks to all!!

For completness this is the link of the original work that I taked as exercise: https://www.mathscinotes.com/2016/02/drag-coefficient-from-a-ballistic-drop-table/

Werner hasn't mentioned it, but if you select a range of data in an EXCEL workbook and copy it, move to a Prime worksheet and paste, Prime will populate a table with placeholders at the top of each column for variable names and units.

Top Tags