Please help me in Python programming for math. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Please help me in Python programming for math.

Hello. Iโ€™m Duc Tran. My hobby is studying math and makig math programs. I want to make a program in Python that calculate Riemann zeta functions. Below is the definition of Riemann zeta function: https://wikimedia.org/api/rest_v1/media/math/render/svg/eb3dd62b1cd4528d76892f762ccb5b8b418cf0c6 Overall, Riemann zeta function of s is the sum of reciprocals of natural numbers to the s-th power. So, what I want to make is a program that will give us the Riemann zeta function value of s after inputting s. For example, INPUT: 2 OUTPUT: 1.644934066848...(depends on the number I round to, and for your information, itโ€™s exactly pi^2/6) I didnโ€™t finish the Python course on Sololearn. I only learned about 75% of it. Summary of what I learned in Python: for loop, while loop, if/else, define functions, filter function, map function, lambda, functions for lists, generators, decorators, etc. So, I learned to a part of โ€œfunctional programmingโ€, which includes lambda, map, filter, generators, etc. Please help me. Thank you. ๐Ÿ˜Š THIS IS NOT FOR CHEATING NOR ASSIGNMENTS.

28th May 2018, 1:58 AM
Duc Van Khanh Tran
Duc Van Khanh Tran - avatar
8 Answers
+ 6
The Riemann Zeta function is basically the sum of all reciprocals of number raised to the power of the riemann zeta function parameter right?
28th May 2018, 2:21 AM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
+ 5
If there is no change on value despite adding stuff, then break
28th May 2018, 2:53 AM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
+ 4
Wikipedia has some formulae that you may want to check, just scroll down
28th May 2018, 2:27 AM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
+ 4
Or you just run a while loop until the value apparently doesn't change, then there you go
28th May 2018, 2:28 AM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
+ 2
Hello Pegasus. Yes, that's right. So, for example, Riemann zeta function of 2 is basically the sum of reciprocals of squares.
28th May 2018, 2:25 AM
Duc Van Khanh Tran
Duc Van Khanh Tran - avatar
+ 2
Pegasus, I scrolled down but... what formulae do you mean??
28th May 2018, 2:43 AM
Duc Van Khanh Tran
Duc Van Khanh Tran - avatar
+ 2
Pegasus, what do you mean by running a while loop until the value apparently doesn't change? Like.... how to stop it? (I mean how to use "break"?)
28th May 2018, 2:53 AM
Duc Van Khanh Tran
Duc Van Khanh Tran - avatar
+ 1
hmm... so I think Iโ€™m going to try it like... โ€œifโ€ and then โ€œbreakโ€. Thank you Pegasus. ๐Ÿ˜„
28th May 2018, 3:10 AM
Duc Van Khanh Tran
Duc Van Khanh Tran - avatar