Testing JsMath

September 27, 2009

jsMath approach:

\[\int_\kappa^1
\left[\bigl(1-w^2\bigr)\bigl(\kappa^2-w^2\bigr)\right]^{-1/2} dw
= \frac{4}{\left(1+\sqrt{\kappa}\,\right)^2} K
\left(\left(\frac{1-\sqrt{\kappa}}{1+\sqrt{\kappa}}\right)^{\!\!2}\right)\]

Compare to latex2mahtml approach:

\[\int_\kappa^1\left[\bigl(1-w^2\bigr)\bigl(\kappa^2-w^2\bigr)\right]^{-1/2} dw = \frac{4}{\left(1+\sqrt{\kappa}\,\right)^2} K
\left(\left(\frac{1-\sqrt{\kappa}}{1+\sqrt{\kappa}}\right)^{\!\!2}\right)\]

You can see the result render by Gecko (support both jsMath and MathML):

Advertisements

照妖鏡

September 27, 2009

想知道哪些人是文盲或是從小到大都是宣傳機器的乖學生, 有時你只需要一個banner.

Notepad++的論壇

要在Ubuntu上裝Oracle 11g, 你可以把以下的段落加到/etc/security/limits.conf的最後一段:


oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535

# End of file


要在Ubuntu上安裝Oracle的話, 首先要先調整一下一些系統參數, 你可以將以下的參數放在/etc/sysctl.d/10-oracle.conf:


fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144


setup ESS under windows

September 24, 2009

Put the following lines in your ~/.emacs:


(add-to-list 'load-path (expand-file-name "~/.emacs.d/ess"))
(setq inferior-R-program-name "\\\\claslab\\programs\\R\\bin\\Rterm.exe")
(require 'ess-site)



lambda.mle <- function(data, censorTime) {
  lambdas <- rep(NA, (length(censorTime)-1))
  for (i in 1:length(lambdas)) {
    
    dataInterval <- data[((censorTime[i] < data) &
                          (data <= censorTime[i+1]))]

    dataOutlier  censorTime[i+1])]

    cutTail <- length(dataOutlier)*(censorTime[i+1] - censorTime[i])

    if (is.nan(cutTail)) cutTail <- 0
    
    lambdas[i] <- length(dataInterval)/
      (sum(dataInterval - censorTime[i]) + cutTail)
    
  }
    
  lambdas
}


範例: 如何愈描愈黑

September 21, 2009

以下是BBC HARDTALK 主持人訪問荷蘭極右國族派Geert Wilders, 台灣就是沒這麼帶種跟犀利的主持人, 都淪為政客的化妝棉兼打手

Thanks Mr. Alex Ott
The following configuration is for GSL base on Mr. Alex Ott’s articles about code auto completion in Emacs.


(global-ede-mode 1)
(semantic-load-enable-gaudy-code-helpers)  
(add-to-list 'auto-mode-alist '("/usr/include" . c-mode))
(semantic-add-system-include  "/usr/include" 'c-mode)

(setq gsl-base-dir "/usr/include/gsl")
(semantic-add-system-include gsl-base-dir 'c-mode)
(add-to-list 'auto-mode-alist (cons gsl-base-dir 'c-mode))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat gsl-base-dir "gsl_randist.h"))


(defun my-cedet-hook ()
  (local-set-key [(control return)] 'semantic-ia-complete-symbol)
  (local-set-key "\C-c?" 'semantic-ia-complete-symbol-menu)
  (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
  (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle))
(add-hook 'c-mode-common-hook 'my-cedet-hook)


Log-Logistic

September 19, 2009

For any Log-Logistic
\[f_W(w) = \frac{e^w}{(1+e^w)^2}\]
Consider $w = \frac{\log(t) – \boldsymbol x’\boldsymbol\beta}{\sigma}$, we have
\[f_T(t|\boldsymbol x) = \frac{\frac{t^{\frac{1}{\sigma}-1}}{\sigma}\exp\left\{\frac{- \boldsymbol x’\boldsymbol\beta}{\sigma}\right\}}{\left(1+\exp\left\{\frac{\log(t) – \boldsymbol x’\boldsymbol\beta}{\sigma}\right\}\right)^2}\]
We have the survival function
\[S_T(t) = \left(1+\exp\left\{\frac{\log(t) – \boldsymbol x’\boldsymbol\beta}{\sigma}\right\}\right)^{-1} = \left(1+t^{\frac{1}{\sigma}}\exp\left\{\frac{- \boldsymbol x’\boldsymbol\beta}{\sigma}\right\}\right)^{-1}\]
Further more, for $\boldsymbol x = (x_o, \boldsymbol x^{*’})’$, $\boldsymbol\beta = (\beta_0, \boldsymbol\beta^{*’})’$
\[S(t) = \left(1+t^{\frac{1}{\sigma}}\exp\left\{\frac{- \boldsymbol x’\boldsymbol\beta}{\sigma}\right\}\right)^{-1} = \left(1+t^{\frac{1}{\sigma}}\exp\left\{\frac{-x_0\beta_0}{\sigma}\right\}\exp\left\{\frac{- \boldsymbol x^{*’}\boldsymbol\beta^*}{\sigma}\right\}\right)^{-1} = S_{T_0}\left(t\exp\left\{\frac{-\boldsymbol x^{*’}\boldsymbol\beta^*}{\sigma}\right\}\right)\]

For R, it is simply:

accelatedSur <- function(t, accer, x, beta) {
  surT <- 1/(1 + exp(t*exp(accer(x, beta))))
  surT
}

吸毒嫌毒貴

September 18, 2009

宇文大的宏文真是讓我看得心有戚戚焉

快快戒毒吧!