Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Absolute value of unknowns (in equations) #49

Open
evykassirer opened this issue Dec 14, 2016 · 2 comments
Open

Absolute value of unknowns (in equations) #49

evykassirer opened this issue Dec 14, 2016 · 2 comments

Comments

@evykassirer
Copy link
Contributor

evykassirer commented Dec 14, 2016

This is blocked on #128 (new parser) because we need to support multiple equations.

e.g. |x| + 3 = 4 can solve for x by separating it into x + 3 = 4 and -x + 3 = 4

to support these, we'd also have to support multiple equations (related issue: #48)

@hmaurer
Copy link
Contributor

hmaurer commented Jan 20, 2017

Mmh that's quite interesting in terms of pedagogy. I haven't really thought about it but at first it seems we could have a sort-of tree structure for equations with "AND" and "OR" nodes, and operate on that tree in steps in the same way you currently operate on expression trees.

For example, starting from a single root node |x| + 3 = 4, we would transform it to an "OR" node with left branch x + 3 = 4 and right branch -x + 3 = 4.

You could also imagine a slightly more complex example. Say we start with the system

|x| = 3
x >= 0

The initial tree structure would be

AND(|x| = 3, x >= 0)

The first step would deal with the absolute value and we would get

AND(
  OR(x = 3, -x = 3),
  x >= 0
)

then we could distribute the conjunction over the disjunction to get

OR(
  AND(x = 3, x >= 0),
  AND(-x = 3, x >= 0),
)

We would then eliminate the right branch of the "OR" node because -x = 3 and x >= 0 are not satisfiable, and somehow contract x = 3 and x >= 0 (since they contain redundant information) to the single equation x = 3.

In a short example like this it seems it would work and be easy to follow, but in this specific case the reasoning "x >= 0 so I can just remove the absolute value" would also be correct (and shorter).

What do you think?

@evykassirer
Copy link
Contributor Author

I hadn't thought about it much yet, but that sounds quite reasonable! Since this will be a pretty big decision, I think it's worth doing research into what other CAS do as well.

@aelnaiem aelnaiem added this to the Full Absolute support milestone Mar 30, 2017
@aelnaiem aelnaiem removed this from the Absolute value support milestone Mar 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants