The problem with command If

Roman Chijner shared this question 2 weeks ago
Answered

Hi,

Is it possible the next construction or Bug ?

x∈[a,b]; f(x)=x^2; g- is Polyline on the interval [a,b]

If[condition,f,g]

ggB result-->f(x)/undefined

Comments (15)

photo
1

what type of object must be for you h=If[condition,f,g]? is h a function?

photo
1

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

Both objects must be of the same type.

photo
1

OK,

I understand, thanks you for the replies

photo
photo
1

perhaps the tool attached can be usefull

photo
1

@Mathmagik

You replaced polyline with linear functions-a useful tool! thanks

A am interested her possibility to include in the "If" these two different objects!...

photo
1

very nice mathmagic.

photo
1

@Roman

Can you specify your question or the properties of your polyline or your if-command?

If your polyline is a piecewise given function (you can use mathmagic's tool to get it) then you have, as the name sayed, two functions and the if-command should work, because they are of the same type (functions).


But if your polyline is not a function more details or informations may help to find a solution.

Kind regards

mire2

photo
1

@mire

On a certain interval, depending on the conditions, it is required to specify various piecewise function. I often use the Polyline command. But it is not a function-list of segments!

The Intersect command finds the intersection points of Polyline and Functions! I thought that the If command works with them too... The suggested Mathmagic tool is also convenient as a Polyline command!

photo
1

@Mathmagic

In the inequality F:...

If (x (Element (m, k)) ≤ x ≤ x (Element (m, k + 1)) must be ->

If (x (Element (m, k)) ≤ x <x (Element ( m, k + 1)),

otherwise at the joints points the function is added twice .

photo
1

if(3<=x<=4,x,4<=x<=5,x+3) is equal to if(3<=x<=4,x,4<x<=5,x+3) but different to if(3<=x<4,x,4<=x<=5,x+3)

more if(3<=x<=4,x,4<=x<=5,x+3) is equal to if(3<=x<=4,x,3<=x<=5,x+3)

type the three functions and try f(4),g(4),(h(4))

you can change the tool if you like

photo
1

@Mathmagic

my example in the attached file

photo
1

excuse. I though I had made a nested if function. So you must to edit the tool.

the single strange points of tool1(list) are not visible, this confused me

photo
1

Thank you very much for the work you are doing! I think that such a tool can be among the Geogebra commands!!!

photo
1

I forgot it. really the command was in GG. see datafunction(). but it is not dynamic

it needs an update script

Files: foro.ggb
photo
1

!!!!!!!!!!!!! super, but is not dynamic to use......

photo
© 2018 International GeoGebra Institute