Giter VIP home page Giter VIP logo

baryrat's People

Contributors

c-f-h avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

baryrat's Issues

How to derive rational approximation from BarycentricRational?

I'm trying to use BRASIL for function approximation with a fraction of polynomials.

Once I approximated a function and got a BarycentricRational object, how do I represent this object as a fraction of polynomials, e.g. (c0 + c1 * x + c2 * x^2) / (k0 + k1 * x + k2 * x^2)? How do I get c0, c1, c2, k0, k1, k2 from the barycentric representation?

BRASIL with mpmath function

Hello and thanks for making this package available! I get an error trying to use BRASIL with mpmath. This is my sample code:

from baryrat import brasil
import mpmath as mp

mp.dps = 150

r = brasil(lambda x: mp.sqrt(x), interval=[0.0, 1.0], deg=(7,7))

and the error:

TypeError: cannot create mpf from array([0.00273905, 0.02447174, 0.0669873 , 0.12842759, 0.20610737,
       0.29663168, 0.39604415, 0.5       , 0.60395585, 0.70336832,
       0.79389263, 0.87157241, 0.9330127 , 0.97552826, 0.99726095])

Is this not possible? Or am I doing something wrong?

Multivariate functions

Hello,

I'm trying to fit a multivariate function. While I've had success with PolyRat, implementing the resulting fit in embedded code is rather ... complex. (And using a rational function converted from that unfortunately fails hard in numerical instability.)

After some digging, it seems that the baricentric formulae used in BaryRat are much more friendly to have a go at, while still offering (hopefully) enough numerical stability.

Q: May I ask if it is possible to do such a thing with BaryRat? And if so, how?

Q: The function I'm working with takes 2 real-valued inputs, for one output. Could it perhaps be possible to treat the inputs as a complex number and fit that?

Thank you,
Tom

How to approximate a univariate complex function with a complex argument using BRASIL?

Hi,

I have attempted to approximate a univariate complex function with a complex argument using BRASIL. However, it appears that the BRASIL method does not support this type of approximation. Can you provide guidance on the implementation of this functionality? If so, I would be really happy to help and attempt to contribute a little something back to this nice project.

Received error when using brasil with deg = (m,n), m != n

Hello,

I want to generate rational approximation of degree (m,n) m!=n.

I invoke brasil with:
eps = np.finfo(np.double).eps
r = brasil(lambda x: x**args.alpha, (0, 1), (7,6), tol=eps, npi=-30, maxiter=10000)

where alpha is the fractional power.

I get the following error:

Traceback (most recent call last):
File "./python_code/./bura_mul_k1.py", line 20, in
r = brasil(lambda x: x**args.alpha, (0, 1), (m,n), tol=eps, npi=-30, maxiter=10000)
File "./python_code/baryrat.py", line 513, in brasil
n = 2 * deg + 1 # number of interpolation nodes
TypeError: can only concatenate tuple (not "int") to tuple

Best Regards,
Dimitar

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.