Community Tip - You can change your system assigned username to something more personal in your community settings. X
Hello all,
I am currently trying to create a worksheet for calculating beam deflection. I have a template I am using as a guide and in the template sheet the if statement is of the following form:
I am trying to write this into my program however when I insert an if statement I get the following issue:
As you can see the if statement takes up multiple lines. How do I get the if statement to become the more compact form?
Thanks,
Callum
Solved! Go to Solution.
Your first example technically doesn't use the IF statement, but the if function (notice how Prime set the if in bold font, as opposed to the if in your second example.
There are (at least) three different ways to make 'decisions' in Mathacd and Prime:
With the if function, you get a result from the function that you can calculate further with, but you can only make one assignment. (Well, admitted, you can assign an array of values...)
With the if statement you can put one or more assignements or other statement(s) for either result of the comparison.
With the boolean expression you get either a 1 (true) or a 0 (false) out of the comparison, which you (may) have to use in further calculations.
Success!
Luc
You can write an if statement in line, like the if statements in EXCEL: if(condition,true,false).
But I have a question: Are you solving for multiple loads, summing up VG[i to get a total? Then try:
Hi Fred thanks for the reply.
I am considering loads that are acted on by different loading factors depending if it is a permanent or variable load so I have gone for the summation in a separate line.
Best Regards,
Callum
I'm assuming that yG is your loading factor. If so, you could make it a vector the same size as xG and FG; then the summation would still work.
Your first example technically doesn't use the IF statement, but the if function (notice how Prime set the if in bold font, as opposed to the if in your second example.
There are (at least) three different ways to make 'decisions' in Mathacd and Prime:
With the if function, you get a result from the function that you can calculate further with, but you can only make one assignment. (Well, admitted, you can assign an array of values...)
With the if statement you can put one or more assignements or other statement(s) for either result of the comparison.
With the boolean expression you get either a 1 (true) or a 0 (false) out of the comparison, which you (may) have to use in further calculations.
Success!
Luc
Very useful information LucMeekes, as you seem very knowledgeable do you have any books that you could recommend to learn Mathcad prime. I am using the book "Engineering with Mathcad: Using Mathcad to create and organize your engineering calculations by Brent Maxfield" but it is very old and not up to date with the information.
Thanks,
Callum
You don't learn Prime from a book, you learn it by using it, facing the challenges before you and requesting help and/or explanation where you need it. There's a number of people frequenting this community that are generally willing to help; be sure to attach your worksheet (not just a picture) with any problems you face using Prime.
So the best book I can recommend is to visit this community with any questions you may have, and to read questions and answers from others.
Success!
Luc