(48G, 50g) Define a new symbolic constant
|
09-14-2014, 09:24 PM
(This post was last modified: 09-14-2014 09:25 PM by ettlz.)
Post: #1
|
|||
|
|||
(48G, 50g) Define a new symbolic constant
This is a trick I've found to define a new symbolic constant (typically transcendental, or with no proof to the contrary) for use in algebraics; that is, the symbol is unchanged on EVAL but changes to its approximate value with →NUM. In this example, we define the Euler--Mascheroni constant gammaE = 0.577...
First, define the program SYMBCONST: Code: « → n x Now define gammaE: Code: « 'SYMBCONST(QUOTE(gammaE),\pi)' EVAL » To see this at work: Code: 'SIN(gammaE)' EVAL → 'SIN(gammaE)' This trick relies on →NUM changing the \pi to 3.14159265359 in the second argument to SYMBCONST; it holds no other special meaning. (A more elegant solution would be to find some way to hook →NUM.) More constants can be added with additional clauses in SYMBCONST's CASE. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)