Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

The value must be a scalar - Mathcad prime 9 3

Status
Not open for further replies.

mathiasfp

Student
Sep 8, 2023
8
DK
Hi

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

billede_2023-09-08_144452209_rhj9tl.png


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.
billede_2023-09-08_144707685_fbnyk4.png


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

Please help.

Best regards
Mathias
 
Replies continue below

Recommended for you

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.
 
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.
 
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! faq731-376 forum1529 Entire Forum list
 
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.
 
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.

Capture_siq2cr.jpg
 
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.

billede_2023-09-09_131942941_uloskq.png

billede_2023-09-09_132013136_hliay2.png
 
OP said:
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.

OP said:
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.

Capture_ar5st3.jpg
 
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! faq731-376 forum1529 Entire Forum list
 
IRstuff,

You may be right. I'm damned if I know what the OP is trying to do.
 
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.
 
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.
 
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.

**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.
 
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
 
Maybe a, x, q, Q, Ra and Rb should all be considered variables, since there is a degree of interdependence among them.
 
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.

billede_2023-09-10_125427065_iovhee.png

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

sorry if i started this thread under the wrong segment.
 
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 x[sub]i[/sub] with the result assigned to V[sub]i[/sub] and M[sub]i[/sub]
 
I'll give it one more try. If this doesn't convince you, I give up.

Capture_qo8rjs.jpg



Capture02_ugb3im.jpg
 
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

beam_cff1ty.png


TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top