home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1990 March / 64er_Magazin_90-03_1990_Markt__Technik_de_Side_A.d64 / iteration (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  880b  |  58 lines

  1. 10 rem mpk1 quadratische gleichungen
  2. 15 :
  3. 20 rem iterationsverfahren
  4. 25 :
  5. 30 rem werte nach der gleichung:
  6. 40 rem a*x^2+b*x+c=0
  7. 45 :
  8. 50 rem vorgaben:
  9. 55 :
  10. 60 a=1: b=-20: c=51
  11. 70 ge=.01
  12. 75 :
  13. 80 rem berechnungen startpunkte:
  14. 85 :
  15. 90 lx=0: ly=-b
  16. 100 rx=-b/a: ry=0
  17. 105 :
  18. 110 rem iterationen
  19. 115 :
  20. 120 rem von links (1.schnittpunkt)
  21. 125 :
  22. 130 i=1
  23. 140 y=ly
  24. 145 :
  25. 150 x=c/y: rem x-wert hyperbel
  26. 160 y=-a*x-b: rem y-wert gerade
  27. 165 :
  28. 170 print"iteration nr.";i
  29. 180 print"x1=";x
  30. 190 print
  31. 205 :
  32. 210 d=abs(-a*x-b-c/x)
  33. 220 if d<=ge then 240
  34. 225 :
  35. 230 i=i+1: goto150
  36. 235 :
  37. 240 print"gewuenschte genauigkeit erreicht.":print
  38. 245 :
  39. 250 rem von rechts (2.schnittpunkt)
  40. 255 :
  41. 260 i=1
  42. 270 x=rx
  43. 275 :
  44. 280 y=c/x: rem y-wert hyperbel
  45. 290 x=-(y+b)/a: rem x-wert gerade
  46. 295 :
  47. 300 print"iteration nr.";i
  48. 310 print"x2=";x
  49. 320 print
  50. 335 :
  51. 340 d=abs(-a*x-b-c/x)
  52. 350 if d<=ge then 370
  53. 355 :
  54. 360 i=i+1: goto 280
  55. 365 :
  56. 370 print"gewuenschte genauigkeit erreicht."
  57. 380 end
  58.