Giter Site home page Giter Site logo

kuanxu / framefuns.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juliaapproximation/framefun.jl

0.0 1.0 0.0 19.1 MB

Exploring practical possibilities of approximating functions with frames rather than with a basis

License: Other

Julia 100.00%

framefuns.jl's Introduction

Build Status Coverage Status

FrameFun

Exploring practical possibilities of approximating functions with frames rather than with a basis. The package is heavily inspired by the Chebfun project and the Julia package ApproxFun.

Frame Approximations in 1D

After choosing a suitable Basis and Domain, any function can be approximated in the resulting frame:

using BasisFunctions
using Plots
using FrameFun
B = FourierBasis(61, -1, 1)
D = Interval(-0.5,0.5)
f(x) = x
F = Fun(f,B,D)

plot(F,plot_ext=true); plot(F,f,plot_ext=true)

The bases support any AbstractFloat subtype, so high precision approximations are straightforward:

B = FourierBasis(61, -1, 1, BigFloat)
F = Fun(f,B,D)

plot(F,plot_ext=true); plot(F,f,plot_ext=true)

Frame Approximations in 2D

In higher dimensions, a basis can be any tensorproduct of (scaled) lower dimensional bases:

C = Disk(1.0)- Disk(0.3,[0.2; 0.5])
B = FourierBasis(31,-1.3,1.3)  FourierBasis(31,-1.3,1.3)
f(x,y) = exp(x+y)
F = Fun(f,B,C)

heatmap(F,plot_ext=true); plot(F,f,plot_ext=true)

Basis types can easily be mixed and matched, and domains can be arbitrarily complex:

dom = randomcircles(10)
B = FourierBasis(31)  ChebyshevBasis(31)
f(x,y) = cos(20*x+22*y)
F = Fun(f,B,dom)

heatmap(F,plot_ext=true), plot(F,f,plot_ext=true)

Even fractal domains are not a problem:

B = FourierBasis(31,-1.0,0.35)  FourierBasis(31,-0.65,0.65)
f(x,y) = cos(10*x*y)
F = Fun(f, B, Mandelbrot())

heatmap(F,plot_ext=true), plot(F,f,ext=true)

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.