×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# The value must be a scalar - Mathcad prime 93

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

Best regards
Mathias

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

Your description of the problem is unclear. Draw a sketch showing the beam, all forces acting on it and all terms used in your post. A sketch is worth 1000 words.

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

It's years since I've done any mathcad ...

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

You're comparing a vector to a scalar, which should result in a nonsensical answer. Your program should be looping on the elements of x, and comparing each element, one-by-one to a. Moreover, comparing a vactor to a vector also makes no sense. How is one vector supposed to be greater than another?

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

is the problem "x < a" ... where x is a vector and a a scalar ?

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

I think I understand the problem you are trying to address. See below. You can simplify the expressions for Vx and Mx, using the boolean expression (x is greater than a) but I don't know mathcad, so can't help with that. Should be pretty straight forward.

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

(OP)
Okay, i will try to explain the problem better.

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

#### Quote (OP)

Okay, i will try to explain the problem better.

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.
x is not a 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.

#### Quote (OP)

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.

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

BA,

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

IRstuff,

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

I think the OP is trying to have multiple values of x, like a column in excel,
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

A vector is a defined entity. It has magnitude and direction. x is not a vector. If there are 45 elements of x, then x could be called an array or a list, but not a vector.

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

BAretired, this is a mathematical matrix** vector, not an engineering vector; the use of one to represent a set of values in the other context is confusing, but correct for the application.

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.

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

You need a nested for loop something like this in pseudo code

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

Maybe a, x, q, Q, Ra and Rb should all be considered variables, since there is a degree of interdependence among them.

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

(OP)
I looked at mathcad supports website and didnt get much info besides that they call "x" a range variable.

I saw a similar post where he reached a solution, but i dont quite understand it.
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

See 10 Jun 22 19:39 in the post you linked to - note the use of the "i" range and the reference in the following formulas as a suffix to index as in xi with the result assigned to Vi and Mi

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

I'll give it one more try. If this doesn't convince you, I give up.

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

Yes, you are correct that no program is necessary, but I assume that the student was tasked with solving it programmatically, as a learning exercise.

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
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 the beam is only 4m long ... so xi>4 should "bail out"

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

"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 think the interval is 4 m, not 40 m. Use x1:=0.1*i*m

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

Where's the kink?

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

Yeah, I was going to do that, but got distracted. It's better, but it's still not smooth like it's supposed to be, but it's not my homework, so I'm done

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

#### Quote (IRstuff)

Yeah, I was going to do that, but got distracted. It's better, but it's still not smooth like it's supposed to be, but it's not my homework, so I'm done

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

nah ... nothing over 90% ... that direct shear input should be vertical ... but the method doesn't lend itself to two points for the same x.

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

"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

#### Quote (rb1957)

...that direct shear input should be vertical ... but the method doesn't lend itself to two points for the same x.

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 you drew the SF curve from the other end you'd get a different result.

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.

"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

Interesting commentary, rb1957.

The title is interesting too. The value must be a scalar - Mathcad prime 9

What 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

This inequality operator is only for scalars; x is not a scalar.

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

which is why "x subi" worked ... identifying a element within the x array

"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

#### Quote (3DDave)

This inequality operator is only for scalars; x is not a scalar.

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

No, x is a 1 x m matrix, if you will. As with such constructions you can reference the entire matrix as in state matrix math A*x == I sort of things. There is no conflict. However, if you want to compare a single value with the matrix to a, you must use the indexing operator.

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

(OP)
Hi

Thanks alot.

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

I'm sorry but as an engineer, even pre-grad, you should understand what an array means.

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.

"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

(OP)
Thank you.

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

#### Quote:

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?

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.

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

#### Quote (mathiasfp)

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?

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

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.

"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

(OP)
Hi

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

wow ! ... 20mm deflection in a 4m span !?? but maybe we're just "playing" ... with E and I ?

"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

(OP)
Yes, E and I are not set to a correct value.
:D

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

L/200 is not unusual if dead and live load are included in the deflection calculation.

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

(OP)
Yeah i usually use the danish national version of the eurocode, it varries but L/400 is normal.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!