我有一个y值列表和一个x值列表。我想找到这些点定义的曲线下面积。我已经找到了几个解决这个问题的方法来解决x值均匀的问题:
1)Calculating the area under a curve given a set of coordinates, without knowing the function
2)Using scipy to perform discrete integration of the sample
但是当x值不均匀分布时,这些都不起作用。
例如:
>>> from scipy.integrate import simps
>>> y = np.array([1,1,1,1])
>>> x = np.array([0,5,20,30])
>>> simps(y,x)
-inf
当然,在上面的代码中使用x = np.array([0,10,20,30])会返回30.0,如预期的那样。
有人能建议一种方法来找到x间距不均匀的曲线下的区域吗?
答案 0 :(得分:0)
我只想一个简单的梯形法则:
java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException: ObjectIdentifier() -- data isn't an object ID (tag = -96)
at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(RSAKeyFactory.java:205) [?:?]
at java.security.KeyFactory.generatePublic(KeyFactory.java:334) [?:?]
at com.comarch.aif.proxy.processors.AuthorizeProcessor.getPublickey(AuthorizeProcessor.java:130) [30:aif-tdc-proxy:3.2.0.SNAPSHOT]
at com.comarch.aif.proxy.processors.AuthorizeProcessor.process(AuthorizeProcessor.java:58) [30:aif-tdc-proxy:3.2.0.SNAPSHOT]
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198) [89:org.apache.camel.camel-core:2.19.0]
at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:192) [95:org.apache.camel.camel-jetty-common:2.19.0]
at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:74) [94:org.apache.camel.camel-http-common:2.19.0]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [64:javax.servlet-api:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845) [270:org.eclipse.jetty.servlet:9.3.14.v20161028]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1712) [270:org.eclipse.jetty.servlet:9.3.14.v20161028]
at org.eclipse.jetty.servlets.MultiPartFilter.doFilter(MultiPartFilter.java:148) [271:org.eclipse.jetty.servlets:9.3.14.v20161028]
at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:43) [95:org.apache.camel.camel-jetty-common:2.19.0]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1699) [270:org.eclipse.jetty.servlet:9.3.14.v20161028]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) [270:org.eclipse.jetty.servlet:9.3.14.v20161028]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [270:org.eclipse.jetty.servlet:9.3.14.v20161028]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.server.Server.handle(Server.java:534) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [269:org.eclipse.jetty.server:9.3.14.v20161028]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) [261:org.eclipse.jetty.io:9.3.14.v20161028]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) [261:org.eclipse.jetty.io:9.3.14.v20161028]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [261:org.eclipse.jetty.io:9.3.14.v20161028]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [272:org.eclipse.jetty.util:9.3.14.v20161028]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [272:org.eclipse.jetty.util:9.3.14.v20161028]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [272:org.eclipse.jetty.util:9.3.14.v20161028]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [272:org.eclipse.jetty.util:9.3.14.v20161028]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [272:org.eclipse.jetty.util:9.3.14.v20161028]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.security.InvalidKeyException: IOException: ObjectIdentifier() -- data isn't an object ID (tag = -96)
at sun.security.x509.X509Key.decode(X509Key.java:397) ~[?:?]
at sun.security.x509.X509Key.decode(X509Key.java:402) ~[?:?]
at sun.security.rsa.RSAPublicKeyImpl.<init>(RSAPublicKeyImpl.java:86) ~[?:?]
at sun.security.rsa.RSAKeyFactory.generatePublic(RSAKeyFactory.java:298) ~[?:?]
at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(RSAKeyFactory.java:201) ~[?:?]
... 36 more
String publicKeyContent = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmBdtgPGgQq6i856pnvj6yl+5gHAhHCgsTsrrHR4L4rkwIXYLu/i6O6gBKS2JaQ0kmye05U6S6Qgavmeek7pVefuXB1rFLnGvZJRHCJhZlXJSI5xEYpCuq1bw97iN+B5aSqIPkfbBjcmSQ14Xcm0vFZ65JJA4DjZclbVFSJpxXB4rqN8Rar2C87vMm+8z9rQ9Jn6yGBaVpZ1RnY1GDEv7OfBVcfbtwNeqOV/Qlpb+9aQML7Wf3ZU0Fvqto+WkBjgqZWcoE1qgRWWnYRPyXWsJUQY2u0H8ZVxHJtuQNnQanMBnih1Mh2cjDQKrSxMT2s5C0f+gNhp+mi2jRb0IY/J1PwIDAQAB";