Using the When Function

advertisement
For more information, look at p. 206 of the 89 manual. (The internet address of the manual
download site for TI is:
http://education.ti.com/educationportal/appsdelivery/download/download_eula.jsp?c
id=us&displayMode=G&applicationid=6129&contentpaneid=17
The syntax for two cases is:
when(condition, trueExpression, falseExpression)
Say case I is f(x) = 2x + 1, if x> 3, and case II is f(x) = x - 7, if x < 3. You would
type:
y1 = (x > 3, 2x + 1, x - 7)
The reason is:
When x > 3 is true, you want y to be 2x + 1.
When x > 3 is false, i.e. when x < 3, you want y to be x - 7.
Hope this helps.
AS
PS The syntax for 3 cases is much harder but I'm not covering those problems
anyway.
Using the When Function
To define a two-piece function, use the syntax:
when(condition, trueExpression, falseExpression)
For example, suppose you want to graph a function with two pieces.
For three or more pieces, you can use nested when functions.
When: Use expression:
x < 0 Mx
x | 0 5 cos(x)
In the Y= Editor: The function is “pretty
printed” in this form.
Enter the function in this
form.
Additional Graphing Topics 477
Note: To enter when, type it or use the CATALOG.
where:
Nested functions quickly become complex and difficult to visualize.
Using a Multi-Statement, User-Defined Function
For three or more pieces, you may want to create a multi-statement, user-defined
function.
When: Use expression:
x < Mp 4 sin(x)
x | M p and x < 0 2x + 6
x | 0 6 – x2
In the Y= Editor:
y1(x)=when(x<0,when(x< M p,4ùsin(x),2x+6),6Nx^2)
This nested function is in effect when x<0.
Additional Graphing Topics 478
For example, consider the previous three-piece function.
Note: For information about similarities and differences between functions and
programs, refer to Programming.
A multi-statement, user-defined function can have many of the control and decisionmaking
structures (If, ElseIf, Return, etc.) used in programming. When creating the
structure of a function, it may be helpful to visualize it first in a block form.
Ê Func and EndFunc must begin and end the function.
When entering a multi-statement function on the Y= Editor or Home screen, you must
enter the entire function on a single line.
When: Use expression:
x < Mp 4 sin(x)
x | M p and x < 0 2x + 6
x | 0 6 – x2
Ê
Ê
Func
If x< M p Then
Return 4ùsin(x)
ElseIf x>=-p and x<0 Then
Return 2x+6
Else
Return 6–x^2
EndIf
EndFunc
Additional Graphing Topics 479
From the Home Screen or a PrograFrom Program
From the Home screen, you can also use the Define command to create a multistatement,
user-defined function.
Information is available on copying a function from the Home screen to the Y= Editor.
From the Program Editor, you can create a user-defined function. For example, use the
Program Editor to create a function named f1(xx). In the Y= Editor, set y1(x) = f1(x).
Example (Source: Internet page
http://www.batesville.k12.in.us/Physics/CalcNet/Calculator/ti_89/piecewise_fn.htm)
A complication is that this function is not defined for x < 0. It can be accurately
represented on the TI-89 using the following nested function:
The last term, "1/0", assures that the value of the function will be undefined whenever x
is less than zero.
THE BATESVILLE WEB PAGE HAS MANY HINTS FOR THE EASIER
PROBLEMS AS WELL INCLUDING USE OF THE VERTICAL BAR  .
Download