Advertisement
tampurus

Unit 2.7 Jacobi's Method

Jun 18th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.14 KB | None | 0 0
  1. // jacobi
  2.  
  3. start
  4. Arrange given system of linear equations in diagonally dominant form
  5. Read toerable error (e)
  6. Convert the first equations in terms of first variable,second equation in terms of second variable and so second
  7. Set initial guesses for x0,y0,z0 and so on
  8. Substitue value of x0,y0,zo... from step 5 in equation obtainded in step 4 to calculate new values x1,y1,z1 and so on
  9. if |x0 - x1 | > e an |y0 -y1 |>e and |z0 - z1| > e and so on then goto step 9
  10. print the value of x1,y1,z1 and so on
  11. stop
  12.  
  13.  
  14. // Gauss Seidall
  15. start
  16. Arrange given system of linear equations in diagonally dominant form
  17. Read toerable error (e)
  18. Convert the first equations in terms of first variable,second equation in terms of second variable and so second
  19. Set initial guesses for x0,y0,z0 and so on
  20. Substitute value of y0,z0 .. from step in first equation obtained from step 4 to calculate new value of x1. Use x1,z0,.. in second equation obtained from step 4 to calculate new value of y1. Similarly . use x1,y1.. to find new z1 and so on  
  21. if |x0 - x1 | > e an |y0 -y1 |>e and |z0 - z1| > e and so on then goto step 9
  22. print the value of x1,y1,z1 and so on
  23. stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement