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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

If statement

Kate1
3-Newcomer

If statement

Hello,

 

I solve a non linear system by making use of MathCaf and I store the results in a variable (let's call it "sotto").

There are some values of the parameters (a, b, c, d) for which there is not any solution of the system,  therefore

MathCAD returns an error message (see attachment).

 

I would like to add an "if statement " to monitor when the solution of the system does not exist.

 

For example, if the system does not have solutions, the variable SOL=0, otherwise SOL=1.

Is there a way (a built-in variable ?) that tells me that the system is impossible to be solved?

 

 

Thank you

Kate

5 REPLIES 5
-MFra-
21-Topaz II
(To:Kate1)

Hi,

please attach the worksheet (we can't dedicate ourselves to writing your file ... don't you think?).

LucMeekes
23-Emerald III
(To:Kate1)

There's no built-in variable, like you suggest. But you can check for errors.

Something like:

LM_20191121_IfStatement.png

Success!
Luc

Werner_E
25-Diamond I
(To:LucMeekes)

Can be simplified to

 

B3.PNG

-MFra-
21-Topaz II
(To:Kate1)

Hi,

Solved this way, it's almost ok ......

Kate problem.jpg

Werner_E
25-Diamond I
(To:Kate1)

If you don't like the idea to write a function with a,b,c,d as arguments but rather would like to just use the defined values in the sheet, the following should do the job as demanded.

If a solution was found the variable SOL is 1 and the other searched for variables have their appropriate values.

If the system could not be solved, SOL is 0 and the variables are set to NaN ("Not a value").

B4.PNG

Announcements

Top Tags