Comments (6)
I have zeroed in on the first point where the integrate method fails. During the evaluation of the function I want to integrate, I compute a matrix. Let us say t is one of the arguments, a real number, but scheme.integrate passes an array of points of integration, let us say t = [t_0, ..., t_7]. Then I define matrix similar to
R = np.array([[1, 0, 0],
[0, np.cos(t), np.sin(t)],
[0, -np.sin(t), np.cos(t)]])
Now, since t is an array, not a real value as I intended, the final matrix is misshaped, we get
array([1, 0, 0],
[0, array([cos(t_0), ..., cos(t_7)]), array([sin(t_0), ..., sin(t_7)])],
...)
Since the function to integrate has many more terms like this, I wonder whether there is a method to fix this kind of problems efficiently.
Thank you!
from quadpy.
I get the error: ValueError: shapes (2,28) and (2,) not aligned: 28 (dim 1) != 2 (dim 0)
Well, the error is in your own code. The line
w = np.inner(v, np.array([1, 0]))
fails.
I don't understand your second post. You're wondering why quadpy gives you multiple input points?
from quadpy.
Thank you for replying. I also posted the question in stackoverflow; hopefully, it is more clear there. I'm not asking why quadpy gives multiple input points.
The function in my first post is f(x, y) = cos(y). The function works as expected if I pass [x_0, x_1], but I wanted to ilustrate the problems that may arise in the library. I admit that the example is artificial. I know that that line fails in quadpy, but it does not fail when you use the function as originally intended, with two real numbers.
In my second post I wrote a more realistic example. When I defined the function, I was thinking in a matrix with real valued entries (I didn't know I would use quadpy). Quadpy inputs a vector, so the matrix has mixed vector and real valued entries, and when I try to multiply this matrix with other marices or vectors, numpy does not know how to deal with the situation and throws errors. When I input a real value everything goes well.
I want to learn how I should define my functions so that they are compatible with quadpy. I have been able to integrate basic functions with quadpy, but when my functions entail matrices and operations on vectors, everything crashes For example, in my code, should I replace constant*vector by np.tensordot(constant, vector)? The problem is that quadpy replaces the constant by a vector, and the vector by an array of arrays.
I suppose that if I learn how to write vectorized versions of my functions, then the code will be more efficient.
from quadpy.
Perhaps this helps:
https://github.com/sigma-py/quadpy/wiki/Dimensionality-of-input-and-output-arrays
from quadpy.
Thank you! I will check next week.
from quadpy.
Closing for lack of feedback. Feel free to reopen at any time!
from quadpy.
Related Issues (20)
- ValueError: Need x21 < 0.3 (also why is the code encrypted?) HOT 8
- Quadpy usage HOT 1
- The source code is not available HOT 1
- Status of package and licensing HOT 4
- Quadpy is now asking for a sigma license HOT 18
- Can't import HOT 8
- Orthopy version no longer supported HOT 9
- version of orthopy no longer supported HOT 5
- Return points and values for integrate_adaptive HOT 1
- Importing quadpy causes python to quit without any error message HOT 4
- Issue upgrading quadpy HOT 7
- Unable to find valid license for Sigma. HOT 3
- Recurrent issue with sigma license HOT 5
- NameError: name 'c2' is not defined HOT 3
- Quadpy RuntimeError HOT 7
- Adaptive multivariate integration over hypercubes HOT 9
- Integrate over multiple limits at once using Quadpy HOT 8
- newest pip version not importable HOT 1
- the integrals with Heaviside function are very inaccurate HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quadpy.