Wednesday, 27 July 2016

parshanut torah comment - Why didn't Mordechai keep Mitzvos -- serious edition


It says in the Megilla "ויאמרו עבדי המלך אשר בשער המלך למרדכי מדוע אתה עובר את מצות המלך" - "The servants of the King (who were in the King's gates) asked Mordechai 'Why do you go against the command of the king'"?


It's known (Esther Rabbah 3:10) that "the King" in the Megilla refers to Hashem. Why did Mordechai do an Aveira?




Answer



I once heard an explanation - will have to see if I can find the source - that these other servants (Jews, presumably) held with the opinion later expressed by Rambam (Hil. Yesodei Hatorah 5:1,4) that one who risks his life to keep mitzvos when not required to do so (i.e., when it's not one of the "big three," the non-Jew is doing it for his own benefit, it's not in public, and not at a time of religious persecution) is "liable for his own death."


In this case, then, the bowing wasn't being commanded as an act of idolatrous homage (or, even if it was, it might have been a case of עובד מיראה - see Tosafos to Sanhedrin 61b, ד"ה רבא). They thus protested that Mordechai is transgressing the halachah in endangering his life for this purpose.


(His reply, then, was אשר הוא יהודי - he is a prominent Jew and as such has to hold himself to a higher standard to make a public kiddush Hashem - see the second answer of Tosafos ibid.)


halacha - Mail Delivery on Shabbos


Can you take in the mail on Shabbos?



Answer



Certainly some mail deals with matters which are inappropriate reading material for Shabbos and one would not be willing to use them for other purposes, accordingly this mail is muktzeh and cannot be handled on Shabbos. (See Mishneh Berurah 307:56, It is not clear to me that one is prohibited to handle mail which one does not know to be in such a category out of fear it is.)


Regarding other types of mail:


The Bi'ur Halachah (340:14, הניר ), as I understand it, explains that when a letter is enclosed in an envelope then according to everyone ripping it open is מקלקל (destroying) and only prohibited by Rabbinic law (though he continues to cite an opinion of Rashi which may render this not to be the case). HaRav Shlomo Zalman Aurbach zt'l challenges this opinion since typically destroying a "utensil" for the sake of extracting its contents is permitted (provided, of course, no melachah is involved). Insofar as/provided that one is no making a neat slit to use the envelope to store the letter but simply destroying it and discarding it, it should be permitted. (See שמירת שבת בהלכתה כח הערה טו). Rav Moshe Feinstein zt'l, on the other hand, agrees that opening an envelop is prohibited and therefore it's muktzeh (אגרות משה או"ח ח"ה סי' כא ס"ק ה, interestingly he notes with the advent of telephones the leniencies associated with reading letters which may contain urgent information is no longer relevant). [Of course this is the type of thing one really needs to discuss with their Rav]



Not all mail is enclosed in an envelope. If my subscription to Jewish Observer showed up a couple days late it would not require any tearing for me to read the articles. Such mail certainly does not become muktzeh (simply) because it is forbidden to open the (non-existent) envelope.


Regarding mail which is brought from outside the techum (the perimeter 2000 amos around the settlement one is located in, past which it is prohibited to travel on Shabbos):


An item which is brought on Shabbos from outside of the techum for the sake of a Jew is prohibited for that Jew to benefit from (until enough time has elapsed after Shabbos for the action to have been completed then). Other Jews, however may benefit from the item, and furthermore even to the Jew for whom it was brought the item is NOT muktzeh. (See O.C. 325:8 and Mishneh Berurah 307:56, though the above mentioned אגרות משה appears strict in this regard).


Certainly if it can be verified by local Rabbonim that the mail delivered on Shabbos arrives within the techum prior to Shabbos (or presumably when the mail originates within the techum and delivery is such that it would not be removed prior to delivery) the outside the techum issue is not applicable.


It would seem that there may be basis to bring in the mail from the mail-box (provided there is an eruv). If however there is mail which IS muktzeh mixed in with mail permitted to be handled it probably constitutes a teruvos (mixture) to which the laws of borrer (selecting) apply and one could only select the permitted mail, by hand, immediately prior to when one is going to read it. On the other hand, there might be basis to handle the entire mixture at once, especially if the majority is permitted (probably not though).


So it seems to me. There are a lot of different issues at play, many of which have a number of divergent views among the Poskim, certainly something to get a psak from your Rav about before acting l'maaseh.


marriage - Why only 100 zuz to a widow/divorcee?


In a Ketubah, the Rabbis instituted that a man should obligate himself to pay his wife, should he chose to divorce her (or he dies). If she had never been married before, he obligates himself to pay 200 zuz. If she was previously married, he obligates himself to pay 100 zuz. (See Rambam Hilchot Ishut 10:7) [That is the minimum, he could offer more if he wants]


The Bartenura on Mishnayot Peah 8:8, says that 200 zuz is enough to support someone for one year.


If that's the reason the husband promises 200 zuz, why is he only obligated to pay 100 zuz to a widow/divorcee? Why did the Rabbis feel it was enough to support her for only half a year?


If that's not the reason, what is the reason for the discrepancy between a previously unmarried woman, and a previously married woman?



Answer




I'm not sure if I understood this correctly, feel free to point put any mistakes.


The Yad Eliyahu, after much back and forth, seems to say that:




  • The reason for a monetary obligation is, as the Rambam (Hilchot Ishut 10:7) says, in order to make sure that it should not be of little import for a man to kick his wife out of the house.




  • The Rabbis agreed that 100 zuz is enough to ensure this. (even though if a person is wealthy 100 zuz is nothing, this is a substantial sum for a poor person and therefore the Rabbis settled on this sum, so that law would equally apply to everyone)





  • There is an argument in the Talmud (Ketubot 10A) if the money obligated by the Ketubah is a Biblical or Rabinical Decree. According to the one who says it is Biblical, we learn it out from Exodus 22:15-16, "he shall pay money according to the dowry of virgins.". From Devarim 22:29, we learn that the dowry of virgins is 50 Shekalim.




  • [It would appear that everyone agrees that the monetary obligation for a widow etc. is Rabinical, the only discussion is whether the monetary obligation for a virgin is the same]




  • However, most agree that (at the very least the amount of) the monetary obligation is Rabinical. The Rabbis who instituted the amount would have settled by 100 for everyone, but because the verse does mention that a virgin's price is 50 Shekalim (200 zuz), the Rabbis made that the monetary obligation for a virgin, leaving the monetary obligation of a widow etc. at the price they already thought was enough.




See Kobetz Al Yad HaChazaka as well.



local features - difference between Gabor and log-Gabor function


I am reading a paper using log-gabor filters for feature detection. I was thinking about the difference between Gabor filters and log-gabor filters. Can anyone tell me the difference(s), and a way to implement them? Thanks in advance.



Answer



The 1D gabor filter has the following form in the frequency domain:


$$G_{b(\sigma,\omega_0)}(\omega) = \text{exp}\left(-\frac{\sigma^2}{2}(\omega - \omega_0)^2\right)$$


The 1D log-gabor filter is:


$$G_{l(\sigma,\omega_0)}(\omega) = \text{exp}\left(-\frac{\ln^2(\omega/\omega_0)}{2\ln^2(\sigma)}\right)$$


Log-gabor filters are used because they have 0 DC component for arbitrary large bandwidth, and size distribution of features in an image is often logarithmic.


The excellent paper On the Choice of Band-Pass Quadrature Filters by Djamal Boukerroui, J. Alison Noble and Michael Brady explains further differences for these two filters as well as others.


Here is some MATLAB code for the 2D version:



[rows, cols] = size(I);

% FFT mesh
[ux, uy] = meshgrid(([1:cols]-(fix(cols/2)+1))/(cols-mod(cols,2)), ...
([1:rows]-(fix(rows/2)+1))/(rows-mod(rows,2)));
ux = ifftshift(ux); % Quadrant shift to put 0 frequency at the corners
uy = ifftshift(uy);

% Convert to polar coordinates
th = atan2(uy,ux);

r = sqrt(ux.^2 + uy.^2);

% Create spectrum
filterFFT = 1.0/wavelength;
filterFFT = exp((-(log(r/filterFFT)).^2) / (2 * log(sigma)^2));
filterFFT(1,1) = 0;

% Filter image
I_filtered = real(ifft2(fft2(I) .* filterFFT));


Advantage of 0 DC


The advantage of having 0 DC component is that the response of the filter doesn't depend on the mean value of the signal. It also means you don't have an infinite impulse response. The Gabor filter has a small non-zero component around DC that is usually removed.


For feature detection, say you designed a filter kernel to match a step (1D) or edge (2D). If the filter had a DC component then the response would vary with the mean image level. e.g. consider the sobel edge detector, and the same kernel with increased values.


I = double(imread('the_image.jpg'));
I = I(:,:,1);
f1 = [[-1 0 1];...
[-2 0 2];...
[-1 0 1]];
f2 = [[0 3 4];...
[1 3 5];...

[0 3 4]];
I1 = conv2(I,f1,'same'); images(I1); colorbar; pause;
I2 = conv2(I,f2,'same'); images(I2); colorbar; pause;
I3 = conv2(I+100,f1,'same'); images(I3); colorbar; pause;
I4 = conv2(I+100,f2,'same'); images(I4); colorbar; pause;

In this code f2 = f1 + 3. Only convolving with f1, which has 0 DC, gives the same result when the mean value of I is changed. The image responses 'look' the same, but only the 0 DC one is useful for feature detection.


Matlab produces two unknown spikes in custom FFT


I'm making a relatively small Cooley–Tukey FFT in Matlab and I'm noticing unusual spikes in the result compared with Matlab's own FFT.


The figure below shows the signal flow of my program. It's a standard Cooley-Tukey scheme. Signal Flow


My results when computing the FFT of a 16 Hz sinusoid are shown below


enter image description here



And Matlab's own FFT is shown below


enter image description here


Clearly I'm missing something. What could be the cause of the two large spikes in the middle? I conjecture that it has something to do with how the even and odd parts are combined, for instance if there is a discontinuity there. I'm really not sure though.


Any help is greatly appreciated!


The code I'm using is as follows


clear all

% Generate input data sequence and plot
N=128;
f1=16;

num_cycles=2;
fs=f1*N/num_cycles;
x_time=0:1/fs:num_cycles/f1-1/fs;
x=sin(x_time*2*pi*f1);
plot(x_time,x);

% split inputs into even and odd samples and compute fft of each division
X_o=x(1:2:N);
X_e=x(2:2:N);


fft_x_o=fft(X_o);
fft_x_e=fft(X_e);

% Generate base twiddle factor
W32=exp(-1i*2*pi/32);

% Combine fft even and odd with twiddle factors to produce final output
for k=0:N-1
if k X(k+1)=fft_x_e(k+1)+(W32^k)*fft_x_o(k+1);

else
X(k+1)=fft_x_e(k+1-N/2)+(W32^k)*fft_x_o(k+1-N/2);
end
end

% plot butterfly fft and matlab fft
FFT_xaxis=0:fs/N:fs-fs/N;
figure
plot(FFT_xaxis,abs(X))
title('Butterfly FFT')

xlabel('Frequency')
ylabel('Magnitude')
matlab_fft=fft(x);
figure
plot(FFT_xaxis,abs(matlab_fft))
title('Matlab FFT')
xlabel('Frequency')
ylabel('Magnitude')

Answer



The following is the corrected code. It seems you have the problem in the twiddle factor and the selection of even and odd samples of x[n]...



N=128;
f1=16;
num_cycles=32;
fs=f1*N/num_cycles;
x_time=0:1/fs:num_cycles/f1-1/fs;
x=sin(x_time*2*pi*f1);
plot(x_time,x);

% split inputs into even and odd samples and compute fft of each division
X_o=x(2:2:N); % odd samples begin at x(2) --> x[1] in sequence

X_e=x(1:2:N); % even samples begin at x(1) --> x[0] in sequence

fft_x_o = fft(X_o, N/2);
fft_x_e = fft(X_e, N/2);

% Generate base twiddle factor
WN=exp(-1i*2*pi/N);

% Combine fft even and odd with twiddle factors to produce final output
for k=0:N-1

if k X(k+1) = fft_x_e(k+1)+(WN^k)*fft_x_o(k+1);
else
X(k+1) = fft_x_e(k+1-N/2)+(W3N^k)*fft_x_o(k+1-N/2);
end
end

% plot butterfly fft and matlab fft
FFT_xaxis=0:fs/N:fs-fs/N;
figure

plot(FFT_xaxis,abs(X))
title('Butterfly FFT')
xlabel('Frequency')
ylabel('Magnitude')
matlab_fft=fft(x);
figure
plot(FFT_xaxis,abs(matlab_fft))
title('Matlab FFT')
xlabel('Frequency')
ylabel('Magnitude')

Tuesday, 26 July 2016

grammar - What is the difference between べからず and べからざる?


In my JLPT practise book, I have the following question:




A:噂にまどわされる_____、とは言うものの・・・。


B:つい、信じちゃうよね。



  1. べく 2.べき 3.べからざる 4. べからず



I knew the answer was between 3 and 4, but I couldn't make a final decision on why I would choose one over the other. According to the book, the answer is 4.


According to the book's explanation, at least as I understand it, べからざる means something can't be allowed, and べからず means something must not happen.


However, both have a certain amount of logical sense in the question above. Assuming I understand it correctly (which I probably don't), it's either saying "we can not allow ourselves to be deceived by rumours", or "we can't be deceived by rumours", depending on whether we use べからざる or べからず.



What is the difference that I'm not seeing?



Answer



SUMMARY


Options 3 & 4 both mean "must not" because they are both variations on べきではない tested at JPLT N1 (in fact べからざる is a variation on べからず (see on)). The trick is to understand which best fits the context of the sentence when we apply "usual" JLPT level N1 definitions but even if we do not fully understand the context we can still get the question right if we know the grammatical rules (接続の仕方).


TECHNICAL DEFINITIONS


べからず is used for injunctions (ie prohibitions such as "Do not..") and is an old written form not generally used but sometimes written on bulletin board/notices. As a result it is quite likely to appear in a quotation. eg:



(公演で)「芝生に入るべからず」|([Notice] at the park) "Keep off the grass"



べからざる is the form of べからず that modifies nouns ie VるべからざるN. eg:




彼は我がチームには欠くべからざる選手である。|Mr A is (an) indispensable (player) on the team.



(And, just for the sake of completeness, べき is the form of べく that modifies nouns ie VるべきN.]




APPLICATION (COMPREHENSIVE ANSWER)


If we apply these principles to the question:



A:「噂にまどわされる_____、とは言うものの・・・。」


B:「つい、信じちゃうよね。」



1.べく 2.べき 3.べからざる 4. べからず



Step 1: Read and (try to*) understand the context of the passage to eliminate the obvious incorrect answers:


A: "Although it says _ be distracted by the rumours,...."


B: "I just took them as face value, didn't I."


The gap is most likely to be filled by a prohibition (ie an injunction such as "Do not...") rather than a command ("Do...."). This eliminates options 1 & 2.


Step 2: Look at next option: 3. べからず is used for injunctions and this is a quotation so without looking at 4 we know this is a good candidate for the correct answer.


Step 3: Option 3 is confirmed as correct by looking at the remaining option: 4 べからざる is just a variation on 3. べからず which is used to modify nouns (VるべからざるN). Although it literally means the same as 3 grammatically it does not fit as well / at JLPT level N1.


*Note: I am sure somebody can improve on my translation but it is good enough for the question!


References: The references I used to write this answer were 日本語表現文型辞典 & 総まとめ 文法N1 but once you've done enough questions you can intuitively "guess" the right answer just using step one (that's what I did here and last July).



electronegativity - Relative strengths of hydrogen bonds



Order of hydrogen bond strength:


$\ce{O-H...N}$ > $\ce{O-H...O}$ > $\ce{N-H...N}$ > $\ce{N-H...O}$. Why is that so?



According to me $\ce{O-H...O}$ should have the maximum strength while $\ce{N-H...N}$ should have the weakest hydrogen bonds based on the fact that oxygen is more electronegative than nitrogen. It would develop a higher $\delta^-$ charge and the hydrogen attached to it will have a higher $\delta^+$ charge which would make the hydrogen bonding stronger.


I can't reason out the order given in my textbook. After observing it, all I can guess is that oxygen being highly electronegative leads to higher $\delta^+$ charge on hydrogen while nitrogen being less electronegative easily shares its electron cloud with hydrogen, making the hydrogen bond stronger.


I am not sure about this reason as according to this it is more stable for hydrogen to make a hydrogen bond with a less electronegative element and possibly even an electropositive element, (unless and until the hydrogen is attached to a highly electronegative element), which does not occur in normal circumstances.


It would be great if anybody could help me figure out the reason for the above trend.




Answer



As a short answer, Hydrogen bonds (for elementary chemistry) are formed with donation of lone pair of a lewis base into LUMO of H attached to a highly electronegative atom. A better donor makes a better bond and more electronegative atom makes a better bond. From my experience, the second factor overrides the first one in most cases.


N is a better donor than O and H in $\ce{O-H}$ is a better acceptor than H in $\ce{N-H}$.


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 「ない...