{"id":18388544,"url":"https://github.com/jmcph4/gaisan","last_synced_at":"2025-04-12T04:25:28.355Z","repository":{"id":37999152,"uuid":"108397644","full_name":"jmcph4/gaisan","owner":"jmcph4","description":"Fast numerical methods in computational science","archived":false,"fork":false,"pushed_at":"2019-01-01T04:56:44.000Z","size":64,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T00:44:44.770Z","etag":null,"topics":["bisection","computational-science","euler","finite-difference","gaisan","gauss-elimination","gauss-jordan","gauss-seidel","golden-section-search","horner","ivp","monte-carlo","numerical-algorithms","numerical-analysis","numerical-integration","numerical-methods","numerical-optimization","ode","ode-solver","root-finding"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jmcph4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-26T10:35:19.000Z","updated_at":"2022-06-22T20:50:05.000Z","dependencies_parsed_at":"2022-09-19T17:30:37.766Z","dependency_job_id":null,"html_url":"https://github.com/jmcph4/gaisan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Fgaisan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Fgaisan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Fgaisan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jmcph4%2Fgaisan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jmcph4","download_url":"https://codeload.github.com/jmcph4/gaisan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248515413,"owners_count":21117171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bisection","computational-science","euler","finite-difference","gaisan","gauss-elimination","gauss-jordan","gauss-seidel","golden-section-search","horner","ivp","monte-carlo","numerical-algorithms","numerical-analysis","numerical-integration","numerical-methods","numerical-optimization","ode","ode-solver","root-finding"],"created_at":"2024-11-06T01:34:43.274Z","updated_at":"2025-04-12T04:25:28.325Z","avatar_url":"https://github.com/jmcph4.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gaisan  - fast numerical methods in computational science #\n---\n\nA C library of numerical methods in computational science, designed to be fast,\nfriendly, and accurate.\n\nSome methods Gaisan implements or plans to implement:\n\n- Finite difference\n    - Forward difference\n    - Backward difference\n    - Central difference\n- Rootfinding\n    - Bisection\n    - Fixed-point iteration\n    - Newton's method\n- Optimisation\n    - Golden section search\n    - Newton's method\n- Linear systems\n    - Gaussian elimination\n- IVPs\n    - Euler's method\n- BVPs\n    - Shooting method\n    - Finite difference\n- Monte Carlo methods\n    - Integration\n\n## Build ##\n\nTo build the library, simply\n\n    make\n\nTo generate documentation, run\n\n    make docs\n\nTo build the examples (in the `examples/` directory), run\n\n    make examples\n\n## Examples ##\nGaisan contains full, working examples in the `examples/` directory; however, here are some snippets:\n\n### Solve an IVP ###\nSolving IVPs is easy in Gaisan. Here's a trivial example using Euler's method:\n\n    long double f(long double t, long double y) {return t;}\n\n    /* ... */\n\n    /* solve y'=t from 0 to 10, with y(0)=1 (taking 1/2 steps) */\n    long double** solution = euler(0, 10, 1, \u0026f, 0.5);\n\nThat's it! Gaisan even provides convenient helper functions for working with numerical data. Let's print a table of values for our solution:\n\n    char* headings[3] = {\"t\", \"y\", NULL};\n    print_table(headings, solution, 20); /* print_table needs number of steps to print (i.e. 10*0.5=20) */    \n\nThis outputs:\n\n    |         t|      y(t)|\n    --------------------\n    |00.000000|01.000000|\n    |00.500000|01.250000|\n    |01.000000|01.750000|\n    |01.500000|02.500000|\n    |02.000000|03.500000|\n    |02.500000|04.750000|\n    |03.000000|06.250000|\n    |03.500000|08.000000|\n    |04.000000|10.000000|\n    |04.500000|12.250000|\n    |05.000000|14.750000|\n    |05.500000|17.500000|\n    |06.000000|20.500000|\n    |06.500000|23.750000|\n    |07.000000|27.250000|\n    |07.500000|31.000000|\n    |08.000000|35.000000|\n    |08.500000|39.250000|\n    |09.000000|43.750000|\n    |09.500000|48.500000|\n\n### Solve a linear system ###\nGaisan also makes solving linear systems a breeze. Once again, we use a naive method: Gaussian elimination.\n\nFirstly, we need to allocate space for our matrices:\n\n    Matrix* A = matrix_init(3, 3);\n    Matrix* b = matrix_init(3, 1);\n\nNote that this is equivalent to the following Matlab code:\n\n    A = zeros([3 3]);\n    b = zeros([3 1]);\n\nNow we need to populate our matrices with our coefficients and RHS solutions. In practice, this can be done more gracefully, but we'll hard code our values for now:\n\n    /* coefficient matrix */\n    A-\u003ecells[0][0] = 1.0;\n    A-\u003ecells[0][1] = 2.0;\n    A-\u003ecells[0][2] = -1.0;\n    A-\u003ecells[1][0] = 2.0;\n    A-\u003ecells[1][1] = 1.0;\n    A-\u003ecells[1][2] = -2.0;\n    A-\u003ecells[2][0] = -3.0;\n    A-\u003ecells[2][1] = 1.0;\n    A-\u003ecells[2][2] = 1.0;\n\n    /* RHS vector */\n    b-\u003ecells[0][0] = 3.0;\n    b-\u003ecells[1][0] = 3.0;\n    b-\u003ecells[2][0] = -6.0;\n\nNow for the actual solution:\n\n    Matrix* x = gauss_elim(A, b);\n\nThat's it!\n\nJust like our last example, Gaisan also provides (an even nicer) helper method for printing our data:\n\n    print_matrix(x);\n\nWhich outputs:\n\n     0.000000\n     3.000000\n    -3.000000\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcph4%2Fgaisan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjmcph4%2Fgaisan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjmcph4%2Fgaisan/lists"}