1

I have another question here: Inspired Lua Program is Different on Computer and Calculator which answers this question. My attempt to mark as duplicate aged away.

I am writing a program for the Nspire CX CAS. I have a d2Editor mathbox that I would like to evaluate an expression I am giving it without using decimals. I would like it to simplify square roots and/or reduce fractions. How can this be accomplished?

I've spent around an hour looking through the wiki.

Thanks for any help you can offer.

2 Answers2

2

Actually, no. I don't know if this is new but math.eval(expr) will evaluate expr as if you were running it from the tab calculator (Although still, if you have CAS disabled on your calculator, it will not be able to do use it)

math.eval('123+321=444') -> 'True'

Promitheas Nikou
  • 511
  • 4
  • 14
1

Unless TI added new features recently, the answer is unfortunately that you will need to write it from scratch.

In a Lua program you do not have access to the representation that are used internally (say in a Notes workshop) to represent mathematical expressions. You are handed, sigh, a string.

That means you will need to write your own parser for mathematical expressions in order to get a reasonable representation. Then you will need to write your own functions for manipulating and reducing expressions.

... no I am not kidding ...

soegaard
  • 30,661
  • 4
  • 57
  • 106