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

Handle Mul instances in vector.cross #23750

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rho-novatron
Copy link

References to other Issues or PRs

Fixes #23749

Brief description of what is fixed or changed

Adds support for Mul instances as arguments to vector.cross.

Other comments

This probably should not be merged as is - FOR DISCUSSION!

Release Notes

@sympy-bot
Copy link

Hi, I am the SymPy bot (v167). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

❌ There was an issue with the release notes. Please do not close this pull request; instead edit the description after reading the guide on how to write release notes.

  • No release notes were found. Please edit the PR description and write the release notes under <!-- BEGIN RELEASE NOTES -->.
Click here to see the pull request description that was parsed.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
Fixes #23749 
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->


#### Brief description of what is fixed or changed
Adds support for Mul instances as arguments to vector.cross. 

#### Other comments
This probably should not be merged as is - FOR DISCUSSION!

#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers.

or if no release note(s) should be included use:

NO ENTRY

See https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more
information on how to write release notes. The bot will check your release
notes automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->

<!-- END RELEASE NOTES -->

@rho-novatron rho-novatron force-pushed the rho/fix-23749 branch 2 times, most recently from 082ea39 to 3b0fbce Compare July 9, 2022 16:46
@oscarbenjamin
Copy link
Contributor

Rather than special casing Mul in cross it would be better to fix it so that expand still gives a VectorMul. The problem is the Mul._eval_expand_mul method which is inherited by VectorMul from Mul. That method calls fraction:

n, d = fraction(expr)

The fraction function turns the VectorMul into a Mul for the numerator. Probably VectorMul should override the _eval_expand_mul method to something that separates the scalar part of the VectorMul and recursively calls expand on that.

@oscarbenjamin oscarbenjamin marked this pull request as draft November 24, 2022 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross product of vectors gives zero erroneously with expand(), but correct results without
3 participants