2015年4月27日 星期一

Matlab不定積分

syms y x a b

y=a*x^2+b*x;

int(sqrt(1+diff(y)^2));


log(b + ((b + 2*a*x)^2 + 1)^(1/2) + 2*a*x)/(4*a) + (((b + 2*a*x)^2 + 1)^(1/2)*(b + 2*a*x))/(4*a)


======================================================================

syms y x a b 變數

int 積分


=======================================================================

要用到matlab symbolic math toolbox

2015年4月13日 星期一

日文(一)第11講

MRT   m aru ti
いっかい 一階
いりぐち 入口
うけつけ 服務台
エレベーター 電梯
お手(て)洗い(あらい) お手洗い 洗手間
かいぎしつ 会議室
がっこう 学校
きっさてん 喫茶店
きょうしつ 教室
さんがい 三階
しょくどう 食堂
でぐち 出口
としょしつ 図書室
となり 隣 旁邊
びょういん 病院
へや 部屋 房間
ゆうびんきょく 郵(ゆう)便(びん)局(きょく)郵局

うけつけは どちらでつか?
あそこは かっこうでつか びょういんでつか?病院でつ。



2015年4月1日 星期三

Linux script multithread method

#!/usr/bin/tcsh

echo "start"
./ex one &
./ex two &
wait
echo "OK"

=======================================================================
ex為執行程式
one,two為引數
wait為同步化
&代表spawn一個thread

2015年3月29日 星期日

策略選擇:辨識重要的抉擇

第三章 P135

策略選擇 企業的決策提高或降低最終機率?

1.反制破壞的黑帶高手
在位者是否已經學會應付破壞影響力

2.價值網絡
新進者選擇了獨立或和在位者重疊的價值網絡

3.準備工作
新進者是否創造出可正確立足點市場的初始條件



<<創新者一書>>一書中提出的理論可幫助應付制定策略、招募人才、尋找投資資本等重要決策。

2015年3月25日 星期三

How to compile from SDL Library

gcc hello.c -I/usr/include/SDL `sdl-config --cflags --libs` -o hello

save graphics output as Windows Bitmap(*.bmp)

Uint32 rmask, gmask, bmask, amask;

    /* SDL interprets each pixel as a 32-bit number, so our masks must depend
       on the endianness (byte order) of the machine */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    rmask = 0xff000000;
    gmask = 0x00ff0000;
    bmask = 0x0000ff00;
    amask = 0x000000ff;
#else
    rmask = 0x000000ff;
    gmask = 0x0000ff00;
    bmask = 0x00ff0000;
    amask = 0xff000000;
#endif

w=400;
h=500;
unsigned char * pixels = new unsigned char[w*h*4]; // 4 bytes for RGBA
    glReadPixels(0,0,w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

     SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, width, height, 8*4, width*4, rmask, gmask, bmask, amask);                                                                                      
    SDL_SaveBMP(surf, filename);

    SDL_FreeSurface(surf);
    delete [] pixels;