121616949-math.293

# 121616949-math.293 - g(1 h:=unapply(f,x h(1 h(x h(x^3 Maple...

This preview shows page 1. Sign up to view the full content.

A.2 Algebra 279 A.2.3 Evaluation and Substitution It usually is not a good idea to assign values to variables—they are more useful as variables. If you want Maple to evaluate an expression you can give the variables temporary values. f:=A*(x+3)^3; subs(A=3,f); subs({x=5,A=2},f); x; A; f; Note here that you use a plain ‘=’ inside the substitution command. Two or more substitutions are done by enclosing them in curly braces. The values of f , A and x don’t change. subs(x=z^2,f); f:=subs(x=z^3,f); f; You can substitute whole expressions for variables, not just values. To force the value of f to change, just reassign it—but be careful. It usually is better to give the ex- pression a new name in case you need the original definition of f later. f:=x^2+3*x+4; f(1); g:=x -> x^2+3*x+4;
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: g(1); h:=unapply(f,x); h(1); h(x); h(x^3); Maple makes a crucial distinction between an expression like x 2 + 3 x + 4 and the function which assigns to each value of x the value x 2 + 3 x + 4. In this example, f is an expression, g and h are functions. The same distinction exists in mathemat-ics, but usually it is possible to ignore it, and indeed in many instances Maple will accept either a function or an expression. To employ the normal mathematical nota-tion f (1), however, f must be a function. This example shows two ways to deﬁne a function—directly, or using an existing ex-pression. The last two examples show that you can evaluate a function on expressions, not just numbers....
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern