Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the implementation of differentiation of Power #6

Open
Phryxia opened this issue Aug 18, 2021 · 0 comments
Open

Separate the implementation of differentiation of Power #6

Phryxia opened this issue Aug 18, 2021 · 0 comments
Assignees
Labels
bug Bug!!! implementation Related to new feature implementation

Comments

@Phryxia
Copy link
Owner

Phryxia commented Aug 18, 2021

Currently power differentiation assumes both base and exponent are always related to given variable. But this assumption is mathematically illegal.

After defining the expression x^x, it indicates that the function domain is only positive real numbers. Non integer exponent of negative number is not defined. In this assumption, I can perform implicit differentiation using logarithm.

But how about simple polynomial like x^n? Current implementation gives me this:

x^n * (0 * ln(x) + n * 1 / x)

Note that original domain is all real number. So you cannot use above method to this even simplified results are same. This can be more toxic when examining equivalence. x/x is different from 1 as the first one exclude zero from its domain but this power implementation spoils everything.

It's easy to extract the used variable list from any arbitrary expression. By doing it to both lvalue and rvalue, we can branch into three cases.

f(x) ^ g(x)

Current implementation already handle this well. It's result is

f(x) ^ g(x) * (g'(x) * ln(f(x)) + g(x) * f'(x) / f(x))

It's valid since it's domain condition is f(x) > 0.

f(x) ^ c

c * f'(x) * f(x) ^ (c - 1)

It's domain condition differs whether c is integer or not. If c is not integer, domain condition would be f(x) > 0 while the other is x can be any real number

c ^ f(x)

ln(c) * f'(x) * c ^ f(x)

It's domain condition is x is any real number. It doesn't make sense when c is negative.

Any plan for domain determination?

Well I'm interested a little bit, but that might be extremely challenging. Just handling one variable like x is simple. All you have to do is making interval into class, and do the 1D set operations on them.

But what if we have more than one variable? How should I represent any euclidean space in the computer?

One possible idea is return the set of predicates which are expressions themselves. For example, consider this expression:

(x+y) ^ (sin(x) * cos(y))

It's hard to express their domain explicitly. We may need lots of words like inifinite repetition... But I can give you following predicates:

x + y > 0 or (sin(x) * cos(y)) is integer

If someone need to examine any point is valid or not, they can put their value and compare it to zero. On the edge of the set it might be the problem- but why someone tries to evaluate open set's border in the fuzzy floating number world?

But I'm not sure this might be helpful for expected user of this program. So the priority of this topic should be low.

@Phryxia Phryxia added bug Bug!!! implementation Related to new feature implementation labels Aug 18, 2021
@Phryxia Phryxia added this to the math-parser 1.0.0 milestone Aug 18, 2021
@Phryxia Phryxia self-assigned this Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug!!! implementation Related to new feature implementation
Projects
None yet
Development

No branches or pull requests

1 participant