Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

ghostDoctor Group Title

Question re: PS2, Problem One My solution to this problem ended up being similar to the given solution, except instead of iterating the for loop through range(0,len(poly)), I choose to iterate directly through "poly". However, this threw an error: "tuple indices must be integers". My plan was that "for i in poly" would go through each indice in the tuple and assign that particular "i" the value of that indice. I had set up the code to multiply the value of poly[i] by x and then raise it to the value of the indice represented by "i". I didn't think I was modifying the value of the indice

  • one year ago
  • one year ago

  • This Question is Open
  1. snark Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    it seems to be saying that you are looking for element tuple[1.5], a fractional index into the tuple. without seeing any code, it's only a guess.

    • one year ago
  2. ghostDoctor Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    My code was: def evaluate(poly, x): for i in poly: print i sum =+ ((poly[i]*x)*i) print sum and then the value of "poly" was whatever the problem indicated it was, a bunch of floats. i think i assumed that "i" would take the indice value of the tuple, rather than the actual value at that indice.

    • one year ago
  3. harsimran_hs4 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    what you are doing is perhaps picking up the index and multiplying it by x and the multiplying this product further by the power of x the wrong part is that the value of poly[i] i.e eg 3x2 so in your solution even 3 is getting raised to the power perhaps you should do something like poly[i] * (x**i) well i don`t explain perfectly anything unclear please do ask... i hope this helps!

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.