Problem on  Riemann Integration: $f$ is defined on $[0,1]$ by $\,f(x)=1/n$ for $1/n&gt;x\geq 1/(n+1)$ and $f(x)=0$ for $x=0$, where $n=1,2,3,....$ Find $\int_{0}^1f(x)dx$.  First I tried to find out $\int_{1/(n+1)}^1f(x)dx$. But I got a series sum:$$\sum_{k=1}^{n}\cfrac{1}{k^2(k+1)}$$ How to proceed?
Is the function Riemann integrable? If yes, obtain the value of $\int_0^1f(x) \ dx$      $f(x) = \begin{cases} \frac {1}{n},  &amp; \frac{1}{n+1}&lt;x\le\frac{1}{n}\\ 0, &amp; x=0 \end{cases}$   My attempt  $f$ is bounded and monotonically increasing on $[0,1]$. Also, $f$ has infinite discontinuities but only one limit point. Therefore $f$ is Riemann integrable. Now, to calculate the integration  $\int_0^1f(x) \ dx=\int_{1/2}^{1}1 \ dx + \int_{1/3}^{1/2}\frac{1}{2} \ dx + \int_{1/4}^{1/3}\frac{1}{3} \ dx+...$  $=\sum_{n=1}^\infty \frac{1}{n^2}-\frac{1}{n}+\frac{1}{n+1}$  How do I proceed from here? How do I calculate these summations? I know $\sum \frac{1}{n}$ is $\log 2$, but not the other two summations.
LINQ's Distinct() on a particular property I am playing with LINQ to learn about it, but I can't figure out how to use Distinct when I do not have a simple list (a simple list of integers is pretty easy to do, this is not the question). What I if want to use  on a list of an Object on one or more properties of the object?  Example: If an object is Person, with Property Id. How can I get all Person and use Distinct on them with the property Id of the object?  Person1: Id=1, Name="Test1" Person2: Id=1, Name="Test1" Person3: Id=2, Name="Test2"   How can I get just Person1 and Person3? Is that possible?  If it's not possible with LINQ, what would be the best way to have a list of Person depending on some of its properties in .NET 3.5? How about newlines within comments? I am aware that comments have only a simple field, with no formatting possible and that is fine (if formatting is needed, your comment should actually be an answer!)  But I find some comments hard to read because they are mainly one giant line (of up to 600 characters!). Any newlines entered during the redaction of the message is stripped from the published comment.    Would it be possible to preserve those newlines? (but may be deleting empty lines, to prevent abuses like a comment taking 600 lines because a prankster could find amusing to post a 600 newlines comment!)    Let's recap:   what we need (and can actually preview while typing a comment, making it more readable, both for the writer -- and the reader, should newlines being kept): declined for newlines (why? no reason given at this time.) what we don't need but is "nice to have" (even though we cannot preview those): granted for bold and italic text. what we really don't need (and cannot not preview): granted for... __code sample__!? Code sample? Seriously? In a comment?   In short: What was an incentive to post a new answer (because of the lack of formatting) is now further diminished. But the comments remain published as one long-hard-to-read-gigantic line. Generating random numbers without repetitions After offering a bounty to , I realize that I cannot comment on the question because I no longer have the required reputation. Is it possible to change this behavior, so that the bounty owner can comment only on the post with the bounty irrespective of their reputation? While bounty owners are told that they'll lose privileges at the time they place a bounty, it makes sense to allow them to interact with potential answerers/commentators to help solve the problem, or at least provide additional information. Python List vs. Array - when to use? If you are creating a 1d array, you can implement it as a List, or else use the 'array' module in the standard library.  I have always used Lists for 1d arrays.  What is the reason or circumstance where I would want to use the array module instead?  Is it for performance and memory optimization, or am I missing something obvious? How can I simulate a slow machine in a VM? I use form to send POST request to a page and to login user with wp_signon() in order to authenticate user to my wordpress installation as described in WP documentation:  $creds = array(); $creds['user_login'] = $_POST["user-login"]; $creds['user_password'] = $_POST["user-password"]; $creds['remember'] = true;  $user = wp_signon( $creds, false );   After this little piece of code I'm checking if user was logged in:  if ( is_user_logged_in() ) { echo "SUCCESS"; } else { echo "FAIL!"; }   But I got FAIL! all the time. Then after sniffing around I found this little trick:  wp_set_current_user( $user ); if ( is_user_logged_in() ) { echo "SUCCESS"; } else { echo "FAIL!"; }   I've got SUCCESS on this one but when I leave this page I got FAIL again and again.  Can anyone explain me how to login user with wp_signon() without logging her out after page is changed or reloaded or whatever.    I've got desirable result when I go to /wp_admin and login with WP's default login form. I can navigate through every page of my WP site remaining logged-in all the time. But when I try to do this outside the default form I FAIL.  Guide me! PLEASE! Some spells, such as Forbiddance, say that under certain circumstances, they last "Until Dispelled".  Other spells, such as Mordenkainen's Private Sanctum, say that under certain circumstances, they become "Permanent".  What is the difference between these two terms?  Does "Permanent" mean that the effect can never be dispelled? What are the differences between "=" and "<-" assignment operators in R? Printing pointers in C I was trying to understand something with pointers, so I wrote this code:  #include &lt;stdio.h&gt;  int main(void) {     char s[] = "asd";     char **p = &amp;s;      printf("The value of s is: %p\n", s);     printf("The direction of s is: %p\n", &amp;s);      printf("The value of p is: %p\n", p);     printf("The direction of p is: %p\n", &amp;p);      printf("The direction of s[0] is: %p\n", &amp;s[0]);     printf("The direction of s[1] is: %p\n", &amp;s[1]);     printf("The direction of s[2] is: %p\n", &amp;s[2]);      return 0; }   When compiling it with gcc I get these warnings:  $ gcc main.c -o main-bin -ansi -pedantic -Wall -lm main.c: In function ‘main’: main.c:6: warning: initialization from incompatible pointer type main.c:9: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char (*)[4]’ main.c:11: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char **’ main.c:12: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘char ***’   (The flags for gcc are because I must be C89)  Why incompatible types of pointer? Isn't the name of an array a pointer to it's first element? So if s is a pointer to 'a', &amp;s must be a char **, no? And why do I get the other warnings? Do I have to cast the pointers with (void *) in order to print them?   And when running I get something like this:  $ ./main-bin The value of s is: 0xbfb7c860 The direction of s is: 0xbfb7c860 The value of p is: 0xbfb7c860 The direction of p is: 0xbfb7c85c The direction of s[0] is: 0xbfb7c860 The direction of s[1] is: 0xbfb7c861 The direction of s[2] is: 0xbfb7c862   How can the value of s and it's direction (and of course the value of p) be the same? Can I run a natural gas dryer from a portable propane tank? Why are two universal objects isomorphic? How can I stop the symbolic x coords to be plotted twice? $\Bbb Z^\ast$ What is this notation? What does $\Bbb Z^\ast$ mean? I would think some subset of the integers but I cannot find a definition. Thank you. Calculating path sinuosity in postgis is a fairly straightforward concept. How can this be calculated in postgis given a series of linestrings that represent the path? I've read a new study which suggests that yawning may help you keep a cool head. Also, the findings might hold some hope for sufferers of insomnia, migraines, and even epilepsy.  Is there any conclusion about what the function of yawning is and why do we yawn? 'Country have' vs 'country has' 1) Australia has won the World Cup Cricket.      2) Australia have won the World Cup Cricket.   Which sentence is correct? Also, I would like to know more contexts where 'country has' and 'country have' are used. How to evenly space vertices? I have a edge loop that has vertices on it. Is there a way I can separate the vertices on the the edge evenly without moving the end points? I would also like for the vertices to maintain the current shape. How much Valyrian steel is there that is unused for link making and why aren't people making weapons out of it? I was reading  that stated Maesters can have Valyrian steel links:     Valyrian Steel links (for the study of Magic + the Occult) are exceedingly rare and held by less than one Maester in a hundred. Ironically, they aren't seen as especially prestigious but rather viewed with suspicion.   This made me wonder how much Valyrian steel there is lying around for Maesters to be adding them to their chains. It seems like such  resource like this would be used for crafting weapons not being kept as ingots ready for Maesters to make links.  Indeed the Wiki I linked above claims:     the amount of Valyrian steel in the world is finite and extremely rare   How much of his extremely rare resource is being kept in reserve for link making and why hasn't it been used for more useful stuff like making weapons? Solve for $x$ in $6x^2-25x+12+\frac{25}{x}+\frac{6}{x^2}=0$ I simplified to get $6x^4-25x^3+12x^2+25x+6=0$  Or $6 (x^2+1)^2+25x(1-x^2)=0$  Then I substituted $z=x^2+1$, to get $6z^2+25\sqrt{(z-1)}(2-z)=0$  I can't find a way to proceed further.