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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Translate the entire conversation x

error in if function

AM_10506871
5-Regular Member

error in if function

AM_10506871_0-1744901096126.png

The  error is - "The value must be a scalar"

ACCEPTED SOLUTION

Accepted Solutions

Hi,

Please upload your worksheet.  What version of Prime are you using.

Cheers

 

View solution in original post

19 REPLIES 19

Hi,

Please upload your worksheet.  What version of Prime are you using.

Cheers

 

LucMeekes
23-Emerald IV
(To:AM_10506871)

The other point is: Did you type the square brackets? If you did, remove them.

By typing a square bracket, you create an Array, or Vector, and that is not a scalar.

You should NEVER type a square bracket to create a subset of an expression, Prime will change the look of ordinary (round) brackets to square if it sees fit to do so, but they will still be treated as round brackets, and that how you normally want them.

So if you typed the square brackets, remove them and replace them with round brackets if needed, but I guess Prime will put in round brackets automatically once you remove the squares.

 

Success!
Luc

AM_10506871
5-Regular Member
(To:LucMeekes)

Awesome, thank you.

 

I trying to use solve block and getting some errors , 

 

AM_10506871_0-1744947112969.png

I use prime 10.0, I have uploaded my sheet, open to suggestions to do it another way

 

Hi,

Like this.

AM_10506871
5-Regular Member
(To:terryhendicott)

Amazing thank you! 

AM_10506871
5-Regular Member
(To:terryhendicott)

Hi Terry,

 

I am getting another error in solver bock I am not sure where I am going wrong. 

 

I have attached sheet and a screen shot on it on what I am trying to achieve. 

 

Thank you 

Ant

LucMeekes
23-Emerald IV
(To:AM_10506871)

You should attach the Prime worksheet (the .mcdx file), not just a picture.

Apart from that, your equations are relatively simple, so you can have Prime find the equalities like this.

LucMeekes_0-1745334188398.png

 

Following that, you can evaluate the two Pi functions with their arguments filled in,  to have the results calculated numerically.

 

Success!
Luc

AM_10506871
5-Regular Member
(To:LucMeekes)

I tried to attach work sheet but it woudlnt let me. I wish I could attach the worksheet


@AM_10506871 wrote:

I tried to attach work sheet but it woudlnt let me. I wish I could attach the worksheet


Hi,

you have to pack the Mathcad file into a zip file and upload the zip file.


Martin Hanák
LucMeekes
23-Emerald IV
(To:AM_10506871)

You stated 4 days ago that you'd uploaded a worksheet. I don't see it. Did that fail as well?

Normally when editing a posting you should be able to attach a worksheet either by drag/dropping, or by browsing (see red arrows below:

LucMeekes_0-1745343375453.png

This forum usually accepts Prime worksheet without the need to zip them.There should be no problem with any worksheets (.mcdx files) saved by any version of Prime.

What's the error message you get?

 

Luc

AM_10506871
5-Regular Member
(To:LucMeekes)

attaching workshhet, errors of on last page. 

LucMeekes
23-Emerald IV
(To:AM_10506871)

It's good that you tried this:

LucMeekes_0-1745390413013.png

But something went wrong, due to this incredibly nice feature of Prime: Autolabelling.

Prime automatically tries to label each identifier the right label: Variable, Unit, Constant etc.

It is handy, but too often it goes wrong, and you should be aware of that.

Notice the two e's in the expression. The one on the parameter list to the function looks different from the one between Pi and yt.This means they are different items. The first is a variable, the second (bold green) is a constant, namely the Euler number, base of the natural logarithm.

You should change its labelling to a variable and see what happens.

 

Success!
Luc

AM_10506871
5-Regular Member
(To:LucMeekes)

I have successfully attached it now. the solve blocks with errors are on last page. If you could please have a look at fix it for me. Thank you, Ant

Werner_E
25-Diamond I
(To:AM_10506871)

You really should finally succeed in uploading your worksheet!

 

It seems that you forgot to define a guess value for P.i.

 

But with the values you provide, the expression in your solve block (its linear in P.i !!) never reaches the value of sigma - at least not for positive values of P.i.

If negative values are allowed, any value below -348,67 kN is a possible solution.

Werner_E_0-1745347034804.png

This does not change significantly if you correct your error in the definition of M.g (N and not kN).

AM_10506871
5-Regular Member
(To:Werner_E)

attaching work sheet here, there is a screenshot of what I am tryign to achieve. the answers I am getting dont seem right

Hi,

It is mismatching units.  The calculation of MT is in kN/m being the load on the beam but must be the moment on the beam that is w* L^2/8 in kN*m

 

Capture3.JPG

Cheers

Terry

 

Werner_E
25-Diamond I
(To:AM_10506871)

You used the wrong sigma in your inequation.

According to the screenshot in your sheet it should be sigma.t, not sigma.c.

 

The resulting value still is not the same as in the picture, but closer 😉

 

I also spotted some discrepancies in the picture.

,) The author uses P.e in one inequation but is talking about P.i to the right of it

.) at the top we read sigma.t=2.02 MPa, but in the picture the author writes in violet that is should be negative and a different value, -1.58 MPa.

 

BTW, we get the result from the picture if we replace sigma.t by -sigma.t !

Werner_E_0-1745397879613.png

 

A solve block with find is not made for solving inequalities and Prime will return the first value it finds which fulfills the constraint(s) starting with the guess value. As every value larger then (approx.) 1312 kN is a solution its important to chose a guess value which is lower as otherwise Prime would return the guess value unchanged:

Werner_E_2-1745398057634.png

 

Therefore, I think it is better to use an equation and not an inequality.

Werner_E_3-1745398178822.png

 

Its up to you anyway to decide if the result means P.e > 1312 kN or if it means P.e<1312 kN ;-).

 

The plot confirms the results and can also help with the decision < or >.

Werner_E_4-1745398793294.png

Prime 10 sheet attached

 

 

 

AM_10506871
5-Regular Member
(To:Werner_E)

Not sure whats going on here but the answers are not right. errors in slove block and answer on last page indicate that. sheet is attached 

Werner_E
25-Diamond I
(To:AM_10506871)

I have no experience in your field of work.

In your last sheet it was necessary to replace sigma.t by -sigma.t to get the results from the pic.

Maybe this helps here again?

Werner_E_1-1745401399827.png

This results in

Werner_E_2-1745401450318.png

Not sure which value you expected here ...

According to your calculation formulas P.i always is about 5,26 %  larger than P.e (P.e is exactly 95 % of P.i)

 

Announcements

Top Tags