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

Add cancellation of common variables in 'simplify' #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

magistere
Copy link
Contributor

No description provided.

@ivarne
Copy link
Collaborator

ivarne commented Oct 15, 2013

These simplifications breaks matrix algebra.

@magistere
Copy link
Contributor Author

Ivar, I tested it only on simple expressions. Can you give some matrix example that breaks after this commit?

@ivarne
Copy link
Collaborator

ivarne commented Oct 17, 2013

If you have a matrix in the denumerator, you can not shorten it by this kind of simple elimination. Sometimes you will end up with an identity matrix eye(A), but in more complicated cases you will get a completely wrong answer. I am not sure if that is a common use case. We might have a setting in simplify to restrict to matrix safe operations.

@magistere
Copy link
Contributor Author

So this is because * means normal or matrix multiplication depending on argument types. It is not very convenient for symbolic computations, but cannot be changed. Another symbolic math software (Mathematica and Maple) use . (dot) for matrix multiplication. Making multiple dispatch to identify arguments with acceptable type will be not very helpful.
Let's wait for @johnmyleswhite comments on this issue.

@ivarne
Copy link
Collaborator

ivarne commented Oct 18, 2013

Yes, it is because (users of) julia does not follow its basic API design principle for \ and*. One function should only have one meaning and behave roughly the same way for different types. You could argue that it is concistent if users would use .* for all scalar operations, but I don't think that is the behavior we are seeing.

For simplify or simplify! I think that we must respect the design of the language and assume that \ and* refers to matrix operations and must adhere to matrix associativity rules.

@johnmyleswhite
Copy link
Collaborator

Because I'm traveling I won't have time to think a lot about this, but I had never intended for these symbolic operations to work on matrices, just real numbers. If we can make them more general, that would be great.

I think it would be very helpful to discuss this issue on the julia-users mailing list, specifically asking for feedback from Stefan, Viral, Steven Johnson and Alan Edelman.

@magistere
Copy link
Contributor Author

I think we should restrict to real numbers only.
Anyway now all functions in the package don't support matrix/vector arguments.
For example with matrices even diff(x_x, x) will be not 2_x, but (Mathematica code):

In[1]:= D[x.x, x]
Out[1]= 1.x + x.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants