Facebook
From Zero, 3 Years ago, written in Python.
">

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

from

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

- view diff
Embed
Download Paste or View Raw
Hits: 69
  1. a = -1.1
  2. k = 1.4
  3. tol = float(input())
  4. nmax = int(input())
  5. sum_1 = -0.40087
  6. total = 0
  7. error = 1
  8. for i in range (1,nmax+1):
  9.      total += ((a**i)*(2*i - 1))/(k**(2*i+1))
  10.      error = i/total
  11.      if abs(error)<=tol:
  12.           break
  13.      
  14. print(total)