• No results found

Expr1 ► Rad ⇒ expression

In document TI-NspireCAS ReferenceGuide En (Page 125-200)

Converts the argument to radian angle measure.

Note:You can insert this operator from the computer keyboard by typing @>Rad.

In Degree angle mode:

In Gradian angle mode:

rand() Catalog >

rand() ⇒expression rand(#Trials) ⇒list

rand()returns a random value between 0 and 1.

rand(#Trials)returns a list containing#Trialsrandom values between 0 and 1.

Set the random-number seed.

randBin() Catalog >

randBin(n,p) ⇒expression randBin(n,p,#Trials) ⇒list

randBin(n,p)returns a random real number from a specified Binomial distribution.

randBin(n,p,#Trials)returns a list containing#Trials random real numbers from a specified Binomial distribution.

randInt() Catalog >

randInt

(lowBound,upBound) ⇒ expression

randInt

(lowBound,upBound ,#Trials) ⇒list randInt

(lowBound,upBound) returns a random integer within the range specified bylowBoundand upBoundinteger bounds.

randInt

(lowBound,upBound ,#Trials)returns a list containing#Trials random integers within the specified range.

randMat() Catalog >

randMat(numRows,numColumns) ⇒matrix Returns a matrix of integers between -9 and 9 of the specified dimension.

Both arguments must simplify to integers.

Note:The values in this matrix will change each time you press·.

randNorm() Catalog >

randNorm(μ, σ) ⇒expression randNorm(μ, σ,#Trials) ⇒list

randNorm(μ,σ)returns a decimal number from the specified normal distribution. It could be any real number but will be heavily concentrated in the interval [μ−3•σ, μ+3•σ].

randNorm(μ,σ,#Trials)returns a list containing

#Trialsdecimal numbers from the specified normal distribution.

randPoly() Catalog >

randPoly(Var,Order) ⇒expression

Returns a polynomial inVarof the specifiedOrder. The coefficients are random integers in the range −9 through 9. The leading coefficient will not be zero.

Ordermust be 0–99.

randSamp() Catalog >

randSamp(List,#Trials[,noRepl]) ⇒list

Returns a list containing a random sample of#Trials trials fromListwith an option for sample replacement (noRepl=0), or no sample replacement (noRepl=1).

The default is with sample replacement.

RandSeed Catalog >

RandSeedNumber

IfNumber= 0, sets the seeds to the factory defaults for the random-number generator. IfNumber≠ 0, it is used to generate two seeds, which are stored in system variables seed1 and seed2.

real() Catalog >

real(Expr1) ⇒expression

Returns the real part of the argument.

Note:All undefined variables are treated as real variables. See alsoimag(), page 77.

real(List1) ⇒list

Returns the real parts of all elements.

real(Matrix1) ⇒matrix

Returns the real parts of all elements.

►Rect Catalog >

Vector►Rect

Note:You can insert this operator from the computer keyboard by typing @>Rect.

DisplaysVectorin rectangular form [x, y, z]. The vector must be of dimension 2 or 3 and can be a row or a column.

Note:►Rectis a display-format instruction, not a conversion function. You can use it only at the end of an entry line, and it does not updateans.

Note:See also ►Polar, page 115.

complexValue►Rect

DisplayscomplexValuein rectangular form a+bi. The complexValuecan have any complex form. However, an reentry causes an error in Degree angle mode.

Note:You must use parentheses for an (r∠θ) polar entry.

In Radian angle mode:

In Gradian angle mode:

In Degree angle mode:

Note:To type ∠ , select it from the symbol list in the Catalog.

ref() Catalog >

ref(Matrix1[,Tol]) ⇒matrix

Returns the row echelon form ofMatrix1.

Optionally, any matrix element is treated as zero if its absolute value is less thanTol. This tolerance is used only if the matrix has floating-point entries and does not contain any symbolic variables that have not been assigned a value. Otherwise,Tolis ignored.

• If you use

or set theAuto or Approximatemode to Approximate, computations are done using floating-point arithmetic.

ref() Catalog >

• IfTolis omitted or not used, the default tolerance is calculated as:

5E−14 •max(dim(Matrix1)) •rowNorm(Matrix1) Avoid undefined elements inMatrix1. They can lead to unexpected results.

For example, ifais undefined in the following expression, a warning message appears and the result is shown as:

The warning appears because the generalized element 1/awould not be valid fora=0.

You can avoid this by storing a value toabeforehand or by using the constraint (“|”) operator to substitute a value, as shown in the following example.

Note:See alsorref(), page 136.

remain() Catalog >

remain(Expr1,Expr2) ⇒expression

remain(List1,List2) ⇒list remain(Matrix1,Matrix2) ⇒matrix

Returns the remainder of the first argument with respect to the second argument as defined by the identities:

remain(x,0)   x

remain(x,y)   x−y•iPart(x/y)

As a consequence, note thatremain(−x,y)−remain (x,y). The result is either zero or it has the same sign as the first argument.

Note:See alsomod(), page 100.

Request Catalog >

RequestpromptString,var[, DispFlag[, statusVar]]

RequestpromptString,func(arg1,...argn) [, DispFlag[, statusVar]]

Programming command: Pauses the program and displays a dialog box containing the message promptStringand an input box for the user’s response.

When the user types a response and clicksOK, the contents of the input box are assigned to variablevar. If the user clicksCancel, the program proceeds without accepting any input. The program uses the previous value ofvarifvarwas already defined.

The optionalDispFlagargument can be any expression.

• IfDispFlagis omitted or evaluates to1, the prompt message and user’s response are displayed in the Calculator history.

• IfDispFlagevaluates to0, the prompt and response are not displayed in the history.

Define a program:

Define request_demo()=Prgm     Request “Radius: ”,r     Disp “Area = “,pi*r2 EndPrgm

Run the program and type a response:

request_demo()

Result after selectingOK:

Radius: 6/2 Area= 28.2743

The optionalstatusVarargument gives the program a way to determine how the user dismissed the dialog box. Note thatstatusVarrequires theDispFlag argument.

• If the user clickedOKor pressedEnteror Ctrl+Enter, variablestatusVaris set to a value of1.

• Otherwise, variablestatusVaris set to a value of0.

Thefunc() argument allows a program to store the user’s response as a function definition. This syntax operates as if the user executed the command:

     Definefunc(arg1, ...argn) =user’s response The program can then use the defined functionfunc().

ThepromptStringshould guide the user to enter an appropriateuser’s responsethat completes the function definition.

Note:You can use the Request command within a user-defined program but not within a function.

Define a program:

Define polynomial()=Prgm

    Request "Enter a polynomial in x:",p(x)     Disp "Real roots are:",polyRoots(p(x),x) EndPrgm

Run the program and type a response:

polynomial()

Result after entering x^3+3x+1 and selectingOK:

Real roots are: {-0.322185}

Request Catalog >

To stop a program that contains aRequestcommand inside an infinite loop:

• Windows®:Hold down theF12key and press Enterrepeatedly.

• Macintosh®:Hold down theF5key and press Enterrepeatedly.

• Handheld:Hold down the

c

key and press

·

repeatedly.

Note:See alsoRequestStr, page 131.

RequestStr Catalog >

RequestStrpromptString,var[,DispFlag] Programming command: Operates identically to the first syntax of theRequestcommand, except that the user’s response is always interpreted as a string. By contrast, theRequestcommand interprets the response as an expression unless the user encloses it in quotation marks (““).

Note: You can use theRequestStrcommand within a user-defined program but not within a function.

To stop a program that contains aRequestStr command inside an infinite loop:

• Windows®:Hold down theF12key and press Enterrepeatedly.

• Macintosh®:Hold down theF5key and press Enterrepeatedly.

• Handheld:Hold down the

c

key and press

·

repeatedly.

Note:See alsoRequest, page 130.

Define a program:

Define requestStr_demo()=Prgm     RequestStr “Your name:”,name,0

    Disp “Response has “,dim(name),” characters.”

EndPrgm

Run the program and type a response:

requestStr_demo()

Result after selectingOK(Note that theDispFlag argument of0omits the prompt and response from the history):

requestStr_demo()

Response has 5 characters.

Return Catalog >

Return [Expr]

ReturnsExpras the result of the function. Use within aFunc...EndFuncblock.

Note:UseReturnwithout an argument within a Prgm...EndPrgmblock to exit a program.

Note for entering the example:In the Calculator application on the handheld, you can enter multi-line definitions by pressing

@

instead of

·

at the end of each line. On the computer keyboard, hold downAlt and pressEnter.

right() Catalog >

right(List1[,Num]) ⇒list

Returns the rightmostNumelements contained in List1.

If you omitNum, returns all ofList1. right(sourceString[,Num]) ⇒string

Returns the rightmostNumcharacters contained in character stringsourceString.

If you omitNum, returns all ofsourceString. right(Comparison) ⇒expression

Returns the right side of an equation or inequality.

rk23 () Catalog >

rk23(Expr,Var,depVar, {Var0,VarMax},depVar0, VarStep[,diftol]) ⇒matrix

rk23(SystemOfExpr,Var,ListOfDepVars, {Var0, VarMax},ListOfDepVars0,VarStep[,diftol]) ⇒ matrix

rk23(ListOfExpr,Var,ListOfDepVars, {Var0, VarMax},ListOfDepVars0,VarStep[,diftol]) ⇒ matrix

Uses the Runge-Kutta method to solve the system

Differential equation:

y'=0.001*y*(100-y) and y(0)=10

To see the entire result, press£and then use¡and¢ to move the cursor.

Same equation withdiftol set to 1.E−6

rk23 () Catalog >

withdepVar(Var0)=depVar0on the interval [Var0,VarMax]. Returns a matrix whose first row defines theVaroutput values as defined byVarStep. The second row defines the value of the first solution component at the correspondingVarvalues, and so on.

Expris the right hand side that defines the ordinary differential equation (ODE).

SystemOfExpris a system of right-hand sides that define the system of ODEs (corresponds to order of dependent variables inListOfDepVars).

ListOfExpris a list of right-hand sides that define the system of ODEs (corresponds to order of dependent variables inListOfDepVars).

Varis the independent variable.

ListOfDepVarsis a list of dependent variables.

{Var0,VarMax} is a two-element list that tells the function to integrate fromVar0toVarMax. ListOfDepVars0is a list of initial values for dependent variables.

IfVarStepevaluates to a nonzero number: sign (VarStep) = sign(VarMax-Var0) and solutions are returned atVar0+i*VarStepfor all i=0,1,2,… such that Var0+i*VarStepis in [var0,VarMax] (may not get a solution value atVarMax).

ifVarStepevaluates to zero, solutions are returned at the "Runge-Kutta"Varvalues.

diftolis the error tolerance (defaults to 0.001).

Compare above result with CAS exact solution obtained using deSolve() and seqGen():

System of equations:

withy1(0)=2 and y2(0)=5

root() Catalog >

root(Expr) ⇒root root(Expr1,Expr2) ⇒root

root(Expr)returns the square root ofExpr. root(Expr1,Expr2)returns theExpr2root ofExpr1. Expr1can be a real or complex floating point constant, an integer or complex rational constant, or a general symbolic expression.

Note:See alsoNth root template, page 6.

rotate() Catalog >

rotate(Integer1[,#ofRotations]) ⇒integer Rotates the bits in a binary integer. You can enter Integer1in any number base; it is converted automatically to a signed, 64-bit binary form. If the magnitude ofInteger1is too large for this form, a symmetric modulo operation brings it within the range. For more information, see ►Base2, page 19.

In Bin base mode:

To see the entire result, press£and then use¡and¢ to move the cursor.

If#ofRotationsis positive, the rotation is to the left. If

#ofRotationsis negative, the rotation is to the right.

The default is −1 (rotate right one bit).

For example, in a right rotation:

In Hex base mode:

Each bit rotates right.

0b00000000000001111010110000110101 Rightmost bit rotates to leftmost.

produces:

0b10000000000000111101011000011010 The result is displayed according to the Base mode.

Important:To enter a binary or hexadecimal number, always use the 0b or 0h prefix (zero, not the letter O).

rotate(List1[,#ofRotations]) ⇒list

Returns a copy ofList1rotated right or left by#of Rotationselements. Does not alterList1.

If#ofRotationsis positive, the rotation is to the left. If

#of Rotationsis negative, the rotation is to the right.

The default is −1 (rotate right one element).

In Dec base mode:

rotate(String1[,#ofRotations]) ⇒string Returns a copy ofString1rotated right or left by

#ofRotationscharacters. Does not alterString1. If#ofRotationsis positive, the rotation is to the left. If

#ofRotationsis negative, the rotation is to the right.

The default is −1 (rotate right one character).

round() Catalog >

round(Expr1[,digits]) ⇒expression Returns the argument rounded to the specified number of digits after the decimal point.

round() Catalog >

digitsmust be an integer in the range 0–12. Ifdigitsis not included, returns the argument rounded to 12 significant digits.

Note:Display digits mode may affect how this is displayed.

round(List1[,digits]) ⇒list

Returns a list of the elements rounded to the specified number of digits.

round(Matrix1[,digits]) ⇒matrix

Returns a matrix of the elements rounded to the specified number of digits.

rowAdd() Catalog >

rowAdd(Matrix1,rIndex1,rIndex2) ⇒matrix Returns a copy ofMatrix1with rowrIndex2replaced by the sum of rowsrIndex1andrIndex2.

rowDim() Catalog >

rowDim(Matrix) ⇒expression Returns the number of rows inMatrix. Note:See alsocolDim(), page 27.

rowNorm() Catalog >

rowNorm(Matrix) ⇒expression

Returns the maximum of the sums of the absolute values of the elements in the rows inMatrix. Note:All matrix elements must simplify to numbers.

See alsocolNorm(), page 27.

rowSwap() Catalog >

rowSwap(Matrix1,rIndex1,rIndex2) ⇒matrix ReturnsMatrix1with rowsrIndex1andrIndex2 exchanged.

rref() Catalog >

rref(Matrix1[,Tol]) ⇒matrix

Returns the reduced row echelon form ofMatrix1.

Optionally, any matrix element is treated as zero if its absolute value is less thanTol. This tolerance is used only if the matrix has floating-point entries and does not contain any symbolic variables that have not been assigned a value. Otherwise,Tolis ignored.

• If you use

or set theAuto or Approximatemode to Approximate, computations are done using floating-point arithmetic.

• IfTolis omitted or not used, the default tolerance is calculated as:

5E−14 •max(dim(Matrix1)) •rowNorm(Matrix1) Note:See alsoref(), page 128.

S

sec()

µ

key

sec(Expr1) ⇒expression

sec(List1) ⇒list

Returns the secant ofExpr1or returns a list containing the secants of all elements inList1. Note:The argument is interpreted as a degree, gradian or radian angle, according to the current angle mode setting. You can use °, G, orrto override the angle mode temporarily.

In Degree angle mode:

sec⁻¹()

µ

key sec⁻¹(Expr1) ⇒expression

sec⁻¹(List1) ⇒list

Returns the angle whose secant isExpr1or returns a list containing the inverse secants of each element of List1.

Note:The result is returned as a degree, gradian, or radian angle, according to the current angle mode setting.

Note:You can insert this function from the keyboard by typing arcsec(...).

In Degree angle mode:

In Gradian angle mode:

In Radian angle mode:

sech() Catalog >

sech(Expr1) ⇒expression

sech(List1) ⇒list

Returns the hyperbolic secant ofExpr1or returns a list containing the hyperbolic secants of theList1 elements.

sech⁻¹() Catalog >

sech⁻¹(Expr1) ⇒expression

sech⁻¹(List1) ⇒list

Returns the inverse hyperbolic secant ofExpr1or returns a list containing the inverse hyperbolic secants of each element ofList1.

Note:You can insert this function from the keyboard by typing arcsech(...).

In Radian angle and Rectangular complex mode:

seq() Catalog >

seq(Expr,Var,Low,High[,Step]) ⇒list IncrementsVarfromLowthroughHighby an increment ofStep, evaluatesExpr, and returns the results as a list. The original contents ofVarare still there afterseq()is completed.

The default value forStep= 1.

PressCtrl+Enter/·(Macintosh®:“+Enter) to evaluate:

seqGen() Catalog >

seqGen(Expr,Var,depVar, {Var0,VarMax}[, ListOfInitTerms

[,VarStep[,CeilingValue]]]) ⇒list

Generates a list of terms for sequencedepVar(Var)

=Expras follows: Increments independent variable VarfromVar0throughVarMaxbyVarStep, evaluatesdepVar(Var) for corresponding values of Varusing theExprformula andListOfInitTerms, and returns the results as a list.

seqGen(ListOrSystemOfExpr,Var,ListOfDepVars, {Var0,VarMax} [

,MatrixOfInitTerms[,VarStep[,CeilingValue]]]) ⇒ matrix

Generates a matrix of terms for a system (or list) of sequencesListOfDepVars(Var)

=ListOrSystemOfExpras follows: Increments independent variableVarfromVar0throughVarMax byVarStep, evaluatesListOfDepVars(Var) for corresponding values ofVarusing

ListOrSystemOfExprformula and

MatrixOfInitTerms, and returns the results as a matrix.

The original contents ofVarare unchanged after seqGen()is completed.

The default value forVarStep=1.

Generate the first 5 terms of the sequenceu(n) = u(n-1)2/2, withu(1)=2andVarStep=1.

Example in which Var0=2:

Example in which initial term is symbolic:

System of two sequences:

seqGen() Catalog >

Note: The Void (_) in the initial term matrix above is used to indicate that the initial term for u1(n) is calculated using the explicit sequence formula u1(n)

=1/n.

seqn() Catalog >

seqn(Expr(u,n[,ListOfInitTerms[,nMax[, CeilingValue]]]) ⇒list

Generates a list of terms for a sequenceu(n)=Expr(u, n) as follows: Incrementsnfrom 1 throughnMaxby 1, evaluatesu(n) for corresponding values ofnusing theExpr(u,n) formula andListOfInitTerms, and returns the results as a list.

seqn(Expr(n[,nMax[,CeilingValue]]) ⇒list Generates a list of terms for a non-recursive sequenceu(n)=Expr(n) as follows: Incrementsnfrom 1 throughnMaxby 1, evaluatesu(n) for

corresponding values ofnusing theExpr(n) formula, and returns the results as a list.

IfnMaxis missing,nMaxis set to 2500 IfnMax=0,nMaxis set to 2500

Note: seqn()callsseqGen( )withn0=1andnstep=1

Generate the first 6 terms of the sequenceu(n) = u(n-1)/2, withu(1)=2.

series() Catalog >

series(Expr1,Var,Order[,Point]) ⇒expression series(Expr1,Var,Order[,Point]) |Var>Point expression

series(Expr1,Var,Order[,Point]) |Var<Point expression

Returns a generalized truncated power series representation ofExpr1expanded aboutPoint through degreeOrder.Ordercan be any rational number. The resulting powers of (VarPoint) can include negative and/or fractional exponents. The coefficients of these powers can include logarithms of (VarPoint) and other functions ofVarthat are

series() Catalog >

dominated by all powers of (VarPoint) having the same exponent sign.

Pointdefaults to 0.Pointcan be ∞ or −∞, in which cases the expansion is through degreeOrderin 1/

(VarPoint).

series(...)returns “series(...)” if it is unable to determine such a representation, such as for essential singularities such as sin(1/z) at z=0, e−1/zat z=0, or ezat z = ∞ or −∞.

If the series or one of its derivatives has a jump discontinuity atPoint, the result is likely to contain sub-expressions of the form sign(…) or abs(…) for a real expansion variable or (-1)floor(…angle(…)…)for a complex expansion variable, which is one ending with

“_”. If you intend to use the series only for values on one side ofPoint, then append the appropriate one of

“|Var>Point”, “|Var<Point”, “| “VarPoint”, or “Var

Point” to obtain a simpler result.

series()can provide symbolic approximations to indefinite integrals and definite integrals for which symbolic solutions otherwise can't be obtained.

series()distributes over 1st-argument lists and matrices.

series()is a generalized version oftaylor(). As illustrated by the last example to the right, the display routines downstream of the result produced by series(...) might rearrange terms so that the dominant term is not the leftmost one.

Note:See alsodominantTerm(), page 53.

setMode() Catalog >

setMode(modeNameInteger,settingInteger) ⇒ integer

setMode(list) ⇒integer list Valid only within a function or program.

setMode(modeNameInteger,settingInteger) temporarily sets modemodeNameIntegerto the new settingsettingInteger, and returns an integer

Display approximate value of π using the default setting for Display Digits, and then display π with a setting of Fix2. Check to see that the default is restored after the program executes.

setMode() Catalog >

corresponding to the original setting of that mode. The change is limited to the duration of the

program/function’s execution.

modeNameIntegerspecifies which mode you want to set. It must be one of the mode integers from the table below.

settingIntegerspecifies the new setting for the mode.

It must be one of the setting integers listed below for the specific mode you are setting.

setMode(list)lets you change multiple settings.list contains pairs of mode integers and setting integers.

setMode(list)returns a similar list whose integer pairs represent the original modes and settings.

If you have saved all mode settings withgetMode(0)

var, you can usesetMode(var)to restore those

var, you can usesetMode(var)to restore those

In document TI-NspireCAS ReferenceGuide En (Page 125-200)

Related documents