Skip to content
Property Value
Hex Value $E2
Categories
Localizations
  • FR: Remplir(

Fill(

Overview

Stores value to each element in matrixname.

Availability: Token available everywhere.

Syntax

Fill(value,matrixname)

Arguments

NameTypeOptional
value
matrixnamematrix

Location

2nd, matrix, MATH, 4:Fill(


Overview

Stores value to each element in listname.

Availability: Token available everywhere.

Syntax

Fill(value,listname)

Arguments

NameTypeOptional
value
listnamelist

Location

2nd, list, OPS, 4:Fill(


Description

The Fill( command takes an existing list or matrix variable and sets all its elements to a single number. It doesn't return anything and only works on already defined variables.

{5}→dim(L1)
Fill(2,L1)
L1
    {2 2 2 2 2}

{3,4}→dim([A])
Fill(1,[A])
[A]
    [[1 1 1 1]
     [1 1 1 1]
     [1 1 1 1]]

Fill( is very fast: on a twenty-element real list, it takes only about 3.5 ms, much less than any vectorized list operation.

When Fill( is called on a list, the datatype of the list becomes the datatype of the number. That is, Fill(1,L₁) makes L₁ a real list, and Fill(i,L₁) makes L₁ a complex list.

Optimization

When creating a new list or matrix you want to fill with zeroes, it's better to delete it then create it with dim(, which will set all entries to 0, than to set its dimensions with dim( (which may not clear what was there before) then use Fill(.

Errors

On a TI-84+CSE, using Fill(List,List) will cause a RAM clear. For example: Fill({1,2,3},{1,2,3} will cause a RAM Clear. This does not apply on any other models, as they only give you argument and data type errors.


Source: parts of this page were written by the following TI|BD contributors: DarkerLine, GoVegan, iPhoenixOnTIBD, kg583, lirtosiast, Silver Phantom.

History

Calculator OS Version Description
TI-82 1.0 Added

Last update: September 30, 2023 15:38:51
Created: February 23, 2023 23:15:01
Authors: Adrien Bertrand