In $E=hf$, can $f$ assume any positive value? (Beginner) The energy of photon is given by the equation $E=hf$, where $h=$ Planck's constant, and f=frequency of radiation. Is f quantized, or can it assume any value? 
If it can assume any value, then wouldn't this mean that the energy of photons is not quantized? If f can be any value from a continuous series, this would mean that for any number you imagine, there will always be another number that when multiplied by h gives you that first number. So $E$ could assume any value. 
However, we know that $E$ is indeed quantized, so could someone please point out the flaw in my reasoning? 
PS: I don't believe this question is a duplicate, since it addresses wether radiation frequencies are discrete in the context of an equation. The answers, therefore, aren't limited to "no, the EM spectrum is not quantized" but also explain that for a given frequency, the photons' energy is quantized. In other words, while the questions are similar, I believe that both the question and the answers have angles that are different enough to justify not being duplicates. For example, if the answers to this question had not addressed the photon energy, I would still be confused as to why so many textbooks say that energy is quantized. This isn't the kind of answer that the duplicates would require, however. Thank you for linking the other posts, though, as they could be useful for someone looking for a different answer.
 A: Yes, $f$ can have any value. This must be the case because of redshift and blueshift. If you start with a photon with frequency $f_0$, then by switching to a new reference frame that either moves towards or away from the photon source, you can see the photon as having any frequency you like.
Energy is not quantized - that simply isn't a principle of physics. One thing that is quantized is photon number. This means that if you know that the light you're looking at has a certain frequency $f$ and you measure its energy, you will get $nhf$ with $n$ some integer number, representing the number of photons. This means that if you restrict yourself to only collecting photons with a specific frequency, the energy you collect will come in little quantized chunks, but that's only if you filter out all but one frequency. Energy can come in any amount, so it isn't quantized in general.
A: Suppose you have an electromagnetic field(which is made up of photons) oscillating with frequency $f$ inside a cavity(resonator like two mirrors). Because of quantization, the field cannot have an arbitrary value of energy but only integer multiples of $hf$(i.e., $nhf$). This is what is meant by energy quantization.
A: There are two different kinds of "quantization" that are relevant to your question. One is related to frequencies on a guitar string, the other one is truly quantum mechanical.
A photon is the quantum of the electromagnetic field. In particular, a photon of frequency $f$ corresponds to a wave with wavelength $\lambda = c / f$ where c is the speed of light.
(1) If there are no boundary conditions all frequencies are allowed, and the energy of the field indeed can take any value. However, for a field of given frequency, the energy comes in quanta, given by $E = hf$. That is the nature of quantum mechanical quantization.
An example of this is the photoelectric effect (https://en.wikipedia.org/wiki/Photoelectric_effect). Note that the frequency of the light is filtered first. Then it is observed that electrons are excited into the continuum only beyond some threshold frequency. Increasing the intensity, which for classical fields corresponds to increasing the energy, does not do the job. 
(2) If there are boundary conditions for the field, e.g. inside a box of length L and at the edge of the box the field has to vanish, this imposes a condition on the wavelength. I.e. a whole number of wave troughs and wave crests has to fit inside the box. This gives "quantized" wavelengths
\begin{equation}
\lambda_n = \frac{2L}{n},
\end{equation}
and corresponding frequencies
\begin{equation}
f_n =n \frac{c}{2L} \equiv n f_0.
\end{equation}
In this situation, the energy of the field truly can only take certain values, given by $E = hf_n$. Of course, classically the energy of the field does not depend on the frequency at all. The quantization of the frequencies, however, is a classical effect (i.e. has nothing to do with quantum mechanics), completely equivalent to e.g. the "allowed" frequencies on a guitar string. 
A: I like this question.  It makes an interesting point about the nature of variables.  The question is how one introduces periodicity? A period is how long does it take for a cycle of an event to occur.  If we assume we can get infinite precision then there is no reason a period needs to be rational.  The frequency is just the inverse of the period, so it doesn’t need to be rational either.  If you consider the case of angular frequency, you must consider that pi is a factor, since pi is transcendental, it is irrational, since a rational times an irrational number is irrational. All angular frequencies are irrational, so they would require infinite extensions to write completely.  While perplexing, we can still talk about integer multiples of periods, and thus integer multiples of frequency.  
Our world though does not permit us to write with infinite precision, so while we can grasp the concept of representing numbers with infinite precision, it is a convenience that allows us the ability to logically calculate values, but is a type of fiction.  This issue is a principal reason that we have to turn to concepts like the uncertainty principle in order to understand our world.
