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

Sotero Group Title

Hi, I am working on MIT 6.189 in hw_2 Ex 2.3 my math functions work in the command line when I use math.sin(math.pi) for example, but when I put the sin and cos values in the multadd function python seems to not recognize the math.sin and math.cos. i tried calling the math library inside the multadd function but it did not work. Does anyone know how to fix this?

  • 10 months ago
  • 10 months ago

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

    Is it tossing any errors?

    • 10 months ago
  2. Sotero Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Hi, yes this is the error Traceback (most recent call last): File "C:\Users\Sotero\Desktop\Python HW\hw2.py", line 76, in <module> b=math.cos(math.pi/4) NameError: name 'math' is not defined

    • 10 months ago
  3. e.mccormick Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    What import statment(s) did you use? ``` from math import * ``` Is not that great. You might try: ``` import math ``` They did that poorly in the MIT class.

    • 10 months ago
  4. Sotero Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I did import math .Apparently, I have to be in the command line to write the formula. It does not work in the shell.It is working now. Thanks for your help :)

    • 10 months ago
  5. e.mccormick Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Strange. I wonder if it has some pathing issue.

    • 10 months 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.