Skip to main content
21-Topaz II
December 2, 2019
Solved

problems with the conditional operator

  • December 2, 2019
  • 3 replies
  • 4247 views

Hello everyone,
why the program, reported below, does not work? There seem to be problems with conditional operators. In fact the program on the right, where no conditional operators appear, gives the required result.
I sincerely thank those who will find the error and all those who will try to solve it.

Attached is the worksheet.

test 3.jpg

Best answer by -MFra-

Hello everyone!
I solved the problem this way:

test 3+.gif

test 3++.gif

3 replies

23-Emerald IV
December 2, 2019

The if() function and the if construct don't always work symbolically. The step function 'Phi()' may be a symbolic alternative:

LM_20191202_Conditional.png

Success!
Luc

-MFra-21-Topaz IIAuthor
21-Topaz II
December 3, 2019

In this case, using the unit step is a real nonsense!

23-Emerald IV
December 3, 2019

You want something to work.... or not?

LM_20191203_Conditionally.png

Success!
Luc

23-Emerald IV
December 3, 2019

Incidentally, those simple theta's at the end of many of your if-blocks do not actually do something.

It's the final theta, at the end of the program that produces the result.

If you want your program to produce the result of the first if statement that is TRUE, you can use:

return theta

Where return is the programming construct, from the programming panel...

 

Success!
Luc

-MFra-21-Topaz IIAuthor
21-Topaz II
December 4, 2019

... but it still doesn't work .....

 

 

-MFra-21-Topaz IIAuthor
21-Topaz II
December 4, 2019

The evaluation of the same logical equation in the comparisons takes on opposite values as seen in the photo, so nothing works.

test 4.jpg

-MFra-21-Topaz IIAuthorAnswer
21-Topaz II
December 7, 2019

Hello everyone!
I solved the problem this way:

test 3+.gif

test 3++.gif