Code Monkey home page Code Monkey logo

cascade's Introduction

Cascade - The C Library for Approximative Solutions to Complex Arbitrary Precision Differential Equations

Welcome to Cascade v2.1. Cascade is a library designed to store and solve differential equations to arbitrary precision. This is accomplished through the use of Arblib's acb_t data type, which uses ball arithmetic to store arbitrary precision floating point numbers with error bounds. Solutions are computed as power series expansions about the origin using a recursion relation between the coefficients. With the help of analytic continuation this can be turned into a solution anywhere in the complex plane.

For a similar library using p-adic arithmetic, see Implode.

Author: Matthias Gessinger

Installation

This library can be build from source as a shared object library through CMake. For a default installation, run the following commands:

mkdir build
cd build
make
make test

If all tests pass, finally install the library by running

sudo make install

Examples

#include <acb_poly.h>
#include <cascade.h>

int main ()
{
    acb_t z;
    acb_poly_t pol;
    acb_ode_t ODE;

    acb_init(z);
    acb_poly_init(pol);
    acb_ode_legendre(ODE, 4);

    acb_set_d(z, 0.375);
    acb_poly_set_coeff_acb(pol, 0, z);
    acb_ode_solve_fuchs(pol, ODE, 5, 1024);
    acb_ode_dump(ODE, NULL);
    acb_poly_printd(pol, 10);

    acb_clear(z);
    acb_poly_clear(pol);
    acb_ode_clear(ODE);
    flint_cleanup();
    return 0;
}

To compile the program, run

gcc test.c -lcascade -larb -lflint

The output of time ./a.out should then look something like this:

Order: 2
Degree: 2
diff_eq_poly(ODE,0) = (20 + 0j)  +/-  (0, 0j)	(0 + 0j)  +/-  (0, 0j)	(0 + 0j)  +/-  (0, 0j)
diff_eq_poly(ODE,1) = (0 + 0j)  +/-  (0, 0j)	(-2 + 0j)  +/-  (0, 0j)	(0 + 0j)  +/-  (0, 0j)
diff_eq_poly(ODE,2) = (1 + 0j)  +/-  (0, 0j)	(0 + 0j)  +/-  (0, 0j)	(-1 + 0j)  +/-  (0, 0j)

Solution:
[(0.375 + 0j)  +/-  (0, 0j)
(0 + 0j)  +/-  (0, 0j)
(-3.75 + 0j)  +/-  (2.8e-308, 0j)
(0 + 0j)  +/-  (0, 0j)
(4.375 + 0j)  +/-  (3.26e-313, 0j)]
real	0m0,009s
user	0m0,005s
sys	0m0,005s

Memory management

Because Arb caches some constants internally, it is recommended to call flint_cleanup() at the end of your main program. This will clear Arb's internal cache and guarantee a clean output of Valgrind.

Dependencies

Cascade uses Arb to store complex numbers and Flint to handle memory management. Therefore both of these libraries have to be installed in order to build Cascade, and also to build programs using Cascade!

cascade's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

ericqg

cascade's Issues

Dependent libraries are found, but not their associated include files

Currently, CMake's find_library is used to find dependent libraries, but this does not find the paths to the dependent include files (for instance arb.h). Nominally, one would want to use find_package, but the arb package does not come with a FindXXX.cmake file, so that won't work. The reason I mention this is that on macOS, I installed all of the dependent libraries into /opt, and the libraries were found there, but compilations failed because the necessary header files were not found. This can be worked around by specifying -DCMAKE_C_FLAGS="-I/opt/include" (in my case), when invoking cmake.

There is the possibility of using CMake's find_path to get the location of certain header files that are necessary. I suspect there is only a handful that would need this treatment.

There is also the option of using pkg_config (via the cmake built-in module FindPkgConfig.cmake), but only GMP and MPFR (either used directly or indirectly) have .pc files. Perhaps an issue should be filed with the maintainers of Cascade's dependent libraries to get this functionality.

Error bounds are not tight

Currently error bounds on the series expansion are computed rather mindlessly. Especially dependence on the number of coefficients in the power series expansion should be determined.

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.