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

Too many subscripts for einstein sum #164

Closed
e-eight opened this issue Aug 8, 2018 · 6 comments
Closed

Too many subscripts for einstein sum #164

e-eight opened this issue Aug 8, 2018 · 6 comments

Comments

@e-eight
Copy link

e-eight commented Aug 8, 2018

Hi Nico,

I wanted to use quadpy for my integrations. I tried the line_integral example given in the readme. It gives me a ValueError: einstein sum subscripts string contains too many subscripts for operand 0.
I am not sure what is going wrong. Any ideas?

Thanks.

@nschloe
Copy link
Collaborator

nschloe commented Aug 8, 2018

I'm guessing your function spits out the wrong data shape. Can you provide a minimal example?

@e-eight
Copy link
Author

e-eight commented Aug 8, 2018

It is literally the line_segment example in the readme file.

val = qp.line_segment.integrate(lambda x: np.exp(x), [0.0, 1.0], qp.line_segment.GaussPatterson(5))

@nschloe
Copy link
Collaborator

nschloe commented Aug 8, 2018

Cannot reproduce. This

import quadpy
import numpy as np

val = quadpy.line_segment.integrate(
    lambda x: np.exp(x),
    [0.0, 1.0],
    quadpy.line_segment.GaussPatterson(5)
    )

print(val)

gives

1.7182818284588917

on my machine. (The exact value is exp(1) - exp(0) which is approximately 1.718281828459045, so this is correct.)

@e-eight
Copy link
Author

e-eight commented Aug 8, 2018

I see. This is the error that I am getting.
1533740552

@nschloe
Copy link
Collaborator

nschloe commented Aug 8, 2018

Looks very much like an error in your numpy installation.

@nschloe nschloe closed this as completed Aug 8, 2018
@e-eight
Copy link
Author

e-eight commented Aug 8, 2018

Edit: Tried it again after restarting ipython. And it worked this time. Got the same answer as you. Possibly some numpy issue. Thanks for looking in to it.

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

No branches or pull requests

2 participants