You can use the := and => operators to define functions; both
give the name f to the function which takes a value and returns the square of the value. If you then enter
you will get
You can give Xcas a function without a name with the -> operator; the squaring function can be written without a name as
You can use this form of the function to assign it to a name; both
are alternate ways to define f as the squaring function.
You can similarly define functions of more than one variable. For example, to define a function which takes the lengths of the two legs of a right triangle and returns the hypotenuse, you could enter