summaryrefslogtreecommitdiff
path: root/rules.txt
diff options
context:
space:
mode:
Diffstat (limited to 'rules.txt')
-rw-r--r--rules.txt96
1 files changed, 96 insertions, 0 deletions
diff --git a/rules.txt b/rules.txt
new file mode 100644
index 0000000..aa1f44d
--- /dev/null
+++ b/rules.txt
@@ -0,0 +1,96 @@
+## general
+#+ to_internal
+#+ fraction_identities
+#+ identities
+#+ uncollect_sums
+#+ differentiation
+#+ sanitise_epowers
+
+
+## display
+#+ to_display
+#+ fraction_identities
+#+ collect
+#+ identities
+
+
+## general_display
+#+ general
+#+ display
+
+
+## sanitise
+#+ sanitise_epowers
+#+ collect_numbers
+
+
+## collect
+Sum [{{x}},{{x}},{rest}] | Sum [Product [Number 2,{x}],{rest}]
+Sum [{{x}},Product [{{n:Number}},{x}],{rest}] | Sum [Product [Sum [Number 1,{n}],{x}],{rest}]
+Sum [Product [{{n1:Number}},{x}],Product [{{n2:Number}},{x}],{rest}] | Sum [Product [Sum [{n1},{n2}],{x}],{rest}]
+
+Product [{{x}},{{x}},{rest}] | Product [:pow:[{x},Number 2],{rest}]
+Product [{{x}},:pow:[{{x}},{{n}}],{rest}] | Product [:pow:[{x},Sum [{n},Number 1]],{rest}]
+Product [:pow:[{x},{a}],:pow:[{x},{b}],{rest}] | Product [:pow:[{x},Sum [{a},{b}]],{rest}]
+
+
+## uncollect_sums
+Product [Sum [{{a}},{rest}],{prod}] | Sum [Product [{a},{prod}],Product [{rest},{prod}]]
+
+
+## identities
+:pow:[:pow:[{{x}},{{n}}],{{m}}] | :pow:[{x},Product [{n},{m}]]
+:pow:[{{x}},Number 1] | {x}
+
+-- Guarding necessary for x != 0
+:pow:[{x},Number 0] | Number 1
+
+Product [Number 0,{rest}] | Number 0
+Product [Number 1,{rest}] | {rest}
+
+
+## fraction_identities
+Reciprocal (Product [Reciprocal {{x}},{rest}]) | Product [{x},Reciprocal {rest}]
+Product [{{x}},Reciprocal {{x}},{rest}] | {rest}
+Product [{{x}},Reciprocal (Product [{{x}},{rrest}]),{rest}] | Product [{rest},Reciprocal {rrest}]
+
+
+## to_internal
+Reciprocal {a} | :pow:[{a},Number (-1)]
+Negative {a} | Product [Number (-1),{a}]
+:pow:[Product [{{a}},{b}],{exp}] | Product [:pow:[{a},{exp}],:pow:[{b},{exp}]]
+:tan:[{x}] | Product [:sin:[{x}],Reciprocal (:cos:[{x}])]
+
+
+## differentiation
+:d:[{{n:Number}},{x}] | Number 0
+:d:[{{x:Variable}},{{x}}] | Number 1
+:d:[Sum [{{a}},{b}],{{x}}] | Sum [:d:[{a},{x}],:d:[{b},{x}]]
+:d:[Product [{{n:Number}},{a}],{x}] | Product [{n},:d:[{a},{x}]]
+:d:[Product [{{a}},{b}],{x}] | Sum [Product [:d:[{a},{x}],{b}],Product [{a},:d:[{b},{x}]]]
+:d:[:pow:[Variable "E",{ex}],{x}] | Product [:pow:[Variable "E",{ex}],:d:[{ex},{x}]]
+
+-- Guarding probably necessary for a != E
+-- Cannot be generally applied, because {a} may be negative; for differentiation, however, that doesn't matter
+-- :d:[:pow:[{a},{b}],{x}] | :d:[:pow:[Variable "E",Product [{b},:ln:[{a}]]],{x}]
+:d:[:pow:[{a},{b}],{x}] | Product [:pow:[{a},{b}],:d:[Product[{b},:ln:[{a}]],{x}]]
+
+:d:[:ln:[{args}],{x}] | Product [Reciprocal {args},:d:[{args},{x}]]
+:d:[:sin:[{a}],{x}] | Product [:cos:[{a}],:d:[{a},{x}]]
+:d:[:cos:[{a}],{x}] | Product [Number (-1),:sin:[{a}],:d:[{a},{x}]]
+
+
+## sanitise_epowers
+:pow:[Variable "E",:ln:[{arg}]] | {arg}
+:pow:[Variable "E",Product [:ln:[{arg}],{rest}]] | :pow:[{arg},{rest}]
+
+
+## collect_numbers
+Sum [Product [{{n1:Number}},{x}],Product [{{n2:Number}},{x}],{rest}] | Sum [Product [Sum [{n1},{n2}],{x}],{rest}]
+
+
+## to_display
+:pow:[Variable "E",:ln:[{arg}]] | {arg}
+:pow:[Variable "E",Product [:ln:[{arg}],{rest}]] | :pow:[{arg},{rest}]
+:pow:[{x},Number (-1)] | Reciprocal {x}
+Product [:sin:[{x}],Reciprocal (:cos:[{x}]),{rest}] | Product [:tan:[{x}],{rest}]