Question: Please use Notepad++ to answer all three questions (Python). For the following crercises, write your code in one text file ending with extension.py. Be sure

Please use Notepad++ to answer all three questions (Python).

Please use Notepad++ to answer all three questions (Python). For the following

For the following crercises, write your code in one text file ending with extension.py. Be sure to use a plain text editor (i.e., NOT Word). I suggest you use Xcode for Mac or Notepad++ for Windows. For parts that require written explanation, use the print function to print your answers to the screen when the script is run, Note that unlike with using the Python interpreter, commands will not print out to the screen automatically when run through a scripting file. Wrap each command you would like to print to the screen in the function print or save the command's output to a variable and then print the variable. Problem 1 (2 pts) Use the sun command described in the lecture notes to find the result for the sum of 1 - 1/2+1/3 - 1/4+1/5-1/6+ ... for several numbers of terms (say 10, 100, 1000). (Hint: read up on the range function online and see how to make it start at 1 instead of 0.) Problem 2 (2 pts) Find the online documentation on the Python math module to familiarize yourself with the functions tised in the problem. Evaluate each of the following using commands from the math module: describe what fune- tions (and constants) you used to get the output (use print): (a) the square of the sine of ; (b) the base 10 logarithm of 100; (c) the absolute value of -4.5: (a) the square root of 16 (can you find two ways to do this with what we've learned so far?) (2 pts) Problem 3 Verify that the following infinite series equals 1/4: 1- 1 5 1 7 3 First, figure out how to represent the pattern using an index n. Then we can generate the list of terms as in the notes. Obviously, we can't really take n to infinity with this series so try letting it go for some large values of n. Note that to complete the problem, you need to compare the answer for increasing numbers of terms (at least 3) in the sum to 7/4 and show that the difference gets smaller

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!