Skip to content

Eliminate special cases from update_and_substitute#138

Merged
utensil merged 1 commit intopygae:masterfrom
eric-wieser:use-tables-for-scalars
Dec 6, 2019
Merged

Eliminate special cases from update_and_substitute#138
utensil merged 1 commit intopygae:masterfrom
eric-wieser:use-tables-for-scalars

Conversation

@eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Dec 5, 2019

The tables now contain scalars, so this should work for all cases

Split from #134


Consequence:

image

@eric-wieser
Copy link
Member Author

eric-wieser commented Dec 5, 2019

Bug fix!

image

- B**2 = 3*(X.Y)**2 - 2*(X.Y)*(X.e)*(Y.e) + 2*(X.Y)*(X.e)*Y^e - 2*(X.Y)*(X.e)*((Y.e) + Y^e) - 2*(X.Y)*(Y.e)*X^e + 2*(X.Y)*(Y.e)*((X.e) + X^e) + 2*(X.Y)*X^Y - 2*(X.Y)*((X.Y) + X^Y)
+ B**2 = (X.Y)**2 - 2*(X.Y)*(X.e)*(Y.e)

Way simpler result now, and I'm fairly sure it's correct

@eric-wieser eric-wieser force-pushed the use-tables-for-scalars branch from 1a4b6a6 to 3116778 Compare December 5, 2019 10:53
Comment on lines 133 to 139
"B = \u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m - (\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m + (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m\n",
"B**2 = 3*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m) + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*((\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m) + \u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m) - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*((\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m) + \u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m) + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) + \u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m)\n",
"B**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n",
"#L = X^Y^e is a non-euclidian line\n",
"B = L*e = \u001b[0;34mX\u001b[0m^\u001b[0;34mY\u001b[0m - (\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mX\u001b[0m^\u001b[0;34me\u001b[0m + (\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*\u001b[0;34mY\u001b[0m^\u001b[0;34me\u001b[0m\n",
"B*e*B.rev() = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(-(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) + 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))*\u001b[0;34me\u001b[0m\n",
"B**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*((\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m) - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m))\n",
"B**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n",
"L**2 = (\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)**2 - 2*(\u001b[0;34mX\u001b[0m.\u001b[0;34mY\u001b[0m)*(\u001b[0;34mX\u001b[0m.\u001b[0;34me\u001b[0m)*(\u001b[0;34mY\u001b[0m.\u001b[0;34me\u001b[0m)\n",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines from from:

https://github.com/meuns/galgebra/blob/4689050ca063c93858a4d47f04eee934cb39c98d/examples/Terminal/terminal_check.py#L181-L193

Note that the two B**2 printouts now match, rather than being different :)

assert str(B) == 'X^Y - (Y.e)*X^e + (X.e)*Y^e'
Bsq = B*B
assert str(Bsq) == '(X.Y)*((X.Y) - 2*(X.e)*(Y.e))'
assert str(Bsq) == '(X.Y)**2 - 2*(X.Y)*(X.e)*(Y.e)'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a harmless change that the parentheses end up expanded now.

The tables now contain scalars, so this should work for all cases

Note that as a result of this, some multiplications now end up slightly more expanded
@eric-wieser eric-wieser force-pushed the use-tables-for-scalars branch from 3116778 to 1b92992 Compare December 5, 2019 11:04
@codecov
Copy link

codecov bot commented Dec 5, 2019

Codecov Report

Merging #138 into master will decrease coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #138      +/-   ##
==========================================
- Coverage   67.66%   67.53%   -0.14%     
==========================================
  Files           8        8              
  Lines        4803     4796       -7     
==========================================
- Hits         3250     3239      -11     
- Misses       1553     1557       +4
Impacted Files Coverage Δ
galgebra/ga.py 75.04% <100%> (-0.16%) ⬇️
galgebra/mv.py 62.91% <0%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 786af26...1b92992. Read the comment docs.

Copy link
Member

@utensil utensil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐛 fixed!

@utensil utensil merged commit 1ea8eea into pygae:master Dec 6, 2019
@eric-wieser
Copy link
Member Author

Your rebased messed up my base-juggling strategy in the other pr... Will rebase that one instead.

@eric-wieser eric-wieser deleted the use-tables-for-scalars branch December 8, 2019 10:56
@utensil utensil added this to the 0.4.5 milestone Dec 18, 2019
@eric-wieser eric-wieser added the component: core Ga, Mv, Metric, etc label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: core Ga, Mv, Metric, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants