Skip to content

Given any algebraic expression this Prolog code reduces it into it’s most simplified form.

Notifications You must be signed in to change notification settings

SJasoria/Reduce-Algebraic-Expressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Reduce-Algebraic-Expressions

Given any algebraic expression, this Prolog code reduces it into it’s most simplified form.

The query to simplify expressions can be invoked as:

simplify(InExpr, OutExpr).

Sample input/output:

?- simplify( ((x+x)/x)*(y+y-y), OutExpr).
OutExpr = 2*y

?- simplify( (x*(y/y)-x)*x , OutExpr).
OutExpr = 0

?- simplify( (a*b/1)*(c+1-c) , OutExpr).
OutExpr = a*b

?- simplify(4*a*2*b*3+ 24+a+15+d, OutExpr).
OutExpr = 39+a*b*24+a+d

?- simplify((a+a)/a+a*(a-a),OutExpr).
OutExpr = 2

?- simplify(3*(5/2)+b,OutExpr).
OutExpr = 7.5+b

About

Given any algebraic expression this Prolog code reduces it into it’s most simplified form.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages