Closed Konstantin-Babayan closed 3 years ago
Hi,
This is a question for exercise 0.3.4, right? If that is the case, this closed post will maybe provide some guidance?
Please let me know if it does not work out for you.
Best, Joachim
Hey Joachim yes this is a question for exercise 0.3.4 (my mistake). I have just edited the issue in order to minimise confusion for other students using this platform.
I have tried to use your guidance and think it helped.
If this is correct I am pretty impressed about how python understands how to use k_max compared to just k
After a quick glance at your code (that I think you deleted while I was typing this :) ): Don't you have to multiply by 2 somewhere?
Best, Joachim
Sorry.. I was unsure whether I could write the answer publicly in case it was true so I deleted the code :) Otherwise students will copy-paste, was my thought.
I have a question to exercise 0.3.2 which I find a little bit complicated
You want us to define a function "natural_logarithm" which takes two inputs x and k_max.
I started to define the function with the code:
def natural_logarithm(x,k): natural_logarithm = (1/(2k+1))((x-1)/(x+1))*(2k+1) return natural_logarithm
The next part is the tricky one: we need to implement the sum (and multiply with 2). In this context you give us a hint which is to loop [0, K_max]. I am unsure about how to use loop in this case. My best suggestion is:
total=0 for k_max in range(0,1): total= total + natural_logarithm(2.71,1) total= 2*total k_max+=1
answer_034 = total print(answer_034)
This gives me the output 0.0652. I am unsure whether it is correct.
I hope you can hep