GithubHelp home page GithubHelp logo

Comments (5)

albop avatar albop commented on July 28, 2024 1

Here is a working version:

grid = np.linspace(0., np.pi, 10),
value = np.sin(grid[0])                   # a 1d array
xx = np.linspace(0.,np.pi,2)          # a 1d array
eval_linear(grid, value, xx[:,None]) # xx[:,None] is a 2x1 array

from interpolation.py.

albop avatar albop commented on July 28, 2024

In the example you give, grid is 1d so values should be représented by a 1d Vector. In your example it id a 2d Vector. Also, grid should be a tupe of 1d components.

from interpolation.py.

grburgess avatar grburgess commented on July 28, 2024

@albop here I will try a better example.

  1. the comma after the grid definition packs the grid in a tuple
grid = np.linspace(0., np.pi, 10),

value = np.sin(grid).reshape((1,10))

xx = np.linspace(0.,np.pi,2)

eval_linear(grid, value, np.atleast_1d(xx))

output:

array([0.00000000e+00, 3.42020143e-01, 6.42787610e-01, 8.66025404e-01,
       9.84807753e-01, 9.84807753e-01, 8.66025404e-01, 6.42787610e-01,
       3.42020143e-01, 1.22464680e-16])

It seems it only evals at the grid point and not the new points.

from interpolation.py.

albop avatar albop commented on July 28, 2024

from interpolation.py.

grburgess avatar grburgess commented on July 28, 2024

Thanks! Now I get the logic

from interpolation.py.

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.