Comments (2)
First off, this
nf = (r1 + r2 + length)/(r1 + r2 - length)
looks like a division by zero at all points. (Note that r1+r2==length
in your code.) You probably want to fix this first.
After that, you have multiple possibilities:
quadpy understands multidimensional integration limits, so something like
quadpy.line_segment.integrate_adaptive(
integrand,
[numpy.array([0.5, 1.0, 1.2]), numpy.array([-0.5, -1.0, 0.7])],
1e-10
)
is legal. Also, if you're just messing around with the distances to the lengths, you probably don't need to convert to 3D-space at all. Isn't
r1 = length * t
r2 = length * (1-t)
after all?
from quadpy.
In my original code the start point and end point inside the function are of another line (r
are the distances from the point in the line of integration to the tip points of another line). I messed that up when trying to isolate the error...
Doing as suggested, multidimensional limits, I've came up with a function that raises no error.
def integrand(t):
point = t.T # had to transpose
r1 = numpy.array( [linalg.norm(pt - p1) for pt in point] )
r2 = numpy.array( [linalg.norm(pt - p2) for pt in point] )
nf = (r1 + r2 + length)/(r1 + r2 - length)
return numpy.log(nf)*numpy.exp(-gamma)
val, err = quadpy.line_segment.integrate_adaptive(
integrand, [startPoint, endPoint], 1e-10)
Thank you for the help.
from quadpy.
Related Issues (20)
- ValueError: Need x21 < 0.3 (also why is the code encrypted?) HOT 8
- Problem with vectorization HOT 6
- 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.