Giter Club home page Giter Club logo

Comments (13)

nschloe avatar nschloe commented on May 23, 2024

I can't really follow here. What's the integral that you would like to compute?

from quadpy.

GProtoZeroW avatar GProtoZeroW commented on May 23, 2024

The one-sided laplace transform on $f(t)$ where f is given for exsample by the sequence
f=np.linspace(0,5, 150)

from quadpy.

nschloe avatar nschloe commented on May 23, 2024

But f is a function in the Laplace transform, not a vector.

from quadpy.

GProtoZeroW avatar GProtoZeroW commented on May 23, 2024

I am saying f is a 1D vector in the in terms of numpy terminology. For the example, it would be the numerical values of $f=ax+b$ but it could be the discrete values of any one-dimensional function that is needing to be transformed. The reason I need Laplace is that the Fourier transform only shows the harmonics that make up the function, not any exponential growth or damping that occurs in most systems

from quadpy.

nschloe avatar nschloe commented on May 23, 2024

Alright, so you have a one dimensional function f that you can evaluate everywhere on (0, infty) and you'd like to compute the integral

I(s) = int_0^infty exp(-s*t) f(t) dt

Correct?

In this case, you'll need Gauss-Laguerre. First transform your integral into the form

I(s) = int_0^infty exp(-x) s f(x/s) dx

so you'll need to plug lambda x: s * f(x/s) into Gauss-Laguerre.

from quadpy.

GProtoZeroW avatar GProtoZeroW commented on May 23, 2024

Correct and where 90% there. But I want to avoid using a fitting, spline or otherwise, of f from the data because it still has noise in it and I want to try to use the moment generating property of the Laplace transform to find the mean in the noise. So let's do for example

import numpy as np
f=np.linspace(0,5,150)
f=f+np.exp(.001*np.arange(len(f)))
f=f+np.random.normal(-0.001, .01, len(f))

Also what is s supposed to be declared as. I tired using a 1D version of your f(x) from you doc page in the above and it errored

import numpy 
import quadpy

def f(x):
    return numpy.sin(x[0])

val = quadpy.e1r.integrate(
    lambda x: s*f(x/s),
    quadpy.e1r.GaussLaguerre(5, alpha=0)
    )
val

I am also just going to ask this because it would seriously help your docs. Can you put the LaTeX nonquad integral above each of the examples in your docs that the quad is attempting to perform? Cause seriously you have a library here that beats scipy's integral functions but just this little fix in the docs would take this library main stream like it should be.

from quadpy.

nschloe avatar nschloe commented on May 23, 2024

I would think quadpy is the wrong tool for the task then. quadpy only does one thing: It computes numerical approximations of integrals of given functions. If you cannot evaluate your function everywhere, you'll need to use your own approach.

from quadpy.

GProtoZeroW avatar GProtoZeroW commented on May 23, 2024

So what you're saying is that I would have to use a high fitting spline or otherwise on the data to then feed into quadpy, but again what is s.

from quadpy.

nschloe avatar nschloe commented on May 23, 2024

I would have to use a high fitting spline

Spline or something else, quadpy needs a function that can be evaluated everywhere in the domain.

but again what is s.

https://en.wikipedia.org/wiki/Laplace_transform#Bilateral_Laplace_transform

from quadpy.

GProtoZeroW avatar GProtoZeroW commented on May 23, 2024

I know what $s$ is in many a mathematical and physical context see for ex Laplace Transform Explained and Visualized Intuitively
by Physics Videos by Eugene Khutoryansky.
But in the code to use GaussLaguerre what would it be.

Seriously let's get this working because there is not a good numerical Laplace transform but for Signals and Systems, its used all the time analytically. So I still think quadpy can do this and doing this would be a major power boost to python over matlab.

from quadpy.

nschloe avatar nschloe commented on May 23, 2024

But in the code to use GaussLaguerre what would it be.

s is just the variable in the Laplace transform, right? You get to pick it, and the integral is the value of the transform at this particular s.

from quadpy.

GProtoZeroW avatar GProtoZeroW commented on May 23, 2024

yes and I would then sup in s=sigma+1j*omega where I then would insert values for sigma and omega from numpys meshgrid to then get a nice plot of how the system from the data would then respond to an input in each quadrant and near poles and zeros, ect ect. but give me a concrete example code because im an idiot, for example, do I use

from sympy import *
s=symbols('s')

for s in the code

import numpy 
import quadpy

def f(x):
    return numpy.sin(x[0])

#what is `s` here

val = quadpy.e1r.integrate(
    lambda x: s*f(x/s),
    quadpy.e1r.GaussLaguerre(5, alpha=0)
    )
val

besoue if i try running this without defining what sis i get

NameError: name 's' is not defined

from quadpy.

nschloe avatar nschloe commented on May 23, 2024

but give me a concrete example code

Simply check out the main readme:
https://github.com/nschloe/quadpy#1d-half-space-with-weight-function-exp-r. It doesn't get more concrete than that.

#what is s here

I'd start with any value that you're interested in. If that works for you, you can either loop over all s that you want, or put in a vector of those to integrate them all at once.

from quadpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.