News for hackers. Stuff that matters.
Re:A Simple Calculus Exercise by nateb2022 on Monday April 17, 2023 @12:26AM (#35596842)
Current Calc 2 student here. I would be braindead approaching this problem honestly, I don't think I'd even know how to begin; I'm hoping that's normal.

Why would the exponent be equal to x/2 - floor(x/2) be equal to x/2 on the interval [0, 2)? And how does the graph of x/2 - floor(x/2) imply anything about the behavior of e^(x/2 - floor(x/2))? I'm hoping I just haven't learned enough yet?

Re:A Simple Calculus Exercise by monoprotic on Monday April 17, 2023 @12:31AM (#35596874)
> Why would the exponent be equal to x/2 - floor(x/2) be equal to x/2 on the interval [0, 2)?

floor(x/2) = 0 on the interval [0, 2), so the expression reduces to x/2.

> And how does the graph of x/2 - floor(x/2) imply anything about the behavior of e^(x/2 - floor(x/2))?

If y = x/2 - floor(x/2) is periodic, then e^y = e^(x/2 - floor(x/2)) must be periodic as well, with the same period.

Re:A Simple Calculus Exercise by nateb2022 on Monday April 17, 2023 @12:58AM (#35596998)
Thank you!
Re:A Simple Calculus Exercise by echojc on Monday April 17, 2023 @01:08AM (#35597034)
I think this kind of problem is less about maths and more about how one might approach an unfamiliar problem. Not knowing where to begin is normal. What you're looking to do is to build up the intuition for how you can break down the problem into smaller pieces so that you can investigate its properties.

x/2 - floor(x/2) is the natural place to start because it's the smallest independent piece of the equation. Take a couple of minutes to plot this on a graph for a small range of values, like 0 <= x <= 6 (deciding what range to check is also part of your problem solving skillset).

With this, you can calculate and sketch out e^(above result) on a graph. Finally, knowing the principle that a definite integral calculates the area under the curve, you should be able to use your sketch to reason out how to calculate the entire original integral.

Hopefully you can see how solving this kind of problem isn't about knowing anything about this particular problem, but simply investigating it without any prior expectations, which is why the author thinks this is an interesting exercise for students.

Re:A Simple Calculus Exercise by hgsgm on Monday April 17, 2023 @07:45AM (#35599355)
You don't need graphs or area at all, of course. All you need is to notice that the frac(x/2) expression is a periodic function that is only integrable piecewise, and is easy to integrate with a change of variables for each piece or a handwave of such.

It's actually gnarly to write out a formal proof as a new student would do (it requires principle of induction to handle all the pieces), but easy for an expert to breeze through as trivial.

The makes it a bit of an unfair problem for a students trying to follow the rules of math. This is very common challenge for students making the transition to higher math, when they are taught rigorous proofs but before they learn that professionals mathematicians are rarely rigorous (except when there is disagreement about the truth of an "obvious" claim).

Re:A Simple Calculus Exercise by mjd on Monday April 17, 2023 @08:04AM (#35599516)
> All you need is to notice…

All you need is a magical inspiration from out of nowhere!

But if you don't happen to have that magical inspiration, the graph will make the periodicity visually obvious.

Re:A Simple Calculus Exercise by hgsgm on Wednesday April 19, 2023 @09:49PM (#35635431)
Deciding to draw a graph is also magical inspiration.
Re:A Simple Calculus Exercise by mkl on Monday April 17, 2023 @02:03AM (#35597285)
Another way to think about it: floor rounds down, so there are intervals of numbers which all have the same floor, so you can break the problem up into intervals where floor(x/2) is constant. On [0, 2), floor(x/2) = 0, on [2, 4), floor(x/2) = 1, on [4, 6), floor(x/2) = 2, etc. So in each interval you are integrating e^(x/2) multiplied by e^0 or e^-1 or e^-2 etc. Effectively the same integral 1000 times, and the different limits and constants balance out in the end (try it to see that).
Re:A Simple Calculus Exercise by jrumbut on Monday April 17, 2023 @02:55AM (#35597531)
It's definitely a tricky problem for a student. The reason that everyone likes it is that this is exactly the kind of problem you run into when you need to solve an integral in the real world.

Once a year at least I run into a math situation like this. Obviously in some professions it will be much more (or less) often.

Exponents, floor, ceiling, and absolute value are very frequently part of the problem.

The approach of graphing the function, breaking it into components, and seeing if any of them are periodic, are all important steps toward a solution (more so than the symbolic manipulation because that might either be a big mess or even unavailable).

Often you'll end up using numerical methods to approximate the solution, but if you can come up with a closed form solution that's much nicer.

Re:A Simple Calculus Exercise by arbitrandomuser on Monday April 17, 2023 @11:26AM (#35602194)
> Often you'll end up using numerical methods to approximate the solution, but if you can come up with a closed form solution that's much nicer. Also even with the example in the post , thinking about the problem at first and exploiting it's periodicity before naively integrating numerically over the entire limit affords much faster computation. Although might not be specific to this example , utilising such symmetries can sometimes turn even a numerically intractable problem or a problem that requires days / 100s of gigabytes into something one can do on their laptop in hours.
Re:A Simple Calculus Exercise by Scarblac on Monday April 17, 2023 @03:01AM (#35597571)
I see the expression "x/2 - floor(x/2)" and automatically read it as "the part of x/2 to the right of the decimal point".
Re:A Simple Calculus Exercise by hgsgm on Monday April 17, 2023 @07:36AM (#35599281)
Also called "fractional part", which makes the symmetry a bit more simply obvious.

The tricky part of the problem isn't calculus, it's in a bit of algebra that often isn't emphasized in school.

Re:A Simple Calculus Exercise by actionfromafar on Monday April 17, 2023 @03:22AM (#35597697)
I was guilty of the other extreme - I had a very hard time understanding the symbol pushing, so I tried to find numerical tricks all the time, which didn't work out too often.
Re:A Simple Calculus Exercise by itengelhardt on Monday April 17, 2023 @05:37AM (#35598533)
Man, thank you for writing floor(x/2) because I've been looking at the original post and didn't know what those silly brackets are supposed to mean.
Re:A Simple Calculus Exercise by tgv on Monday April 17, 2023 @02:31PM (#35604618)
Surprising how many people have never seen floor/ceiling notation.
Re:A Simple Calculus Exercise by mjd on Monday April 17, 2023 @08:03AM (#35599501)
1. Look at the graph! You can see that the graph, between 0 and 2, is a straight line through the origin.

2. On the interval (0,2), the expression x/2 is a number less than 1. The floor of this number is zero.

Re:A Simple Calculus Exercise by shortrounddev on Monday April 17, 2023 @09:45AM (#35600611)
> I'm hoping that's normal

The vast majority of people on the planet do not know calculus and will never need to, so yes it is completely normal

Re:A Simple Calculus Exercise by pastaguy1 on Monday April 17, 2023 @10:05AM (#35600862)
calc 2 was the hardest for me, and anecdotally many others. hang in there!