Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
trs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
trs
Commits
7e9c9993
Commit
7e9c9993
authored
12 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Relative precedences in strategy now support more than 2 functions in the same list.
parent
08c982bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/rules/precedences.py
+9
-1
9 additions, 1 deletion
src/rules/precedences.py
src/strategy.py
+3
-5
3 additions, 5 deletions
src/strategy.py
with
12 additions
and
6 deletions
src/rules/precedences.py
+
9
−
1
View file @
7e9c9993
...
...
@@ -7,12 +7,13 @@ from .logarithmic import factor_in_exponent_multiplicant, \
from
.derivatives
import
chain_rule
from
.negation
import
double_negation
,
negated_factor
,
negated_nominator
,
\
negated_denominator
,
negated_zero
from
.factors
import
expand_double
,
expand_single
from
.fractions
import
multiply_with_fraction
,
extract_fraction_terms
,
\
add_nominators
from
.integrals
import
factor_out_constant
,
integrate_variable_root
from
.powers
import
remove_power_of_one
from
.sqrt
import
quadrant_sqrt
,
extract_sqrt_mult_priority
from
.lineq
import
substitute_variable
,
swap_sides
from
.lineq
import
substitute_variable
,
swap_sides
,
divide_term
,
multiply_term
# Functions to move to the beginning of the possibilities list. Pairs of within
...
...
@@ -32,6 +33,9 @@ HIGH = [
LOW
=
[
factor_in_exponent_multiplicant
,
reduce_fraction_constants
,
# Sorting expression terms has a low priority because it is assumed to
# be handled by the user
move_constant
,
]
...
...
@@ -68,6 +72,10 @@ RELATIVE = [
# Prevent useless swapping when solving multiple equations
(
substitute_variable
,
swap_sides
),
# When solving of an equation with constants, expanding an equation has
# a lower priority
(
divide_term
,
multiply_term
,
swap_sides
,
expand_double
,
expand_single
),
]
...
...
This diff is collapsed.
Click to expand it.
src/strategy.py
+
3
−
5
View file @
7e9c9993
...
...
@@ -18,11 +18,9 @@ def compare_possibilities(a, b):
return
0
# Check if A and B have a precedence relative to eachother
if
(
ha
,
hb
)
in
RELATIVE
:
return
-
1
if
(
hb
,
ha
)
in
RELATIVE
:
return
1
for
rel
in
RELATIVE
:
if
ha
in
rel
and
hb
in
rel
:
return
cmp
(
rel
.
index
(
ha
),
rel
.
index
(
hb
))
# If A has a high priority, it might be moved to the start of the list
if
ha
in
HIGH
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment