{"id":15049030,"url":"https://github.com/louis-finegan/langrange-interpolation-c-programming-language-gnuplot","last_synced_at":"2026-03-16T08:35:08.982Z","repository":{"id":240791926,"uuid":"802218881","full_name":"Louis-Finegan/Langrange-Interpolation-C-Programming-Language-Gnuplot","owner":"Louis-Finegan","description":"Calculate Langrange-Interpolations in the C programming language and visualise them in gnuplot.","archived":false,"fork":false,"pushed_at":"2024-05-20T19:05:07.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T23:44:21.867Z","etag":null,"topics":["c-programming-language","csv-parser","gnu-linux","gnuplot","lagrange-interpolation","lagrange-polynomial-interpolation","makefile","mathematics","numerical-methods","shellscript","ubuntu"],"latest_commit_sha":null,"homepage":"","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/Louis-Finegan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-17T18:53:05.000Z","updated_at":"2024-05-20T19:13:16.000Z","dependencies_parsed_at":"2024-05-20T23:04:18.625Z","dependency_job_id":"c3bc8819-cc8f-4a93-b480-e7b7c93e83ad","html_url":"https://github.com/Louis-Finegan/Langrange-Interpolation-C-Programming-Language-Gnuplot","commit_stats":null,"previous_names":["louis-finegan/langrange-interpolation-c-programming-language-gnuplot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Finegan%2FLangrange-Interpolation-C-Programming-Language-Gnuplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Finegan%2FLangrange-Interpolation-C-Programming-Language-Gnuplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Finegan%2FLangrange-Interpolation-C-Programming-Language-Gnuplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Louis-Finegan%2FLangrange-Interpolation-C-Programming-Language-Gnuplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Louis-Finegan","download_url":"https://codeload.github.com/Louis-Finegan/Langrange-Interpolation-C-Programming-Language-Gnuplot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243500771,"owners_count":20300770,"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":["c-programming-language","csv-parser","gnu-linux","gnuplot","lagrange-interpolation","lagrange-polynomial-interpolation","makefile","mathematics","numerical-methods","shellscript","ubuntu"],"created_at":"2024-09-24T21:17:42.482Z","updated_at":"2025-12-28T09:13:58.130Z","avatar_url":"https://github.com/Louis-Finegan.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lagrange Interpolation\n\nWritten in Ubuntu 23.04 LTS. This progam was written for GNU/Linux systems.\n\n## Visualize lagrange polynomials with GNU plot\n\nImplements Langrange-Interpolation in the `C programming language`. Creates complete polynomials from Node Value pairs in csv files, and creates 2 dimensional plots, using `gnuplot`, which are saved as png files.   \n\n## Dependences\n\n1. gcc\n2. gnuplot\n\n## Formulation\n\nLagrange interpolation is a mathematical method that finds new points $(x,y)$ in between known discrete points $(x_k, y_k)$ for $k \\in \\mathbb{Z}$. These new points are calculated using a polynomial $P_n(x)$ called the *Lagrange Polynomial*. The maximum value for $k$ is $n$, which is the degree of $P_n(x)$. \n\nThe *Lagrange Polynomial* is written in the following form:\n\n$$P_n(x) = y_0L_0(x) + y_1L_1(x) + \\dots + y_nL_n(x)$$\n\nWhere $L_k(x)$ is called the *Lagrange Basis*, and is written as such\n\n$$L_i(x) = \\frac{x - x_0}{x_i - x_0} \\dots \\frac{x - x_{i-1}}{x_i - x_{i-1}}\\frac{x - x_{i+1}}{x_i - x_{i+1}} \\dots \\frac{x - x_n}{x_i - x_n} $$\n\nFor $n$ known points, or node, value pairs, the lagrange basis would be composed of $n$ basis vectors (Lagrange Basis).\n\n## Example\n \n\nThis example takes critical points from a **sine wave**. Using Lagrange Interpolation, an approximation of the complete wave can be constucted.\n\nThe data in `data/sine.csv` is format as the following\n\n\u003cp align='center'\u003e\n\u003ctable style=\"border-collapse: collapse; width: 50%; margin: 20px auto; font-family: Arial, sans-serif;\"\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003eNodes\u003c/th\u003e\n            \u003cth style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003eValues\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e0\u003c/td\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e0\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e1.5707\u003c/td\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e1\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e3.1416\u003c/td\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e0\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e4.7124\u003c/td\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e-1\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e6.2832\u003c/td\u003e\n            \u003ctd style=\"border: 2.5px solid #6e6e6e; padding: 10px; text-align: center;\"\u003e0\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c/p\u003e\n\nThe program can be executed by the following\n\n```\n./run.sh [csv_file]\n```\n\nFor this example `csv_file` would be `sine.csv`. If the program ran successfully the following message would appear:\n\n```\nData read successfully\nNodes:  Values:\n0.00    0.00\n1.57    1.00\n3.14    0.00\n4.71    -1.00\n6.28    0.00\nInitializing Lagrange Interpolation\nCreating plot\nPlot saved as 'img/sine.png'\n```\n\nAnd the following image is saved to `img` as a `png` file type.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./img/sine.png\" /\u003e\n\u003c/p\u003e\n\n\n## License\n\nMIT License - see LICENSE for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouis-finegan%2Flangrange-interpolation-c-programming-language-gnuplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouis-finegan%2Flangrange-interpolation-c-programming-language-gnuplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouis-finegan%2Flangrange-interpolation-c-programming-language-gnuplot/lists"}