Question

Please let me know if you have any questions. Thanks in advance!

We want to develop a code that calculates In(1 - x) =- on the interval -1<x<1. First, understand what this notation represent

0 0
Add a comment Improve this question Transcribed image text
Answer #1
 #CASE 1 x=float(input("Enter Value of x between -1 and 1: ")) #Takes input for value of x n=int(input("Enter number of terms: ")) #Takes input for number of terms sum=0 #Initialises sum which will store the summation for i in range(1,n+1): #this loop will run for n number of times from 1 to n sum+=(pow(x,i)/i) #(x^i)/i is added to sum each time loop runs print(-sum) #finally prints sum with negative sign as ln(1-x)=-summation
 #CASE 2 x=float(input("Enter Value of x between -1 and 1: ")) #Takes input for value of x t=float(input("Enter the tolerance limit: ")) #Takes input for tolerance limit sum=0 #Initialises sum which will store the summation i=1 #initialises i which is used for increneting the exponent and divisor while(abs(pow(x,i)/i)>t): #The loop will run till the difference between sum and sum+next term is greater than tolerance limit sum+=(pow(x,i)/i) i+=1 print(-sum) #finally prints sum with negative sign as ln(1-x)=-summation
Add a comment
Know the answer?
Add Answer to:
Please let me know if you have any questions. Thanks in advance! We want to develop...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts...

    MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts in order to get full credit. Help me out, thank you f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...

  • I want to know how to do this assignment!!! Help me please~ The first part of...

    I want to know how to do this assignment!!! Help me please~ The first part of your program should do the following: • Ask the user type of test they took. o (ACT or SAT) • If they said ACT then ask them their score o If their ACT score was between 0 and 7 say "Needs Work" o If their ACT score was between 10 and 20 say "Acceptable" o If they ACT score was above 20 say "Above...

  • This is a matlab HW that I need the code for, if someone could help me figure this out it would b...

    This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated. The value of t can be estimated from the following equation: in your script file, estimate the value of π for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message...

  • 1. (a) We want to develop a method for calculating the function sint dt f)-inf t...

    1. (a) We want to develop a method for calculating the function sint dt f)-inf t 0 for small or moderately small values of x. This is a special function called the "sine integral", and it is related to another special function called the "exponential integral". It arises in diffraction problems. Derive a Taylor-series expression for f(x), and give an upper bound for the error when the series is terminated after the n-th order term. [HINT: (-1)"*z ? + R...

  • Please Help in C#, Let me know if you have any questions. Please make sure the...

    Please Help in C#, Let me know if you have any questions. Please make sure the program passes the checks Checks: Question: My code works, it just this needs to be added there which I don't know what I need to do.    In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output...

  • Q1 2016 a) We want to develop a method for calculating the function f(x) = sin(t)/t...

    Q1 2016 a) We want to develop a method for calculating the function f(x) = sin(t)/t dt for small or moderately small values of x. this is a special function called the sine integral, and it is related to another special function called the exponential integral. it rises in diffraction problems. Derive a Taylor-series expression for f(x), and give an upper bound for the error when the series is terminated after the n-th order term. sint = see image b)we...

  • Please help and follow instructions, c++ , let me know if there is any questions Description:...

    Please help and follow instructions, c++ , let me know if there is any questions Description: This program is part 1 of a larger program. Eventually, it will be a complete Flashcard game. For this part, the program will Prompt the user for a file that contains the questions – use getline(cin, fname) instead of cin >> fname to read the file name from the user. This will keep you in sync with the user’s input for later in the...

  • Please, can you help me solve these questions? Thanks! 1- Roll a dice (get a random...

    Please, can you help me solve these questions? Thanks! 1- Roll a dice (get a random number from 1 to 6) 2-Print value of the dice 3- Keep track of running total points(display of points) 4-Ask the user to continue (y/n) 5- If the user gets 21 points, print " bingo" 6- If the user more than 21 points, print "sorry you lose" 7- If the user decides to stop the game, print his final points.

  • 3. Suppose we want to use the ri-term trapezoid rule to approximate Sinde (a) (3 points)...

    3. Suppose we want to use the ri-term trapezoid rule to approximate Sinde (a) (3 points) Make a graph of y= between = 2 and 3 = 4. Draw on your graph the trapezoids used to apply the Trapezoidal Rule with n = 3. (So, your graph should have 3 trapezoids.) (b) (2 points) Does the Trapezoidal Rule overestimate or underestimate the value of justify your answer. 1 dx? No need to (c) (5 points) For the Trapezoidal Rule, the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT