Python Forum
Help solving an exercise?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help solving an exercise?
#4
Please post your code (with python tags) instead of screen shots.

You aren't doing the summing part. for k starting at 1 and ending at N-1 you need to compute f(a + k / M * (b - a)) and add all the values together. This will require a loop, or something that acts like a loop.
sumnation = 0
for k in range(1, N-1):
    sumnation += function(k)
I think you also need to review your function. What you wrote does not look like
A * x**n if x >= 1 else A * x**(-n)
Reply


Messages In This Thread
Help solving an exercise? - by darioco - Apr-16-2023, 06:49 PM
RE: Help solving an exercise? - by deanhystad - Apr-16-2023, 07:01 PM
RE: Help solving an exercise? - by darioco - Apr-16-2023, 07:55 PM
RE: Help solving an exercise? - by deanhystad - Apr-17-2023, 02:48 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020