Properties
Category
English
Similar Topics
Statistics
Comments
5
Participants
3
Subscribers
0
Votes
1
Views
863
Share
Under Consideration
Hi developers,
I already know how to nest if-statements to draw a piecewise-defined function but my students find this way hard.
I would therefore suggest a new command Piecewise[] where i.e. f(x)=Piecewise[x<1,x+2,x>=1,x] would be interpreted the same way as f(x)=If[x<1,x+2,If[x>=1,x]]. Such a command exists in Maple and I can see that my students have far less trouble using this.
Regards,
Mikkel
- GeoGebra
- Help
- Partners
-
Contact us
- Feedback & Questions
- This email address is being protected from spambots. You need JavaScript enabled to view it.
- +43 677 6137 2693
© 2023 International GeoGebra Institute
f(x)=Piecewise[<relation>,<expression>,<relation>,<expression>,...] for multiple pieces, or perhaps more useful to learning
f(x)=Piecewise[<expression1>,<relation1>,<expression2>,<relation2>,...] to match the way these type of function are expressed mathematically. Looking at your algebra view.
Tony
BTW, g(x)=x+2,x>=1 work for individual equations
g(x)=x+2,x<1
h(x)=x,x>=1
f(x)=g(x)+h(x)
This may be a reason it will not be done.
hello
have tried If[x<1,x+2,x>=1,x] really?
saludos
I did not know that, Mathmagic! That is indeed a nice feature. Thank you! My students will be thrilled.
I think this should be documented in the wiki.
Regards,
Mikkel
Noel, the use that is documented is limited to If[condition, expression, expression]. That you can also use the syntax If[condition, expression, condition, expresion...] is not obvious.
Yes, I tried to give the simplest example but I guess it became a little too simple. :)
Comments have been locked on this page!