Post Reply 
newRPL - build 1255 released! [updated to 1299]
01-25-2019, 03:25 PM
Post: #366
RE: newRPL - build 1089 released! [update:build 1157]
(01-25-2019 02:50 PM)The Shadow Wrote:  AUTOSIMPLIFY still doesn't turn 'X*X' to 'X^2', or 'X/X' to '1'. It does change 'X^2/X' to 'X', though, so that flag must be on. Are those flags somewhere in the menu system, btw? If not, how do we change them?

Well of course, I finished the engine, tested and released, but didn't get to review and update the AUTOSIMPLIFY rules to actually use the new features. As of right now, there's no rule that would match 'X*X', I did 'm*X+n*X' and 'X+m*X', but forgot to include the simplest case Smile
That's where I need help: to come up with the best rule set possible for all the different commands.
I want 'X/X' simplified to 1 but using attributes to only match real/complex variables that can't be zero. Same for 'X^m/X^n'.

(01-25-2019 02:50 PM)The Shadow Wrote:  'SQRT(X)' gets changed to 'X^(1/2)' but not back, as in the original set of rules. What rules does AUTOSIMPLIFY use now?

Below is what I have so far (pasted from the source code, it's plain RPL so there's nothing difficult).
Flags are as follows:
-70 (when set) disables all rule processing in AUTOSIMPLIFY (it still does only trivial numeric reductions like fraction additions, but no algebraic manipulation)
-71 to -78 (when set) disables rules in groups 1 through 8.

The 8 groups are as defined as per the comments in the source code:

Code:

@ THESE ARE RULES TO PREPARE THE EXPRESSIONS FORO SIMPLIFICATION

@#name lib56_autosimplify_pre
{
'-.vX:→(-1)*.vX'                                    @ REMOVE NEGATIVE SIGN FROM VARIABLES
'√.XX:→.XX^INV(2)'                                  @ ELIMINATE SQUARE ROOT FOR OTHER RULES TO WORK
}

@ GROUP 1 = USER DEFINED SIMPLIFICATION RULES

@#name lib56_autosimplify_group1
{

'AUTOSIMPLIFY.RULES'

}


@ GROUP 2 = BASIC (HARMLESS) SIMPLIFICATIONS

@#name lib56_autosimplify_group2
{
'0+.XX:→.XX'                                        @ REMOVE TERMS WITH ZERO
'INV(1):→1'                                         @ ELIMINATE OPERATION ON ONE
'INV(-1):→-1'                                       @ ELIMINATE OPERATION ON MINUS ONE
'1*.XX:→.XX'                                        @ REMOVE MULTIPLY BY ONE
'.XX^1:→.XX'                                        @ REMOVE EXPONENT OF 1
'.MN*.mX+.MM*.mX:→(.MN+.MM)*.mX'                    @ ASSOCIATE TO THE LEFT (NON-COMMUTATIVE)
'.MN*.mX+.mX:→(.MN+1)*.mX'                          @ ASSOCIATE TO THE LEFT (NON-COMMUTATIVE)
'.mX*.MN+.mX*.MM:→.mX*(.MN+.MM)'                    @ ASSOCIATE TO THE RIGHT (NON-COMMUTATIVE)
'.mX*.MN+.mX:→.mX*(.MN+1)'                          @ ASSOCIATE TO THE RIGHT (NON-COMMUTATIVE)
'.xX+.xX:→2*.xX'                                    @ ADD TERMS WITH NO NUMERIC FACTOR
'.NN*.xX^.Nexp+.NM*.xX^.Nexp:→(.NN+.NM)*.xX^.Nexp'  @ ADD TERMS IN THE SAME VARIABLE AS LONG AS THE REST IS NUMERIC
'.xX^.Nexp+.NM*.xX^.Nexp:→(1+.NM)*.xX^.Nexp'        @ ADD TERMS IN THE SAME VARIABLE AS LONG AS THE REST IS NUMERIC
}

@ GROUP 3 = CANCEL TERMS IN DIVISION (MAY REMOVE POLES)

@#name lib56_autosimplify_group3
{
'.xX^.NN*INV(.xX^.NM):→.xX^(.NN-.NM)'               @ CANCEL OUT TERMS WITH EXPONENTS
'.xX^.NN*INV(.xX):→.xX^(.NN-1)'                     @ CANCEL OUT TERMS WITHOUT EXPONENT IN DENOMINATOR
'.xX*INV(.xX^.NM):→.xX^(1-.NM)'                     @ CANCEL OUT TERMS WITHOUT EXPONENT IN NUMERATOR
'.xX^.NN*.xX^.NM:→.xX^(.NN+.NM)'                    @ ADD EXPONENTS IN MULTIPLYING TERMS
'.mX*.mX^.NM:→.mX^(1+.NM)'                          @ ADD EXPONENTS WITH IMPLICIT EXPONENT 1
}


@ GROUP 4 = CANCEL TERMS WITH VARIABLES (k*X-k*X) (INVALID WHEN k*X REACHES INFINITY, OK WHEN THEY ARE FINITE NUMBERS)

@#name lib56_autosimplify_group4
{
'0*.XX:→0'
}

@ GROUP 5 =

@#name lib56_autosimplify_group5
{


}

@ GROUP 6 =

@#name lib56_autosimplify_group6
{


}

@ GROUP 7 =

@#name lib56_autosimplify_group7
{


}

@ GROUP 8 =

@#name lib56_autosimplify_group8
{


}

@ THESE ARE RULES TO BEAUTIFY AN EXPRESSION AFTER ALL OTHER SIMPLIFICATIONS ARE DONE

@#name lib56_autosimplify_post
{
'(-1)*.xX:→-.xX'                                    @ REMOVE MINUS ONE MULTIPLICAND
'.XX^INV(2):→√.XX'                                  @ BACK TO SQUARE ROOTS
}
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 1089 released! [update:build 1157] - Claudio L. - 01-25-2019 03:25 PM
How to participate? - erazor - 12-13-2019, 07:12 AM



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