{"id":19982612,"url":"https://github.com/pierre-fromager/surfaces","last_synced_at":"2025-03-01T20:13:05.813Z","repository":{"id":79268679,"uuid":"415861009","full_name":"pierre-fromager/surfaces","owner":"pierre-fromager","description":"Polynomial surface","archived":false,"fork":false,"pushed_at":"2021-11-20T21:11:20.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T10:48:28.237Z","etag":null,"topics":["integration","polynomial","surface"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pierre-fromager.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-11T09:32:09.000Z","updated_at":"2021-12-08T22:39:03.000Z","dependencies_parsed_at":"2023-03-12T07:30:55.524Z","dependency_job_id":null,"html_url":"https://github.com/pierre-fromager/surfaces","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierre-fromager%2Fsurfaces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierre-fromager%2Fsurfaces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierre-fromager%2Fsurfaces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pierre-fromager%2Fsurfaces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pierre-fromager","download_url":"https://codeload.github.com/pierre-fromager/surfaces/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241418356,"owners_count":19959736,"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":["integration","polynomial","surface"],"created_at":"2024-11-13T04:12:20.280Z","updated_at":"2025-03-01T20:13:05.789Z","avatar_url":"https://github.com/pierre-fromager.png","language":"C","readme":"# Polynomial surface\n\nThe idea first is to compute integral.  \nIt is also by extension a lib(libpolysurf) with many others features :\n* Sign study\n* Roots finder\n* Intersection\n* ...\n  \n## Requirements\n\n* [gmp](https://gmplib.org/)\n* [mpfr](https://www.mpfr.org/)\n* [CUnity/Cunit](https://gitlab.com/cunity/cunit)\n\n## Releases\n* v1.0 : Highest tested order 48.\n* v2.0 : Highest tested order gmp(mpz_t) 4096.\n* v2.1.0 (prerelease) : Highest tested order mpfr(mpfr_t).\n\n## Build\nall\n``` \n./build.sh\n```\nbuild\n``` \nmake\n```\nclean\n``` \nmake clean\n```\n\n## Doc\nGenerate to doc/html folder.\n``` \nmake doc\n```\n\n## Usage surfaces\nOverview\n``` \n./surfaces \n```\nDetail\n```\n./surfaces -?\n```\nDefault interval [0..5]\n```\n./surfaces 3+x+2x^3\n```\nCustom interval [0..10] by short options\n```\n./surfaces -l0 -h10 3+x+2x^3\n```\nCustom interval [-10..10] by long options\n```\n./surfaces --low=-10 --high=10 3+x+2x^3\n```\nCustom interval [-10..10] with ratios by short options\n```\n./surfaces -l-10 -h10 1/3+2/3x+2/5x^3\n```\nSame as previous with raw result output\n```\n./surfaces -v0 -l-10 -h10 1/3+2/3x+2/5x^3\n```\nNote on multiple precision (max order \u003e 48) you can change :\n* AP engine (0 for gmp int or 1 for mpfr float) with -e option\n* Precision with -p option\n\nYou can display the raw result with -v0 option.  \nTypically messed up with exp greater than POLY_MAX_ORDER leading to buffer overflow\n```\n./surfaces -l-10 -h10 3+4x^2+x^16384\nmunmap_chunk(): invalid pointer\nAbandon\n```\nor for french people\n```\n./surfaces -l-10 -h10 3+4x^2+x^16384\nException en point flottant\n```\n\nChange related define in main to allow higher exp.  \n\n## Performance\nRead [Security-related flags and options for C compilers](https://airbus-seclab.github.io/c-compiler-security/) to know more.  \n\nIf you activate the sanitizer options on compiler for debug purpose you will see some LeakSanitizer errors, it's a false positive because gmp lib allocation/free process is asm based and not managed by libasan.  \n\n## Accuracy\nPolynomial surface is optimized from higher order as below :\n* o \u003c 2 =\u003e middle point method.\n* o \u003c 4 =\u003e simpson method (aka rk4).\n* o \u003c 48 =\u003e antiderivative Δ.\n* o \u003e 48 =\u003e antiderivative mp Δ.\n\n## Tests\n* Based on [CUnity/Cunit framework](https://gitlab.com/cunity/cunit).  \n* Organized by suite =\u003e a suite is a domain feature.\n* See tests report below.  \n\nBuild sources (fresh release v3.2.7), clone repo and follow the Readme.  \nThen\n``` \nmake\nsudo make install\n```\nBuild tests from root project.  \n``` \nmake\nmake test\n```\nto run tests with or without options (bci)\n``` \n./surfaces_test \u003coptions\u003e\n```\nClean tests from root project.  \n``` \nmake cleantest\n```\nTests report\n```\nRun Summary       -      Run    Failed  Inactive   Skipped\n     Suites       :        8         0         0         0\n     Asserts      :   173413         0       n/a       n/a\n     Tests        :       81         0         0         0\n```\n## Lib polysurf\n\nCompile lib.\n```\nmake lib\n```\nInstall lib.\n```\nsudo mkdir -p /usr/include/libpolysurf\nsudo cp include/*.h /usr/include/libpolysurf\nsudo cp libpolysurf.so.1.0 /usr/lib\nsudo ln -s /usr/lib/libpolysurf.so.1.0 /usr/lib/libpolysurf.so\nsudo chmod 0755 /usr/lib/libpolysurf.so\nsudo ldconfig\n```\n## Examples polysurf\nCan be found in src/examples.\n```\nmake examples\nexport LD_LIBRARY_PATH=.\n```\nexample intersect usage\n```\n$./ex_intersect 3 2\n     No intersection\n\n$./ex_intersect 2x 2x-1\n     No intersection\n\n$./ex_intersect 5x-10 4x+4\n     p0(14.0000000000000000 , 60.0000000000000000)\n\n$./ex_intersect 2x^14-100 3x^12+10\n     p0(-1.4542375034682683 , 278.3770290295971449)\n     p1(1.4542375034682683 , 278.3770290295971449)\n\n$./ex_intersect 2x^401 4x^4000\n     p0(0.9998074241631791 , 1.8513532041527613)\n```\n## Extra\n\nAlternatives methods with no reliability are tested here.  \n\n* Riemann sums(left,right,rect,trapezoid,midpoint).\n* Simpson rules.\n* Newton-cote.  \n\n## Todo\n* implement integral factory tests for mpfr.\n* add features in lib polysurf.\n\n## Contribute\n* open to pull requests, rule is 1 mod =\u003e 1 unit test (TDD).\n\n## Licence\n* GNU3 GPL(not LGPL).  \n* That means you can reuse a part or the whole for non commercial project.\n* For other cases, pls contact me.\n\n## Links\n* [Area Under a Curve](https://revisionmaths.com/advanced-level-maths-revision/pure-maths/calculus/area-under-curve)\n* [Rieman sum calculator](https://www.emathhelp.net/calculators/calculus-2/riemann-sum-calculator/?f=x%5E3+%2B+0.5x+%2B+3\u0026a=0\u0026b=5\u0026n=4\u0026type=mid)\n* [Ratio addition](https://math.icalculator.info/ratio-addition-calculator.html)\n* [Online integral calculator](https://www.integral-calculator.com/)\n* [Symbolab online IC with ratios result](https://www.symbolab.com/solver/integral-calculator)\n\n## Tools\nTo validate results while testing I used these tools :\n* the powerfull [bc](https://en.wikipedia.org/wiki/Bc_(programming_language))\n* [geogebra](https://en.wikipedia.org/wiki/GeoGebra)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierre-fromager%2Fsurfaces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierre-fromager%2Fsurfaces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierre-fromager%2Fsurfaces/lists"}