EasyManua.ls Logo

Texas Instruments TI-92+ - [6.40] Write Functions with Multiple Input Argument Types

Texas Instruments TI-92+
507 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
parcurve(f,x,y)
Func
©ParCurve(f,x,y) parametrizes curve f(x,y)=0 as x(t),y(t)
©Bhuvanesh Bhatt
expr("solve("&string(f=y-t*x)&" and y-t*x=0,{"&string(x)&","&string(y)&"})")
EndFunc
For example, to find a parametric expression for
x
3
+ x
2
y
2
= 0
use the call
parcurve(x^3+x^2-y^2,x,y)
which returns
x = t
2
1 and y = t
2
1
$ torx= 0 and y = 0
The first two equations are the useful parameterizations; the second two are extraneous solutions.
(Credit to Bhuvanesh Bhatt)
[6.40] Write functions with multiple input argument types
Many built-in functions operate on numbers, expressions and lists. For example,
sin(a) returns sin(a)
sin(.2)
returns 0.1987
sin({0,.2})
returns {0, 0.1987}
This is very convenient in that you can use a single function to handle various argument types. You
can accomplish this convenience with your own functions, as shown in this demonstration function:
f1demo(xx)
Func
©Demo program to evaluate function of expression, list or matrix.
©29mar01/dburkett@infinet.com
local f1,xxt,j,k,r,xxr,xxc
©Define the function to evaluate
define f1(x)=func
ln(x)
endfunc
©Get the input argument type
gettype(xx)xxt
©Evaluate the function
if xxt="NUM" or xxt="EXPR" or xxt="VAR" then
return f1(xx)
elseif xxt="LIST" then
return seq(f1(xx[j]),j,1,dim(xx))
elseif xxt="MAT" then
6 - 72

Table of Contents

Related product manuals