0

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

programmerq
  • 6,262
  • 25
  • 40
  • 1
    include the error along with the code itself. – programmerq Jun 22 '21 at 14:03
  • File "C:\Users\Test\AppData\Roaming\Texas I nstruments\TI-Nspire CX CAS Student Softwar e\python\doc2\storing.py", line 24, in File "python\doc1", line 19, in eval_function TypeError: Variable must be a function – Edward Shore Jun 23 '21 at 12:32

1 Answers1

2

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)