Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
frankdpnw
Group Title
#Mooc question
In exercise 1.4, MIT6_189IAP11_hw1.pdf, how do I code for a 4th root in python. The problem that I am struggling with is finding the 4th root of 19+100. I know the answer but I don't know how to code it. I used the math.sqrt for one of the earlier problems.
 2 years ago
 2 years ago
frankdpnw Group Title
#Mooc question In exercise 1.4, MIT6_189IAP11_hw1.pdf, how do I code for a 4th root in python. The problem that I am struggling with is finding the 4th root of 19+100. I know the answer but I don't know how to code it. I used the math.sqrt for one of the earlier problems.
 2 years ago
 2 years ago

This Question is Closed

senior_caliente Group TitleBest ResponseYou've already chosen the best response.2
I had the same question http://openstudy.com/study?login#/updates/507db758e4b0eba0db5e9c9e Best way is use ** operator with 1/4
 2 years ago

frankdpnw Group TitleBest ResponseYou've already chosen the best response.0
Thank you. That works
 2 years ago

jhstephenson Group TitleBest ResponseYou've already chosen the best response.0
I did X**.25
 2 years ago

peterdb Group TitleBest ResponseYou've already chosen the best response.1
I puzzled over this wondering if Python had some special way to solve it. I then remembered that a root is the same as the exponential of the reciprocal so x = y**(1/4) Is there a more Pythonesque way to write this?
 2 years ago

peterdb Group TitleBest ResponseYou've already chosen the best response.1
Oh. that should have been x = y**(1.0/4)
 2 years ago

velumani Group TitleBest ResponseYou've already chosen the best response.1
a longer coding way would be to "import" math module and use math.sqrt function twice, like, math.sqrt(math.sqrt(x)) !!
 2 years ago

Kyol Group TitleBest ResponseYou've already chosen the best response.0
Is there a way if you import the math module to make an nroot instead of using two square roots in a row ?
 2 years ago

velumani Group TitleBest ResponseYou've already chosen the best response.1
@Kyol: When i looked for function that could do the nth root in the math module, i found none. But, there is the power function [pow()], the same as what @peterdb has stated above (which is simple and better). Then why import math function ...??!!
 2 years ago
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
 Engagement 19 Mad Hatter
 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.