Monday, 2 January 2017

halacha - Why does this app require me to agree not to use it on Shabbat?


I downloaded a Shabbat Alert app for my iPad, because i needed an alarm that would shut off after a few minutes. It worked fine (except that my iPad was muted), and it seemed to be quite halachic. In fact, perhaps it even went above and beyond.


Before it let me do anything, it made me "sign" an agreement that i wouldn't use the app on Shabbat.


Is there any halachic basis for requiring an agreement like this?




fourier transform - Tips for improving pitch detection



I'm working on a simple web app that allows the user to tune his/her guitar. I'm a real beginner in signal processing, so don't judge too hard if my question is inappropriate.


So, I managed to get the fundamental frequency using a FFT algorithm and at this point the application is somehow functional. However, there is room for improvement, right now I send raw pcm to the FFT algorithm, but I was thinking that maybe there are some pre/post algorithms/filters that may improve the detection. Can you suggest any?


My main problem is that when it detects a certain frequency it shows that frequency for 1-2sec and then jumps to other random frequencies and comes back again and so on, even if the sound is continuous.


I'm also interested in any other type of optimization if one has experience with such things.



Answer



I'm guessing the other frequencies it gets are harmonics of the fundamental? Like you're playing 100 Hz and it picks out 200 Hz or 300 Hz instead? First, you should limit your search space to the frequencies that a guitar is likely to be. Find the highest fundamental you're likely to need and limit to that.


Autocorrelation will work better than FFT at finding the fundamental, if the fundamental is lower in amplitude than the harmonics (or missing altogether, but that's not an issue with guitar):


enter image description here


You can also try weighting the lower frequencies to emphasize the fundamental and minimize harmonics, or use a peak-picking algorithm like this and then just choose the lowest in frequency.


Also, you should be windowing your signal before applying the FFT. You just multiply it by a window function, which tapers off the beginning and end of the waveform to make the frequency spectrum cleaner. Then you get tall narrow spikes for frequency components instead of broad ones.



You can also use interpolation to get a more accurate peak. Take the log of the spectrum, then fit a parabola to the peak and the two neighboring points, and find the parabola's true peak. You might not need this much accuracy, though.


Here is my example Python code for all of this.


continuous signals - Sinusoid with increasing frequency



How would you describe this signal? It's like a sinusoid but as if its frequency was constantly increasing: could you write down a mathematical description? Thanks. And no, this is not homework...


enter image description here



Answer



Frequency is more likely decreasing (period is getting longer). This is a sweep sine signal or as some people used to call it - chirp tone. No point in rewriting the literature, so here are some links with very good explanation for both linear and exponential frequency change.


For linear sweep you get:


$$s(t)=\sin\left(\omega_1t+\frac{\omega_2-\omega_1}{T}\cdot \frac{t^2}{2}\right) $$


where:


$\omega_1 $, $\omega_2$ - initial and final angular frequency respectively


$T$ - sweep duration.




Meng Q., et al. - Impulse Response Measurement With Sine Sweeps and Amplitude Modulation Schemes


Farina A. - Advancements in impulse response measurements by sine sweeps



Sunday, 1 January 2017

mishna - Reasons for divorcing a woman (sourcing a chiddush)


The Mishna in Gittin 9:10 provides a few different interpretations of ערות דבר (Deuteronomy 24:1). While the school of Shammai hold that for a man to divorce his wife he needs to find significant fault with her (דבר ערוה - possibly a crime of licentiousness), it is the opinion of the school of Hillel that he may divorce her if she only burnt his food. Rabbi Akiva's opinion, which is the most permissive of the three, is that he may even divorce her if he found another women whom he prefers. The language of the mishna in question is as follows:



בית שמאי אומרים לא יגרש אדם את אשתו אלא אם כן מצא בה דבר ערוה שנאמר כי מצא בה ערות דבר ובית הלל אומרים אפילו הקדיחה תבשילו שנאמר כי מצא בה ערות דבר רבי עקיבא אומר אפילו מצא אחרת נאה הינמה שנאמר והיה אם לא תמצא חן בעיניו


The school of Shammai say: A man may not divorce his wife unless he finds in her a matter of lewdness, as it says, "If he finds in her an unseemly thing" (Deuteronomy 24:1), but the school of Hillel say: Even if she burnt his food, as it says, "If he finds in her an unseemly thing". Rabbi Akiva says: Even if he found one more beautiful than she, as it says, "If she should not find favour in his eyes" (ibid.)



I have heard it said that the reason for the permissiveness of Rabbi Akiva and the school of Hillel is that if we interpret the passage as do the school of Shammai then every woman who is divorced by her husband will be suspected of adultery. By technically allowing divorce to occur for trivial matters, we preserve the dignity of Jewish women who, once divorced, may be suspected of having done nothing more heinous than burn their husbands' food - or of being guilty of nothing more than being married to a womaniser.


I am trying to find the source for that particular chiddush, which I think is very clever. To my mind, it sounds fairly late - maybe 19th/20th century - and I don't know how to go about finding it. If anybody has heard it before and can provide me with a source, I would very much appreciate it.




Answer



I have recently found what may be the earliest printed example of this drosh, in an unattributed passage in R' Baruch haLevi Epstein's Torah Temimah. It commences on p353, about halfway through the paragraph that begins with ודעת ר' עקיבא, and continues until the end of the paragraph on the following page.


Unfortunately, R' Epstein was a notorious plagiarist himself notes in his introduction that he didn’t always remember where he’d heard things, so it is impossible to say with certainty that he was the originator of this clever interpretation, although he does show himself elsewhere in his Mekor Baruch to be interested in the plight of women, and a 19th-20th century origin makes sense.


fft - Why does a pole close to the unit circle result in an enhanced Q-factor?


I have the following pole zero plot (in Z-domain) of a digital filter, where its poles lie far away from the unit circle, with its corresponding frequency response:


enter image description here


On the other hand I have this one:


enter image description here


Could someone explain me why exactly the poles give such a change in Q-factor? I expected that the closer a pole to the unit circle the less high the Q-factor would be.


EDIT: a pole closer to the unit circle will on one hand mean an "stronger" presence of a certain frequency it won't be decaying exponentially. But on the other hand a pole on the circle would mean a marginally stable system. In other words this means having a frequence which is perfectly present results in a +/- unstable system. Isn't that contradictory?


Thank you




Answer



Suppose some $H(q)=\frac{A(q)}{B(q)}$ where q is some complex variable and $A,B$ are functions of $q$.


Whether in the s or z planes, to evaluate the magnitude of $H(q)$ at some $q$, you evalaute and sum all distances from $q$ to the locations of the zeroes (i.e. the magnitude of $A$) and similarly for $B$ and create the fraction above for that specific $q$.


When does $H(q)$ becomes big? When either its nominator is big...OR its denominator is very small. In fact, if the denominator was ever to become exactly zero, then $H(q)$ would "shoot to infinity". It would acquire a very large value.


When does $H(q)$ becomes small? When either its nominator is small...OR its denominator is very big. The smallest value $H(q)$ can acquire is zero.



...why exactly the poles give such a change in Q-factor?



Given the location of the poles in your diagrams, it is useful to see what happens as your $q$ (or a particular $z$, in the case of the z-plane), approaches the bearing of the pole. In other words, as the $z$, changes frequency and walks around the z-plane, it approaches the location of the pole. EXACTLY AT the bearing of the pole, the distance to the zero is maximum. BUT! the distance to the pole is at its minimum. Therefore, the denominator becomes small and the response "shoots to infinity".


When the pole is closer to the center of the circle, its distance to the particular $z$ value is large. The closer the pole moves to the edge of the circle the smaller its distance will be with a particular $z$ and the higher the output of $H$ will be.



To explain the "peakiness" (or "...Q-factor...") you have to look at the rate by which the distance to the pole is diminishing as $z$ approaches the bearing of the pole.



...a pole closer to the unit circle will on one hand mean an "stronger" presence of a certain frequency it won't be decaying exponentially. But on the other hand a pole on the circle would mean a marginally stable system. In other words this means having a frequence which is perfectly present results in a +/- unstable system. Isn't that contradictory?



When examining the response of a system via the z-transform, the "presence of a frequency" means that the system resonates at that frequency. At extreme conditions, the system is so marginally stable that if you happen to excite that frequency even by a tiny little amount, it will go into oscillations that might take a very long amount of time to die out. In other words, the system will "ring".


A prime example of this are 1-pole resonators. These are bandpass filters with very high Q-factor. If you pass audio through such a resonator, you will hear the filter ringing as it effectively resonates at its own frequency.



...How should I modify my pole zero plot if I'd like to render undershoot in stead of overshoot like here?



If you are asking how to generate a notch filter, instead of a resonator (i.e. a filter that "cuts" one specific frequency instead of boosting it), then you can simply subtract the output of the 1-pole resonator from the rest of the signal OR, you could try to create a "well". A region of the z-plane where the conditions are such, for your $H$, that it dips to zero at a specific bearing to a particular $z$.



Have a ponder about how that looks like and if you cannot "see it", have a look at this link.


Hope this helps.


inorganic chemistry - Why is carbon dioxide nonpolar?


I understand that polarity corresponds to an electronegativity difference and that the larger the electronegativity difference, the more polar the bond.


However, I have read that carbon dioxide is nonpolar. This doesn't make sense to me.


In carbonyl compounds, the carbonyl carbon is partially positive and thus carbonyls are polar. $\ce{CO2}$ is simply two such units bonded together, so wouldn't it be that you would have an even more positive carbon and two partially negative oxygens causing $\ce{CO2}$ to be overall polar?


On top of that, $\ce{CO2}$ dissolves to a much larger extent in water compared to $\ce{O2}$, despite both molecules supposedly being nonpolar.



Answer




so wouldn't it be that you would have an even more positive carbon and 2 partially negative oxygens




Yes, your analysis is correct to this point. A chemist would say that the bonds in $\ce{CO2}$ are polar (or polarized) and therefor each $\ce{C=O}$ bond has a bond dipole moment. However the molecule itself is linear and the two bond dipole moments are oriented 180 degrees with respect to one another and cancel each other out, so overall the molecule does not have a dipole moment and is non-polar.


enter image description here


EDIT: There are a couple of reasons why $\ce{CO2}$ is more soluble in water than $\ce{O2}$. Because the two $\ce{C=O}$ bonds in $\ce{CO2}$ are polarized (whereas in $\ce{O2}$ the bond is not polarized) it makes it easier for the polar water molecule to solvate it and to form hydrogen bonds. Both of these factors will stabilize a $\ce{CO2}$ molecule more than an $\ce{O2}$ molecule in water; stabilization translates into greater solubility. Another factor enhancing the solubility of $\ce{CO2}$ in water is the fact that $\ce{CO2}$ reacts with water to set up an equilibrium with carbonic acid. $$\ce{CO2(aq) + H2O <=> H2CO3(aq)}$$ This reaction will also enhance $\ce{CO2}$'s solubility in water compared to oxygen which does not react with water.


size - What is the most difficult page of Talmud?



Which blat Gemara (Bavli, Vilna edition) has the largest quantity of Talmudic text or the most complex and difficult to understand concepts?




Answer



If you're just looking for long talmudic text, there are others in Brakhot with little commentary: See Brakhot 56b, 58.


Difficult sugyas with little Talmudic text and plentiful Tosafot/Rashi are qualitatively longer (and scarier!) than the more aggadic, pshat texts. There are a few in Niddah that make you hold your breath when you first turn the page onto them: See Niddah 10a, 18, 67a.


The longest battle, imho, are the four days studying masekhet kinim.


readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...