Graphing Calculator 3D Define Function With Condition

Sometimes you may be interested in selecting a different functions depending on the value of the arguments or variables.

Steps:

You can specify a condition by add semicolon (;) to the end of the function followed by the condition expression. For example, you could type:

f(x)=x-5; x<0

Function f will only be called if its argument is less than zero.

Examples:

Here are some more examples of defining functions:

  • f(x)=x-5; x<0
  • f(x)=x*5; x=5
  • f(x)=x-8; x<=4
  • f(x)=0; x=10 or x = 11
  • f(x)=x/10; x>100 and x<=200

The program will decide which function to call depending on the value of x:

  • f(-1) will return -6
  • f(5) will return 25
  • f(4) will return -4
  • f(11) will return 0
  • f(150) will return 15
  • f(201) will return n/a

Series:

The following demonstrates how the Taylor Polynomial series Tn(x) consists of n fractions:

The higher n, the more terms (fractions) the Taylor Polynomial consists of, and therefore the better is the accuracy of the approximation.

The value of variable n between 0 and 5 will decide how many terms are calculated:

n=2
Tn(x)=1; n=0
Tn(x)=1+x; n=1
Tn(x)=1+x+x^2/2!; n=2
Tn(x)=1+x+x^2/2!+x^3/3!; n=3
Tn(x)=1+x+x^2/2!+x^3/3!+x^4/4!; n=4
Tn(x)=1+x+x^2/2!+x^3/3!+x^4/4!+x^5/5!; n=5
value=Tn(n)

A more clever way of define tylor series involves using recursive functions.