Post Reply 
newRPL - build 1255 released! [updated to 1299]
07-30-2019, 05:14 PM
Post: #538
RE: newRPL - build 1255 released! [updated to 1282]
(07-30-2019 03:12 PM)JoJo1973 Wrote:  
(07-30-2019 02:35 PM)Claudio L. Wrote:  I'd like to open a discussion here:

What would be a good syntax for ASSUME?

The way it used to be, the old CAS would store information in the current directory. Now that information is included within the symbolic expression (see the wiki on symbolic expressions). Now we need a "simple" syntax so the user can make all occurrences of a variable within an expression have the same assumptions (the 3-digit numeric code).
Something along the lines of:
'X^2+4' 6 'X' ASSUME

Which would make 'X' in the expression known to be a matrix (numeric code 6). But... is there a way to do it without forcing the user to remember those cryptic codes?
Right now the user can type the equation with the codes in it as subscripts, but I'd like to be able to change it after the fact.
I know, this would be ideal for the equation writer: just select the variable and a couple of check boxes appear where you select the type and be done, but that is "in planning stages" still.

What could be a good syntax instead of numeric code?

First, a list of mnemonics, short and easy to memorize, e.g.

Type: "R." Real and finite; "C∞" complex and infinite, etc.
Sign: "≥0", "≠0", etc.
Parity: "OD", "EV"

plus standard codes for "Any" and "Unknown" ("*" and "?", perhaps?)

Then you can collect these mnemonics in a list or a string with separators.

Empty list or string clears assumptions.

Of course there should be a command that given a variable lists its assumptions.

I like it, let's say we use a string because it's easier to compare.
The string could be:
1 character for type (and parity): "R"=real, "I","O","E"=Integer/Odd/Even, "C"=complex, "M"=matrix, "?"=unknown (internal), "*"= No information given about this variable, it would remove all assumptions on the variable.
1 (optional) character for infinity bit: "∞" is present only if the variable can be infinite or NaN, otherwise is known to be finite.
2 (optional) characters related to sign: "≥0", "≠0", etc.

Noticed I merged the parity with the type information to make it more readable: A positive integer would be:
"I>0" (being an integer already implies it's a real number, so no need for a separate letter).
"C∞≠0" (a complex number that can be infinite but is known not to be zero)
"*" (clear all assumptions about this variable)
"E∞≥0" (a positive even integer, counting from zero all the way up to infinity)

I think this will work!
Commands needed:
ASSUME to apply this to a variable in an expression
ASSGET to extract the assumptions made for a certain variable within an expression.
ASSCOMB to get the combined assumptions for a whole expression
ASSCMP to compare if a given assumption meets certain other assumptions (using the fancy text string).

For example you could do 'X^2' ASSCOMB (combine assumptions) and should return "R≥0" if X has default assumptions (when complex mode is disabled, default assumption is that variables are real and finite).
Then you could also check that result against some restrictions:
"R≥0" "R" ASSCMP would return true, since a real >=0 meets the minimum requirement of being a real.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: newRPL - build 1001 released! - pier4r - 12-16-2017, 08:03 AM
newRPL - on Hp 39gs - Martin Hepperle - 06-05-2019, 06:51 AM
RE: newRPL - build 1001 released! - pier4r - 12-23-2017, 10:16 AM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 09:42 AM
t - Claudio L. - 01-01-2018, 03:06 PM
RE: newRPL - build 1001 released! - pier4r - 01-01-2018, 03:41 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 04:54 PM
RE: newRPL - build 1001 released! - pier4r - 01-02-2018, 06:58 PM
newRPL - brickviking - 10-05-2018, 06:01 AM
RE: newRPL - build 1255 released! [updated to 1282] - Claudio L. - 07-30-2019 05:14 PM
How to participate? - erazor - 12-13-2019, 07:12 AM

User(s) browsing this thread: 1 Guest(s)