Edward Shore
Edward Shore

Reputation: 11

TI Nspire Python: eval_function

Is there an example of how the eval_function works from the TI System Menu module?

I have attempted

s=eval_function("sin",0.5)
print(s)

but this code returns an error.

So does

s=eval_function("sin(0.5)",True)
print(s)

Thank you in advance,

Eddie

Upvotes: 0

Views: 459

Answers (1)

Sanjeev Meston
Sanjeev Meston

Reputation: 21

You will need a user-defined function on the Notes or Calculator page to assign a name to the OS function, like this:

ef(x) := sin(x) or Define ef(x) = sin(x)

Example of Python script on the editor page:

from ti_system import *

s = eval_function("ef", 0.5)

print(s)

Upvotes: 2

Related Questions