## The value must be a scalar - Mathcad prime 9

## The value must be a scalar - Mathcad prime 9

(OP)

Hi

Im trying to calculate the bending moment and shear force depending on the distance x along the beam.

I tried making "a" into another matrix but then its either not a scalar or it says the number of rows and collums isnt the same.

I saw a similar problem on here but didnt quite understand the solution.

Please help.

Best regards

Mathias

Im trying to calculate the bending moment and shear force depending on the distance x along the beam.

I tried making "a" into another matrix but then its either not a scalar or it says the number of rows and collums isnt the same.

I saw a similar problem on here but didnt quite understand the solution.

Please help.

Best regards

Mathias

## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9

do you need to define x as a vector ? is V a vector ? or a scalar ??

if V is a scalar, then don't you need to loop through the calc, changing x at each loop ?

maybe increment x, if x > L stop if not go back to calculate V (and BM).

"Hoffen wir mal, dass alles gut geht !"

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

## RE: The value must be a scalar - Mathcad prime 9

but you want to keep the values (of x, V, and BM) as vectors so you can keep all data points ?

so loop ... initialise ... j = 1, V(1) = Ra, M(1) = 0

then loop j = j+1, V(j)= ... M(j)= ...

BTW, one of Ra and Rb is wrong (depending on your sign convention) ... if both Q and q are +ve (down?), then R should be +ve down too (so both should be negative)

but you internal shear will change sign ... if you change the end you view the section cut from ... clear as mud ?

"Hoffen wir mal, dass alles gut geht !"

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9

Im trying to compare x to a.

x is vector, depending on how i define x it has around 45 values. If i put the pointload in the middle of the beam, around half of those x values are greater og equal to a and the other half is lower or equal to a.

I think i either need to create some sort of loop, because it needs to compare every value of x with a.

Or make "a" into a vector (picture 2) and compare each row to each other. So x value 1 compared to a value 1 and so on.

Im not fammiliar with mathcad enough to make it do so.

It might be my math skills aswell that is stopping me from compleeting it.

I have attached 2 pictures with a uniform load (based on the x and q definition from the first picture), and a DSNwinbeam screenshot (with inverted moment diagram).

Thanks for the replies so far.

## RE: The value must be a scalar - Mathcad prime 9

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

## RE: The value must be a scalar - Mathcad prime 9

nota vector. x is a position measured from the left end of the beam. x is a scalar. It is a variable and 'a' is a constant.Neither am I, but I gave you an expression for Vx and Mx in my previous post which you have completely ignored. Try typing them in as I wrote them. Each expression contains a boolean variable which can take on the value of 1 or 0, depending on whether the argument is true or false.

## RE: The value must be a scalar - Mathcad prime 9

While you are correct in your math, that's not what OP is trying to do. They're using "x", a 41-element vector of positions spaced 0.1 m apart and trying to solve the equations one position at a time.

Mathcad has a facility for defining vectors, shown at the center of OP's first image x:=0 m, 0.1 m ,0.2 m..L, which is fine, but his program, at the bottom of the first image is comparing the entire array of x-values to the mid-point value. That does not work in Mathcad, nor in real life. As in regular math, array elements can be accessed through indices, which the OP hasn't used.

Note that the OP has already defined your equations in the two programs at the bottom of his first image.

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

## RE: The value must be a scalar - Mathcad prime 9

You may be right. I'm damned if I know what the OP is trying to do.

## RE: The value must be a scalar - Mathcad prime 9

and so have multiple values of V and M ... again like columns in excel.

[which raise the obvious question ... why not use excel ?]

I don't think (I'm pretty damn sure) you can't compare a vector to a scalar.

However you can compare a vector element, like x(1), to a scalar.

This is what IR meant by "indices".

Read up no how Mathcad works with vectors/arrays. I think you see an analysis loop, have a counter, j; start at the first value of the array/vector, j = 1, so x(1), do the calc, for values of V9j) and M(j), then increment j, j = j+1 check is j is greater than n the number of elements in the array/vector ... if j > n then bail out.

"Hoffen wir mal, dass alles gut geht !"

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

I don't want to read up on how Mathcad works. I don't use Mathcad. You can't learn the nuances of every bloody software package that various members choose to use to solve problems. This site is intended for general discussion of

Structural problems, not for every oddball piece of software that comes along.The OP has been unable to describe what he is attempting to do. The structure he is talking about is a simple beam with a uniform load and a point load at midspan. Nothing could be easier. The difficulty is in understanding how a particular piece of software works. I don't know and I don't care. There are other sites on Eng-Tips which address software.

## RE: The value must be a scalar - Mathcad prime 9

In math a vector is also a matrix with a single column or single row.

It relates to the other convention when each element corresponds to a dimension, but there are uses, such as this, beyond that.

**see also: linear algebra.

He's trying to create a vector of force values at each place to make a graph of the output. Eh.

There are languages that will do exactly what the OP wants; I'm surprised MathCAD doesn't have a direct way to do so. There are array formulas in Excel for this purpose, for example.

## RE: The value must be a scalar - Mathcad prime 9

for xi=1 to length(x)

for aj=1 to length(a)

if x(xi)>a(aj)

//do something

else

//do something else

next aj

next xi

but I suspect you really want

for xi=1 to length(x)

if x(xi)>a(xi)

//do something

else

//do something else

next xi

Matlab and the like will be able to vectorize that, I don't think Mathcad will

Cheers

Greg Locock

New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9

I saw a similar post where he reached a solution, but i dont quite understand it.

https://www.eng-tips.com/viewthread.cfm?qid=495784

It seems GregLocock is on the right track, i just dont know how to do it in mathcad.

It should be possible.

I have attached the programming options in mathcad, in case that might help.

sorry if i started this thread under the wrong segment.

## RE: The value must be a scalar - Mathcad prime 9

_{i}with the result assigned to V_{i}and M_{i}## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9

Your approach, but no guarantees about correctness, since the results show a kink that shouldn't be there. Nevertheless, some of the structural elements of the sheet are usable in the programmatic version

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

## RE: The value must be a scalar - Mathcad prime 9

you've defined xi as "i"m, this is shown by the first 5 results being "real"

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

_{1}:=0.1*i*m## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9

TTFN (ta ta for now)FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

## RE: The value must be a scalar - Mathcad prime 9

Your diagrams look precisely as they should. There is a concentrated load of 1 kN at midspan, so the shear diagram has a sudden drop of 1 kN at midspan and the moment diagram has a slight cusp at midspan.

It may not be your homework, but I would give you 100%.

## RE: The value must be a scalar - Mathcad prime 9

and should rise to 0 at the end (but that's being pedantic).

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

If we check shear at x values of 2.000 and 2.001 it would be nearly vertical because only one of those values is greater than 2.

## RE: The value must be a scalar - Mathcad prime 9

if we say the discrete force is distributed over a very short span, like 2+- 0.001, then ok ... but we have a concept of a point load for a reason, and I wouldn't want to change it (nor encourage sloppy programing).

And IMHO the programming is sloppy. Some sloppiness is hidden in the loading point. I wouldn't divide the beam into 40 points. I'd distribute the points over the two spans, "a" and "b", maybe modify the nearest evenly distributed point to align with the load (which in this case it does).

Better I'd do as you did, develop the general loading equations, know that the curve is linear or parabolic and plot that.

To me it is important to understand that the shear is discontinuous at the load point and that the SF and BM curves are the same whether you plot them from one end or the other.

I know this is being pedantic, but this is a student forum, and students are learning the basis, the foundation, of the rest of their career.

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

The title is interesting too.

The value must be a scalar - Mathcad prime 9What value must be a scalar? As opposed to what...a vector? A mathematical vector or an engineering vector? Why? Darned if I know!

## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

I have been treating x as a variable and a scalar. The OP seems to be doing the same. See below.

Is this in conflict with Mathcad Prime 9?

## RE: The value must be a scalar - Mathcad prime 9

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

## RE: The value must be a scalar - Mathcad prime 9

Thanks alot.

I really appreciate your solutions.

I have used your solution BA and it works great!

I just really wanted to understand the programming part, thats why i kept asking, and i should have said that.

IRstuff have made what i wanted initially, thanks.

I dont quite understand the thought process behind "i" and "xi"

Why is it neccesary to make "i" and then "xi", does this turn it into a matrix?

I added some stuff, but besides that it is great.

Btw im in the middle og my bachelor and havent had basic programming or any advanced beam theory yet, so even though this might seem simple for veterans its not the same for me. Im not making this as homework, im simply trying to become a better engineer.

rb1957 in your comments, you mention a way to make it "vertical" in the point of the pointload ( and varius ways to make it more correct?), how would you do that if you had to dumb it down a bit?

Best regards

Mathias

## RE: The value must be a scalar - Mathcad prime 9

If you need help with MathCad programming, have to tried online help/tutorials ?

You've "seeded" the x array very simply, as multiples of 0.1m. To get a vertical line, you need two x values at 2m. "no one" cares what the values a X are, but keeping them in order helps the graphing. so you need to change how you've loaded the values into the array. "Many ways to skin cats" ... you could have twenty one points <= a and twenty one points a <= x <= L. For SF you have one expression 0 <= x <= a, and a different one for a <= x <= L. You'll need a slightly clever piece of programming to get the two values at x = a; the easy (dumb, lazy) way is to say SF(21) is the +ve shear value that you know (or can calc) and SF(22) is the -ve value. The moment values (M21) and M(22) are the same.

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

I will try it tomorrow, tonight i just started by adding more points, then it also becomes more precise depending on where i put the point load

I have probably used or heard about it before, but i find it difficult to translate all the terms from danish to english.

I wanted to learn to calculate the deflection equation the same way i did with SF and BM, so it also depends on the "xi", do you have an easy way to do this?

## RE: The value must be a scalar - Mathcad prime 9

YOU created a vector called "x", wherein there are 21 elements. How did you think you were going to access the individual (scalar) values?

The subscripted x values, x[i notation can be found in any math textbook that even mentions vectors and matrices; there shouldn't be any unfamiliarity with the notation if you are in high school or beyond.

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

## RE: The value must be a scalar - Mathcad prime 9

Yes, indeed! Use the principle of superposition. You have a uniform load and a concentrated load. If you know the deflection at any x due to each type of load, the combined deflection is the sum of the two. Just add 'em together.

## RE: The value must be a scalar - Mathcad prime 9

start with distributed loads,

integrate and add point loads from Shear Force diagram,

integrate and add point moments for the Bending moment diagram,

then integrate M/EI for slope along the beam (EI is typically constant but can be function of x, finally

integrate slope for deflection.

For simple loading (like point load at a or uniform distributed loads then are readily available solutions (try Roark or any text).

You may need to superimpose two separate loading to get your solution.

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

I tried the superposition principle, and it works great!

The other one seems a bit complicated, but im guessing it works for when i do not have the equations from a book.

Thank you.

## RE: The value must be a scalar - Mathcad prime 9

General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.

## RE: The value must be a scalar - Mathcad prime 9

:D

## RE: The value must be a scalar - Mathcad prime 9

## RE: The value must be a scalar - Mathcad prime 9