{"id":19492594,"url":"https://github.com/rafifiaan/p1-numericalcomputation-matlab-py","last_synced_at":"2026-05-03T11:32:39.782Z","repository":{"id":166321802,"uuid":"536591724","full_name":"rafifiaan/P1-NumericalComputation-MATLAB-Py","owner":"rafifiaan","description":"Bisection Method Program - Numerical Computation Course","archived":false,"fork":false,"pushed_at":"2022-10-26T08:40:27.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T20:18:25.564Z","etag":null,"topics":["bisection-method","numerical-computation","python"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","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/rafifiaan.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":"2022-09-14T13:30:50.000Z","updated_at":"2023-08-30T16:15:59.000Z","dependencies_parsed_at":"2023-06-09T03:30:19.899Z","dependency_job_id":null,"html_url":"https://github.com/rafifiaan/P1-NumericalComputation-MATLAB-Py","commit_stats":null,"previous_names":["rafifiaan/p1-numericalcomputation-matlab-py"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafifiaan%2FP1-NumericalComputation-MATLAB-Py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafifiaan%2FP1-NumericalComputation-MATLAB-Py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafifiaan%2FP1-NumericalComputation-MATLAB-Py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafifiaan%2FP1-NumericalComputation-MATLAB-Py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafifiaan","download_url":"https://codeload.github.com/rafifiaan/P1-NumericalComputation-MATLAB-Py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240738122,"owners_count":19849549,"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-method","numerical-computation","python"],"created_at":"2024-11-10T21:22:10.921Z","updated_at":"2026-05-03T11:32:39.728Z","avatar_url":"https://github.com/rafifiaan.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Practicum 1 - Numerical Computation\n\n Name           : Rafi Aliefian Putra Ramadhani        \n NRP            : 5025211234                          \n\n\n## Source Code with MATLAB \n\u003eDoing execution Bisection Method using MATLAB Language (Platform)\n - Source :\n```R\n% Input\n% fungsi non linier yang didefinisikan dalam mfile f.m\n% batas atas dan batas bawah\n% galat toleransi\n%\n% Output\n% iterasi, solusi dan galat\n% \n% contoh\n% x.^3-3*x+1\n% Masukkan batas bawah :0\n% Masukkan batas atas :5\n% Masukkan galat Toleransi :0.0001\n\nclear\nclc\ndisp('   Metode Bolzano')\ndisp('             Tekan Enter untuk lanjut')\npause\nclc\n\n%% Input nilai interval dan galat\ndisp('x.^3-3*x+1')\na=input('Masukkan batas bawah :');\nb=input('Masukkan batas atas :');\ngalat1=input('Masukkan galat Toleransi :');\n\n%% Ganti fungsinya di bawah ini\nf= @(x) x.^3-3*x+1;\n\n%% Algoritma\ninit=[a,b];\nya=f(a) ;  %Nilai f(a)\nyb=f(b);   %Nilai f(b)\niter=0;\nxm1=a;\ngalat=abs((b-a)/b);\n\nwhile ya*yb\u003e0\n    disp('Ingat f(a)*f(b)\u003e0, berarti tidak ada akar dalam selang'),\n    break,\nend\n\nfprintf('\\n     iterasi       a            b            xm            f(xm)           Galat\\n');\nwhile galat\u003egalat1\n    iter=iter+1;\n    xm=(a+b)/2;\n    yxm=f(xm);\n    a1=a;b1=b;    % Inisialisasi untuk Tampilan\n    while yxm==0, break,\n    end\n        if ya*yxm\u003c0\n        b=xm;\n        yb=yxm;\n    else\n        a=xm;\n        ya=yxm;\n        end\n    galat=abs((xm-xm1)/xm);\n    xm1=xm;\n    fprintf('%10.0f   %6.10f   %6.10f   %6.10f    %6.10f   %6.10f\\n',[iter;a1;b1;xm;yxm;galat])\nend\nfprintf('Akarnya adalah = %6.10f\\n',xm)\nxx=linspace(init(1),init(2),100);\nyy=f(xx);\n\n%% Plot kurva dan titik estimasi\nfigure(1)\nplot(xx,yy)\nhold on\nscatter(xm1,f(xm1),'filled','p')\nplot(xx,zeros(length(xx),1))\nxlabel('x')\nylabel('f(x)')\nlegend('f(x)','akar persamaan','garis f(x)=0')\ntitle(sprintf('Metode Bolzano - Akarnya adalah = %.8f', xm1))\n```\n - Result :\n![mt1](https://user-images.githubusercontent.com/91828276/196020410-31b0b064-9c0f-4051-ad59-548db48f98ee.png) \n\u003c/br\u003e\n\n## Source Code with Python\n\u003eDoing execution Bisection Method using Python Language (Online Compiler Platform)\n - Source :\n```R\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nprint(\"Metode Bolzano - Numerical Computation\")\nprint(\"-----------------------------------------\")\npersamaan = input(\"Masukkan Persamaan fungsi x : \")\na = float(input(\"Masukkan nilai a : \"))\nb = float(input(\"Masukkan nilai b : \"))\ne = 1e-5\nprint(\"Akar persamaan dari fungsi x : \", persamaan, \" dengan batas bawah : \", a, \" dan batas atas : \", b)\n\ndef f(x):\n    return eval(persamaan)\n\nif f(a)*f(b)\u003e0:\n    print(\"Persamaan tidak memiliki akar\")\n    \nelse :\n    print(\"n          a                b              x              f(a)            f(b)             f(x)\")\n    for i in range(0,300):\n        x = (a+b)/2\n        print(i+1, \"\\t\", format(a,\".5f\"), \"\\t\", format(b,\".5f\"), \"\\t\", format(x, \".5f\"), \"\\t\", format(f(a),\".5f\"), \"\\t\", format(f(b),\".5f\"), \"\\t\", format(f(x),\".5f\"))\n        \n        if abs(f(x))\u003ce:\n            break\n        elif f(a)*f(x)\u003c0:\n            b=x\n        else:\n            a=x\n            \nprint(\"Akar persamaannya adalah = \", x)\n\nx = np.linspace(-5,10,100)\n\nfig = plt.figure()\nax = fig.add_subplot(1,1,1)\nax.spines['left'].set_position('center')\nax.spines['bottom'].set_position('zero')\nax.spines['right'].set_color('none')\nax.spines['top'].set_color('none')\nax.xaxis.set_ticks_position('bottom')\nax.yaxis.set_ticks_position('left')\n\nplt.plot(x, f(x))\nplt.grid()\nplt.show()\n```\n - Result :\n![py1](https://user-images.githubusercontent.com/91828276/196020415-1dca852b-6eb9-45a4-b90e-794c49655a64.png)\n\u003c/br\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafifiaan%2Fp1-numericalcomputation-matlab-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafifiaan%2Fp1-numericalcomputation-matlab-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafifiaan%2Fp1-numericalcomputation-matlab-py/lists"}