Write a For ... Endfor in the scratchpad on TI nspire CAS

227 Views Asked by At

I would like to write on the scratchpad a for loop (I don't want (because I don't know how) write a program on my calculator).

I have set in memory :

{15,27,35,59,14,71,56,15,25,61} -> c1
median(c1) -> m

And I want to execute :

For i,1,10 abs(c1[i] - m) Endfor

(for mathematicians :

∀ i ∈ [1, 10], calculate | c1[i] - m |

)

(in fact, the statement between For and Endfor isn't important). My trouble is that on the scratchpad a statement can only be written on a single line. And it seems that the interpreter doesn't recognize it. I receive only Syntax error.

Is there a way to use For loop in the scratchpad ?

1

There are 1 best solutions below

0
On

On my TI nspire CX 2 I can type the following in the scratchpad:

{15,27,35,59,14,71,56,15,25,61} -> c1
median(c1) -> m
For i,1,dim(c1): Disp abs(c1[i]-m): EndFor

(dim returns the length of the list, Disp is display, a.k.a. print)
It accepts : as line seperator.