Just work them. For example
(a) is 3^2 = 5^3? No
Some of the conditions will match, and then you can do the assignment.
The last assignment done will be the new value for x.
What is the value of x after these statements if the starting value of x is 3.
(a) If x^2 = 5^x then x := 25^x.
(b) If x^2 > x and x^3 < 4x^2 then x := x+ 2.
(c) If 4^x < x^4 or x^5 > 5^x then x := x^2.
(d) If 5^x > 2^x xor x^2 < 11 then x := x + 8.
(e) If x > 7 then x := x^2.
4 answers
Thanks. so what would an example solution for a?
Hmmm. The statements are an exercise to see whether you can correctly evaluate and compare the expressions. Note that once a true condition has been found, the value of x changes, and the following statement works with a new value.
There is no positive number such that x^2 = 5^x. The only solution is approximately -0.611
By the time you have worked through each statement, your final value for x will tell whether you have found all the true conditions.
There is no positive number such that x^2 = 5^x. The only solution is approximately -0.611
By the time you have worked through each statement, your final value for x will tell whether you have found all the true conditions.
does this look good to you?
(a). x = 3
(b). x := 3 + 2 = 5
(c). x := 32 = 9
(d). x := 3 + 8 = 11
(e). x = 3
(a). x = 3
(b). x := 3 + 2 = 5
(c). x := 32 = 9
(d). x := 3 + 8 = 11
(e). x = 3