2013년 1월 31일 목요일

이중슬릿



This is a classic example of interference effects in light waves. Two light rays pass through two slits, separated by a distance d and strike a screen a distance, L , from the slits, as in Fig. 22.10.
  
Figure 22.10: Double slit diffraction
\begin{figure}
\begin{center}
\leavevmode
\epsfxsize=2.8 in
\epsfbox{fig22-8.eps}\end{center}\end{figure}

If d < < L then the difference in path length r1 - r2 travelled by the two rays is approximately:
r1 - r2 $\displaystyle\approx$ dsin $\displaystyle\theta$
where $\theta$ is approximately equal to the angle that the rays make relative to a perpendicular line joining the slits to the screen.If the rays were in phase when they passed through the slits, then the condition for constructive interference at the screen is:
dsin $\displaystyle\theta$ = m$\displaystyle\lambda$ ,m = $\displaystyle\pm$ 1, $\displaystyle\pm$ 2,...
whereas the condition for destructive interference at the screen is:
dsin $\displaystyle\theta$ = (m + $\displaystyle{1\over 2}$)$\displaystyle\lambda$ ,m = $\displaystyle\pm$ 1, $\displaystyle\pm$ 2,...
The points of constructive interference will appear as bright bands on the screen and the points of destructive interference will appear as dark bands. These dark and bright spots are called interference fringesNote:
  • In the case that y , the distance from the interference fringe to the point of the screen opposite the center of the slits (see Fig.22.10) is much less than L ( y < < L ), one can use the approximate formula:
    sin $\displaystyle\theta$ $\displaystyle\approx$ y/L
    so that the formulas specifying the y - coordinates of the bright and dark spots, respectively are:
    y Bm = $\displaystyle{\frac{m\lambda L}{d}}$ brightspots
    y Dm = $\displaystyle{\frac{(m+{1\over2})\lambda L}{d}}$ darkspots
    The spacing between the dark spots is
    $\displaystyle\Delta$y = $\displaystyle{\frac{\lambda L}{d}}$
  • If d < < L then the spacing between the interference can be large even when the wavelength of the light is very small (as in the case of visible light). This give a method for (indirectly) measuring the wavelength of light. (See Ex.6 at the end of this Chapter.)
  • The above formulas assume that the slit width is very small compared to the wavelength of light, so that the slits behave essentially like point sources of light.

isentropic process 등엔트로피 과정



Example: The minimum pressure and temperature in an Otto cycle are 100 kPa and 27oC. The amount of heat added to the air per cycle is 1500 kJ/kg. Determine the pressure and temperatures at all salient points of the air standard Otto cycle. Also, calculate the specific work and the thermal efficiency of the cycle for a compression ratio of 8 : 1. [Take Cp/Cv = 1.4 and Cv = 0.72 kJ/kg K]
 
Solution:       Given that :
 
Calculate Pressure And Temperature1.JPG
 
P1 = 100 kPa
 
T1 = 27oC = 27 + 273 = 300 K
 
qs = 1500 kJ/kg
 
V1/V2 = r = 8
 
Cv = 0.72 kJ / kg K
 
Cp / Cv = 1.4
 
Analysis of process
 
Process (1-2): Rev. adiabatic compression
 
⇒ P1V1 = P2V2
 
P2/P1 = (V1/V2)
 
P2 = 100 X (8)1.4 = 1837.92 kPa
 
T2 / T1 = (V1/V2) ∏–1
 
⇒ T2 = 300 (8)0.4 = 689.22 K
 
Process (2-3):   Constant volume heat supply
 
⇒ P2/T2 = P3/T3
 
Heat supplied; qs = Cv (T3 – T2)
 
⇒ 1500 = 0.72 (T3 – 689.22)
 
⇒ T3 = 2772.55 K
 
P3 = (P2 / T2).T3 = 2772.55 X (1837.92 / 689.22)
 
⇒ P3 = 7393.48 kPa
 
Process (3-4):   Rev. adiabatic expansion
 
⇒ P3V3 = P4V4
 
⇒ P4 / P3 = (V3 / V4) = (V2 / V1)                   
 
⇒ P4 = P3 (V2 / V1) = 7393.48 (1/8)1.4 = 402.28 kPa
 
T4 / T3 = (P4 / P3)–1/ = (402.28 / 7393.48)0.4/1.4
 
T4 = T3 × (P4 / P3)–1/ = 2772.55 (402.28 / 7393.48)0.4/1.4
 
⇒ T4 = 1206.83 K
 
 Heat rejected qR = Cv (T4 – T1)
 
= 0.72 (1206.83 – 300)
 
 = 652.92 kJ/kg
 
Specific work output = wexpansion + wcompression

∫δw
 
From first law:
∫δw = ∫ δq =qs - qR
 
= 1500 – 652.92 = 847.08 kJ/kg


∴ ∏thermal = ∫δw/qs = 847.08/1500 = 0.5647          (or 56.48%)
                    

Example : In an air standard Otto cycle, the compression ratio is 7 and the compression begins at 35oC, 0.1 MPa. The maximum temperature of the cycle is 1100oC. Find
 
(a) The temperature and pressure at the cordinal points of the cycle
(b) The heat supplied per kg of air
(c) The work done per kg of air
(d) The cycle efficiency
(e) The mean effective pressure of the cycle
 
Solution: Given that:
 
Compression ratio: r = 7
 
Inlet temperature, T1 = 35 + 273 = 308 K
 
Calculate Pressure And Temperature.JPG 
Maximum temperature, t3 = 1100 + 273 = 1373 K
 
Process (1-2):   Isentropic process
 
T2 / T1 = (V1 / V2)∏–1 = (P2 / P1)–1/
 
⇒  T2 = 308 (7)1.4–1 = 670.80 K
 
Also  T3 / T4 = (V4 / V3)–1
 
⇒ T4 = T3 / r–1 = 1373 / (7)1.4–1
 
⇒ T4 = 630.42 K
 
And    P2 / P1 = (V1/V2)
 
⇒ P2 = 0.1 X´ (7)1.4
 
⇒ P2 = 1.524 MPa
 
For Isochoric process (2-3)
 
P2 / T2 = P3 / T3
 
⇒  P3 = T3 / T2 X P2 = 1.524 X (1373 / 630.42) = 3.319 MPa
 
 P3/P4 = (V1/V2)
 
⇒ P4 = 3.319 / (7)1.4 = 0.2177 MPa
 
∴ T1 = 308 K, P1 = 1 bar
 
T2 = 670.80 K, P2 = 15.24 bar
 
T3 = 1373 K, P3 = 33.19 bar
 
T4 = 630.42 K; P4 = 2.177 bar
 
(b) heat supplied per kg of air = Cv (T3 – T2)
 
= 0.718 (1373 – 670.80) = 504.18 kJ/kg
 
(c) Work done per kg of air =  ∫δw = ∫δq = 2q3 + 4q1

⇒ ∫δw = Cv (T3 - T2) + Cv (T1 - T4) = Cv (T3 - T2) - Cv (T4 - T1)

  = 0.718 (1373 – 670.80) – 0.718 (630.42 – 308) = 272.68 kJ/kg

(d) ∏cycle = ∫δw/qs = 272.68 / 504.18 X 100 = 54.08%

(e) m.e.p. = Wnet / V1 – V2 = 272.68 /V1 – V2
 
P1V1 = mRT1
 
V1 = 0.287 X  623 / 0.1 X 103 = 1.78 m3 / kg
 
V1/V2 = 7 or V2 = V1/7 = 1.78/7 = 0.254 m3 / kg
 
m.e.p. = 272.68 (kJ/kg) / (1.78 – 0.254) (m3/kg) = 178.72 kN/m2 = 1.79 bar

2013년 1월에 한 것


2013년 1월 30일 수요일

work 폴더 내의 모든 mp4파일의 확장자를 mp3로 바꾸는 펄 스크립트

#!/usr/local/bin/perl -w

use warnings;
use File::Copy qw(move);
 
opendir (DIR, "/work/");

@name = readdir(DIR);  # all names

@r_name = @name[0..$#name];
for (@r_name) {
   s/mp4/mp3/
}

print "@name\n";
print "@r_name\n";

for($i = 0; $i < $#name; $i++ )
{
#rename $name[$i], $r_name[$i];
move $name[$i], $r_name[$i] || die "Can't rename\n";
}

closedir(DIR);

2013년 1월 28일 월요일

화학평형 깁스에너지


quilibrium

Chemical equilibrium is a state in which there is no net change in the concentration of reactants and products because the forward and reverse reactions are occurring at the same rate and the Gibbs free energy value is at its minimum. 

The Gibbs free energy change of a reaction tells us what the concentration of reactants and products will be at equilibrium. For a general reaction of a moles of A, b moles of B and c moles of C combining to form n moles of N, m moles of M, and o moles of O...



If the reaction is not at equilibrium, it will proceed in the forward or reverse direction to the minimum value of the Gibbs free energy. At that point, there is no further change in the Gibbs free energy (G = 0) and the reaction is at equilibrium.

벤젠 엠오

B.                 MOLECULAR ORBITAL REPRESENTATION OF BENZENE (MO THEORY)

The bond angles of 120° in benzene suggests that C atoms are sp2 hybridised.  An alternative representation therefore starts with a planar framework and considers overlap of the p orbitals (p electrons).
(Simple MO rules)
Mix n x p atomic orbitals np molecular orbitals!
Remember ethene? (p 26)
The exact calculation of their position (shown below) is beyond our discussion.
Each MO can accommodate 2 electrons, so for benzene we see all electrons are paired and occupy low energy MO’s (bonding MO’s).  All bonding MO’s are filled.  Benzene is therefore said to have a closed bonding shell of delocalised p electrons and this accounts in part for the stability of benzene.

이상기체 등온과정

등온 과정(等溫 過程)은 계의 온도 변화가 없는 열역학적 과정을 말한다.
\Delta T = 0이 과정은 일반적으로 열저장소(열욕조)로 둘러싸인(혹은 열적으로 연결된) 계에서 일어나게 되며, 계의 열역학적 과정이 열저장소와 열교환을 통해 열저장소와 온도 평형을 이루기에 충분하도록 천천히 일어나게 된다. 등온 과정 이외에도 계의 주변과 열교환이 일어나지 않는 특별한 경우를 단열 과정이라 한다.()
이상기체의 경우, 기체의 온도는 기체 내부에 존재하는 내부에너지에 의해 결정된다. 여기서 기체의 내부에너지란 볼츠만 분포에 의해 주어지는 기체 분자들의 운동에너지의 평균값을 말한다. 만약 이 내부에너지가 일정하다면 기체의 온도 또한 일정한 값을 가지게 된다. n을 기체의 몰수라 하고 일정한 값을 갖는다고 하자.
 \Delta U = n R \Delta T = 0 \,
위 식에 이상기체 방정식을 대입하면 아래식처럼 다시 쓸 수 있다.
 \Delta (P V) = 0 \,
따라서 다음과 같은 식을 만족하게 된다.
 P_i V_i = P V = P_f V_f \,
여기에서 P_i와 V_i는 초기 상태의 압력과 부피를 말하고 P_f와 V_f는 나중 상태의 압력과 부피를 말한다. 그리고 P와 V는 열역학적 과정에서 임의의 상태에서의 기체의 압력과 부피를 나타내는 변수이다.
이상기체의 등온선 그래프
그래프에서 나타나는 곡선은 등온선으로서 P-V(압력-부피) 그래프에서 온도가 같은 점들을 연결하면 쌍곡선과 같은 모양을 갖는다. 그리고 각각의 등온선들은 P축(세로축)과 V축(가로축)에서 점근하는 모양을 갖는다. 이 그래프는 이상기체 방정식에서 구할 수 있는 다음과 같은 공식과 일치하는 결과이다.
 P = {n R T \over V} \,
열역학 제1법칙에 따르면 이상기체의 등온선은 다음과 같은 조건에 의해서도 결정된다.
 Q = W \,
여기서 W는 계에 해준 일을 나타낸다.(여기서 Q와 W는 증감하는 양을 나타내며, 미분이나 상태 함수를 나타내지는 않는다.) 위의 식이 의미하는 것은 등온 과정에서 주변의 열이 계에 흡수되면서 생겨나는 내부 에너지가 온전히(손실없이) 외부에 대한 일의 형태로 변환되는 것을 알려준다. 이는 계에 흡수된 에너지가 외부에 대한 열의 형태로 완전히 변환될 수 있음을 말해주는 것이다. 따라서 내부 에너지와 온도가 일정하게 유지되는 것이다.
노란 영역은 일을 뜻함
등온과정에서 순간시간에 대한 순간적인 일은 다음과 같은 식으로 나타낼 수 있다.
그러므로 등온과정에서 A부터 B까지의 전체 일은 위의 식을 적분한 것과 같다.
W_{A\to B}=\int_{V_A}^{V_B}dW=\int_{V_A}^{V_B}PdV
여기서 이상기체 방정식을 대입하면 아래 식과 같이 쓸 수 있다.
W_{A\to B}=\int_{V_A}^{V_B}PdV=\int_{V_A}^{V_B}\frac{nRT}{V}dV=nRT\ln{\frac{V_B}{V_A}}
그러므로 등온과정에서 아래와 같은 식을 유도할 수 있다.
W_{A\to B}=Q=nRT\ln{\frac{V_B}{V_A}}

카르노 기관의 온도-엔트로피 그래프 ; 가로선이 등온과정을 나타냄
등온과정은 여러 종류의 계에서 나타날 수 있다. 복잡한 구조를 가지는 기계나 심지어 살아있는 세포에서도 나타난다. 일부 열기관의 경우 등온과정이라 가정하고, 카르노 기관으로 근사시킬 수 있다.

win32 함수

함수원형을 코딩파일에 대응하는 헤더파일에 선언해야 함.
예) hi.cpp의 헤더더가 hi.h일 때 stdafx.h나 resorce.h에 선언하면 안 됨.

2013년 1월 27일 일요일

hi socket

#ifndef UNICODE
#define UNICODE
#endif

#define WIN32_LEAN_AND_MEAN

#include 
#include 
#include 

// Link with ws2_32.lib
#pragma comment(lib, "Ws2_32.lib")

#define DEFAULT_BUFLEN 512
#define DEFAULT_PORT 80
int main() {

    //----------------------
    // Declare and initialize variables.
    int iResult;
    WSADATA wsaData;

    SOCKET ConnectSocket = INVALID_SOCKET;
    struct sockaddr_in clientService;

    int recvbuflen = DEFAULT_BUFLEN;
    char *sendbuf = "GET / HTTP/1.1\r\n\r\n";

	 char recvbuf[DEFAULT_BUFLEN] = "";

    //----------------------
    // Initialize Winsock
    iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
    if (iResult != NO_ERROR) {
        wprintf(L"WSAStartup failed with error: %d\n", iResult);
        return 1;
    }

    //----------------------
    // Create a SOCKET for connecting to server
    ConnectSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if (ConnectSocket == INVALID_SOCKET) {
        wprintf(L"socket failed with error: %ld\n", WSAGetLastError());
        WSACleanup();
        return 1;
    }

    //----------------------
    // The sockaddr_in structure specifies the address family,
    // IP address, and port of the server to be connected to.
    clientService.sin_family = AF_INET;
    clientService.sin_addr.s_addr = inet_addr( "180.70.134.19" );
    clientService.sin_port = htons( DEFAULT_PORT );

    //----------------------
    // Connect to server.
    iResult = connect( ConnectSocket, (SOCKADDR*) &clientService, sizeof(clientService) );
    if (iResult == SOCKET_ERROR) {
        wprintf(L"connect failed with error: %d\n", WSAGetLastError() );
        closesocket(ConnectSocket);
        WSACleanup();
        return 1;
  }

    //----------------------
    // Send an initial buffer
    iResult = send( ConnectSocket, sendbuf, (int)strlen(sendbuf), 0 );
    if (iResult == SOCKET_ERROR) {
        wprintf(L"send failed with error: %d\n", WSAGetLastError());
        closesocket(ConnectSocket);
        WSACleanup();
        return 1;
    }

    printf("Bytes Sent: %d\n", iResult);

    // Receive until the peer closes the connection
    do {

        iResult = recv(ConnectSocket, recvbuf, recvbuflen, 0);
        if ( iResult > 0 )
            wprintf(L"Bytes received: %d\n", iResult);
        else if ( iResult == 0 )
            wprintf(L"Connection closed\n");
        else
            wprintf(L"recv failed with error: %d\n", WSAGetLastError());

    } while( iResult > 0 );


    // close the socket
    iResult = closesocket(ConnectSocket);
    if (iResult == SOCKET_ERROR) {
        wprintf(L"close failed with error: %d\n", WSAGetLastError());
        WSACleanup();
        return 1;
    }

    WSACleanup();
    return 0;
}

low spin complexes


Figure 9 d orbital splitting in an octahedral complex
The electrons can actually be distributed in two ways among the two sets of orbitals for complexes with 4,5,6 or 7 d electrons: occupying the lowest orbitals (low spin) or spread over both sets of orbitals (high spin). As you can see in Figure 9 (a) and (b) we have two different configurations for iron(II), which has 6 d electrons - (a) has no unpaired electrons and is thus non-magnetic and is known as low spin; (b) has four unpaired electrons and is magnetic and is known as high spin.
The magnitude of the energy gap between the two levels, , which is known as the 'ligand field splitting', determines whether we get the high spin or low spin form. If is small than the lowest energy state is when electrons are distributed over both levels and we get high spin complexes. If is large then the lowest energy state is when electrons occupy the lowest level preferentially and low spin complexes result.
The size of the splitting, , for a given metal depends on its oxidation state (charge) and on the nature of the ligand bonded to the central metal. is larger for +3 than for +2 ions, and increases as the strength of bonding between the ligand and metal increases. Thus water is a weak ligand and produces a small ligand field splitting and (usually) high spin complexes. Cyanide, on the other hand, bonds very strongly to transition metal ions with a mixture of å and ã bonding and usually produces low spin complexes (see Figure 9). Common ligands can be arranged in order of the splitting they produce and this series is known as the spectrochemical series (Table 1).

Calculating solubilities from solubility products


Calculating solubilities from solubility products
Reversing the sums we have been doing isn't difficult as long as you know how to start. We will take the magnesium hydroxide example as above, but this time start from the solubility product and work back to the solubility.
If the solubility product of magnesium hydroxide is 2.00 x 10-11mol3 dm-9 at 298 K, calculate its solubility in mol dm-3 at that temperature.
The trick this time is to give the unknown solubility a symbol like x or s. I'm going to choose s, because an x looks too much like a multiplication sign.
If the concentration of dissolved magnesium hydroxide is s mol dm-3, then:
[Mg2+] = s mol dm-3
[OH-] = 2s mol dm-3
Put these values into the solubility product expression, and do the sum.