Libraries. Texas Instruments TI-NSPIRE CAS, TI-Nspire CX, TI-nspire CX CAS, TI-Nspire
বিজ্ঞাপন
বিজ্ঞাপন
Libraries
What is a library?
A library is a TI-Nspire™ document that contains a collection of variables, functions, and/or programs that have been defined as library objects.
Unlike ordinary variables, functions, and programs, which can be used only within a single problem (the problem in which they are defined), library objects are accessible from any document. You can even create public library objects that appear in the TI-Nspire™ Catalog.
For example, suppose you have created library document
matrix
containing public library function
diagwithtrace()
and a private library function
errmsg()
.
Function
diagwithtrace()
displays the diagonal of a square matrix and calculates the trace of the matrix. If its input is not a square matrix, the function calls
errmsg()
, which should then return an appropriate error string.
You could then use the following syntax to display the diagonal and calculate the trace of matrix
m defined in the current problem:
matrix\diagwithtrace(m)
Libraries 665
Creating libraries and library objects
A document is regarded as a library when it is saved or copied to the designated library folder. The default location is:
• Windows®:
My Documents\TI-Nspire\MyLib
.
• Macintosh®:
Documents/TI-Nspire/MyLib
.
• Handheld:
MyLib
If the folder has been inadvertently deleted, you must create it before attempting to use libraries.
You can define library objects using either the Program Editor or the
Calculator application. Library objects must be defined with a
Define
command and must reside in the first problem of a library document.
Note: If you use the Program Editor to define a library function or program, you must store the object and also save the document. Saving the document does not automatically store the object. For more information, see the “Programming” section of the documentation.
Naming restrictions apply to library documents and library objects.
• A library document name must be a valid variable name between 1 and 16 characters long, and it must not contain a period or begin with an underscore.
• A library object name must be a valid variable name between 1 and
15 characters long. It must not contain a period and must not begin with an underscore.
Private and Public library objects
When you define a library object, you designate it as private (LibPriv) or public (LibPub).
Define a=5
a is not a library object.
Define LibPriv b={1,2,3}
b is a private library object.
Define LibPub func1(x)=x^2 - 1
func1 is a public library object.
666 Libraries
A
Private
library object does not appear in the Catalog, but you can access it by typing its name. Private objects serve well as building blocks that perform basic, low-level tasks. Typically, private library objects are called upon by the public functions and programs.
A
Public
library object appears in the Catalog’s library tab after you refresh the libraries. You can access a public library object through the
Catalog or by typing its name.
Macintosh® only: In version 1.4 of the software, a library document name cannot contain extended characters, such as Ö, á, or ñ.
Note: In library programs and functions defined as public, a comment line (©) immediately following the
Prgm
or
Func
line is automatically displayed as help in the Catalog. You could, for example, show a syntax reminder there.
Using short and long names
Anytime you are in the same problem where an object is defined, you can access it by entering its short name (the name given in the object’s
Define
command). This is the case for all defined objects, including private, public, and non-library objects.
You can access a library object from any document by typing the object’s long name. A long name consists of the name of the object’s library document followed by a backslash “\” followed by the name of the object. For example, the long name of the object defined as
func1
in the library document
lib1
is
lib1\func1
. To type the “\” character on the handheld, press g p
.
Note: If you cannot remember the exact name or the order of arguments required for a private library object, you can open the library document or use the Program Editor to view the object. You also can use
getVarInfo
to view a list of objects in a library.
Using library objects
Before using a library variable, function, or program, make sure that these steps have been followed:
• The object has been defined with the
Define
command, and the command specifies either the LibPriv or LibPub attribute.
• The object resides in the first problem of a library document. The document must reside in the designated library folder and must meet the naming requirements.
• If you defined the object using the Program Editor, it has been stored using
Check Syntax & Store
from the Program Editor menu.
Libraries 667
• The libraries have been refreshed.
Refreshing the libraries
` Refresh libraries to make the library objects available to your documents.
– From the
Tools
menu, select
Refresh Libraries
.
Handheld: Press
/ b
and select
Refresh Libraries
.
Using a public library object
1. Refresh the libraries.
2. Open the TI-Nspire™ application in which you want to use the variable, function or program.
Note: All applications can evaluate functions, but only the Calculator and Notes applications can run programs.
3. Open the Catalog and use the library tab to find and insert the object.
4. If arguments are required, type them inside the parentheses.
Using a private library object
1. Refresh the libraries.
2. Open the TI-Nspire™ application in which you want to use the variable, function or program.
Note: All applications can evaluate functions, but only the Calculator and Notes applications can run programs.
3. Type the name of the object, such as
lib1\func1()
.
In case of a function or program, always follow the name with parentheses. To type the “\” character on the handheld, press g p
.
4. If arguments are required, type them inside the parentheses.
Creating shortcuts to library objects
You can make the objects in a library more easily accessible by using
libShortcut()
to create shortcuts to them. This creates a variable group in the current problem that contains references to all the objects in the specified library document. You can choose to include or exclude the private library objects.
668 Libraries
For example, suppose the library document linalg contains functions named clearmat, cofactor, gausstep, help, inversestep, kernelbasis, rank, and simultstep. Executing
libShortcut(
“linalg”,“la”
)
would create a variable group containing the following members: la.clearmat
la.cofactor
la.gausstep
la.help
la.inversestep
la.kernelbasis
la.rank
la.simultstep
You can refer to those library objects from within the current problem by typing their variable names or by selecting them from the Variables menu.
For details and an example of using
libShortcut()
, refer to the Reference
Guide.
Included libraries
To help you get started with libraries, the TI-Nspire™ Software installation includes a library document with useful Linear Algebra functions. The library is named
linalg
or
linalgCAS
and is installed in the designated library folder.
Note: Updating the handheld’s operating system or reinstalling the computer software places all included libraries in the default folder. If you have edited an object in an included library or replaced an included library with your own document of the same name, updating or reinstalling will overwrite your changes. This could also happen after batteries are replaced or the handheld system is reset.
Restoring an included library
If you inadvertently delete or overwrite an included library, you can restore it from the installation DVD.
1. Open the DVD, and navigate to the
libs
folder.
2. Identify the library file to restore, such as
linalg.tns
or
linalgCAS.tns
for the linear algebra library.
3. Copy the file.
– Windows®: Copy the file to your designated library folder. The default location is
My Documents\TI-Nspire\MyLib
.
Libraries 669
– Macintosh®: Copy the file to your designated library folder. The default location is
Documents/TI-Nspire/MyLib
.
– Handheld: Connect the handheld to your computer, open the
TI-Nspire™ Computer Link Software, and copy the library file to the handheld’s
MyLib
folder.
4. Activate the new library objects.
– From the TI-Nspire™ Software
Tools
menu, select
Refresh
Libraries
.
Handheld: Press
/ b
, and select
Refresh Libraries
.
Changing the library folder location (computer only)
You can change the location of the designated library folder from the default
MyLib
folder to any folder on your local drive or network.
1. On the
File
menu, select
Settings
>
Keypad Options
.
(For TI-Nspire™ Teacher Software, click
File > Settings >
SmartView Options
.)
2. In the Options dialog box, click
Browse
, and then navigate to the folder that you want to designate.
3. Select the folder, and then click
OK
.
4. In the Options dialog box, click
OK
to change to the selected folder.
Notes:
• Changing the designated folder does not automatically move the library documents to the new folder. To make the objects in your library documents accessible, you must move the documents into the new folder and then refresh the libraries.
670 Libraries
• The location of the designated folder is determined during software installation. By default, this folder is:
– Windows®:
My Documents\TI-Nspire\MyLib
.
– Macintosh®:
Documents/TI-Nspire/MyLib
.
Libraries 671
672 Libraries
ডাউনলোড
বিজ্ঞাপন