abjer / isds2020

Introduction to Social Data Science 2020 - a summer school course abjer.github.io/isds2020
58 stars 92 forks source link

Question regarding Problem 0.3.5 #11

Closed Willy2606 closed 4 years ago

Willy2606 commented 4 years ago

Hi,

Can anybody please help me clarify Problem 0.3.5?

So far, using the suggested bit of code, I've managed to intuitively understand (I'm a Python novice) that you feed the exponentiate(func) with a function, in this case the natural_logarithm function, whose input (x, k) are fed to the nested function. The denotation of e = eulers_e(x, k) makes some sort of generic manipulation of the input, which, if done correctly, should be used as the first input in value-function, i.e. value = func(e, k).

As for now, I have tried the above-mentioned solution to the value-function, which in my mind makes sense; func(e, k) => func(eulers_e(x, k) , k) => naturallog(eulers_e(x, k), k), followed by printing, storing the result, etc.

FYI Both of my eulers_e and natural_logarithm computations meet their respective assert-lines.

jsr-p commented 4 years ago

Your intuition is correct. And your exponentiate()function looks correct.
But your output for logexp(1, 1000) is not correct. The output should be close to 1 (log(e^1)=1) but with a smaller margin than the one in your output. So there must be something in your natural_logarithm or eulers_e function resulting in the error.
See if you can find the error and if not post a screenshot here of your functions :)

Willy2606 commented 4 years ago

Perfect! Again, thanks for the quick reply. I've removed the link :)