8000 GitHub - pouzialen/4
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pouzialen/4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Defining equations to be solved

in diagonally dominant form

f1 = lambda x,y,z: (17-y+2z)/20 f2 = lambda x,y,z: (-18-3x+z)/20 f3 = lambda x,y,z: (25-2x+3y)/20

Initial setup

x0 = 0 y0 = 0 z0 = 0 count = 1

Reading tolerable error

e = float(input('Enter tolerable error: '))

Implementation of Jacobi Iteration

print('\nCount\tx\ty\tz\n')

condition = True

while condition: x1 = f1(x0,y0,z0) y1 = f2(x0,y0,z0) z1 = f3(x0,y0,z0) print('%d\t%0.4f\t%0.4f\t%0.4f\n' %(count, x1,y1,z1)) e1 = abs(x0-x1); e2 = abs(y0-y1); e3 = abs(z0-z1);

count += 1
x0 = x1
y0 = y1
z0 = z1

condition = e1>e and e2>e and e3>e

print('\nSolution: x=%0.3f, y=%0.3f and z = %0.3f\n'% (x1,y1,z1))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0