Error of the If command in the input bar

jospercomp shared this question 5 months ago
Answered

ac03429a680d083050f3e29997a1a018

I found an error of the if command when entering two domain restriction conditions for multivariable functions.

c4c26350a178024277f9526a1a46e05a

I do not understand why if I put the command from the input bar it does not work and it produces an error message. But if I first enter the function without conditions in the input bar and then change it from the properties window the command does not give errors. If I place if nested in the input bar if they work.

If(x > 0, If(0 < y < 1, 5ℯ^(-3π² x) sin(π y)))

If(0 < y < 1, If(x > 0, 5ℯ^(-3π² x) sin(π y)))

The nested if graphs are not the same as the if graph with the conditions separately.

c9a2b50b10239dfcca06714452988361


In addition, the commands using and and or generate other graphics with restrictions.

If(x > 1 ∧ 0 < y < 1, 5ℯ^(-3π² x) sin(π y))

If(x > 1 ∨ 0 < y < 1, 5ℯ^(-3π² x) sin(π y))

Comments (11)

photo
1

Did you read the manual?


https://wiki.geogebra.org/e...

photo
1

The manual says nothing when the syntax of the if command is:If( <Condition 1>, <Condition 2>, <Then> )

I do not understand why this syntax works in Value Inputbox; but it is not working in Input bar.

photo
1

this syntax works in Value Inputbox

Please post your .ggb file showing it "working"

photo
1

Input bar write:

5ℯ^(-3π² x) sin(π y)

In Value Textbox rewrite:If(x > 0, 0 < y < 1, 5ℯ^(-3π² x) sin(π y))

photo
1

Please post your .ggb file showing it "working"


photo
1

This is ggb file.

photo
2

You can combine conditions like this:

b(x, y) = If(x > 0 ∧ y > 0 ∧ y < 2, 5ℯ^(-3π² x) sin(π y))

This one works but you need to zoom in a little:


b(x, y) = If(x > 0 ∧ y > 0 ∧ y < 1, 5ℯ^(-3π² x) sin(π y))

Your file is using the syntax

If( <Condition>, <Then>, <Else> )

but not working as <Then> and <Else> are different object types

photo
photo
1

I think this:

if(x>0,0<y<1,f) is read like if(x>0, function 1 when 0<y<1 otherwise 0,other wise f)

the second condition is interpreted as function defined with a boolean (0 or 1) value

see the plane zone at 1 high in your second image

photo
1

How can I write this syntax as a Geogebra command?

if(x>0, function 1 when 0<y<1 otherwise 0,other wise f)

photo
2

just like you have tried,ie:

a(x,y)=x^2+y^2

f(x, y) = If(x > 0, 0 < y < 3, a(x, y))

hide a

I used 3 because is more visible

photo
1

7cf3e8bcfcd21b609ff4ce03516214dc

photo
© 2019 International GeoGebra Institute