Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Translate the entire conversation x

If Function

ranto
10-Marble

If Function

How to solve the below mention condition

if D<= 15 = 5

if D>15<=36 = 6

if D>36<=60 = 8

if D<60 = 10

 

2 REPLIES 2
Werner_E
25-Diamond I
(To:ranto)


@ranto wrote:

How to solve the below mention condition

if D<= 15 = 5

if D>15<=36 = 6

if D>36<=60 = 8

if D<60 = 10

 


"solve" ??? This is not an equation which could be solved for a specific variable.

Obviously you would like to define a function or just calculate one specific value, correct?

And the last condition sure should read D>60, right?

 

You did not state which version of Mathcad or Prime you are using. In real Mathcad it would look like in the picture below.

If you use Prime it would work the same way, but will look a bit different ("else" instead of "otherwise").

If you are using the free Prime Express you can't use programming but you can still define your function using the if-function instead of the programming if-condition. This looks less clear and works similar to the "if" in a spreadsheet like Calc or Excel (see the function definition for f.2 below the plot in the picture).

B.png

In case you don't want to define a function but just want to calculate a single result, you would simply write <variablename>:=.... instead of f(D):=....

 

ranto
10-Marble
(To:Werner_E)

Thank you

Announcements

Top Tags