User Tools

Site Tools


blog

Math Magics

        1 x 8 + 1 = 9

       12 x 8 + 2 = 98

      123 x 8 + 3 = 987

     1234 x 8 + 4 = 9876

    12345 x 8 + 5 = 98765

   123456 x 8 + 6 = 987654

  1234567 x 8 + 7 = 9876543

 12345678 x 8 + 8 = 98765432

123456789 x 8 + 9 = 987654321




        0 x 9 + 1 = 1

        1 x 9 + 2 = 11

       12 x 9 + 3 = 111

      123 x 9 + 4 = 1111

     1234 x 9 + 5 = 11111

    12345 x 9 + 6 = 111111

   123456 x 9 + 7 = 1111111

  1234567 x 9 + 8 = 11111111

 12345678 x 9 + 9 = 111111111

123456789 x 9 +10 = 1111111111




       9 x 9 + 7 = 88

      98 x 9 + 6 = 888

     987 x 9 + 5 = 8888

    9876 x 9 + 4 = 88888

   98765 x 9 + 3 = 888888

  987654 x 9 + 2 = 8888888

 9876543 x 9 + 1 = 88888888

98765432 x 9 + 0 = 888888888




        1 x 1 = 1

       11 x 11 = 121

      111 x 111 = 12321

     1111 x 1111 = 1234321

    11111 x 11111 = 123454321

   111111 x 111111 = 12345654321

  1111111 x 1111111 = 1234567654321

 11111111 x 11111111 = 123456787654321

111111111 x 111111111 = 12345678987654321
2009/04/17 22:20 · 0 Comments · 1 Linkback

Install OpenBUGS

Steps

  1. Download OpenBUGS (Note only OpenBUS 2.2.0 works on unix machines) and upload it to dscratch. First upload it to AFS and then copy it to dscratch.
  2. Unzip the file on the cluster
  3. Create a file called linbugs with the following content and change permission using chmod 755 lingbugs
    #!/bin/bash
    
    export LD_ASSUME_KERNEL=2.4.1
    
    DIR=$(dirname $0)
    cd "$DIR"
    if [ \! -e "$DIR/temp" ] ; then
            mkdir "$DIR/temp"
    fi
    
    if [ -e bugs.so ] ; then
            ./cbugs "$DIR" "$DIR/temp" "/bugs.so"
    else
            ./cbugs "$DIR" "$DIR/temp" "/brugs.so"
    fi
  4. Create a file called Cbugs and compile it using
      gcc -o cbugs CBugs.c -ldl -m32 

    . The file includes the following codes

    /*              GNU General Public Licence
    
            This small C program loads the bugs.so ELF shared library. 
            Save it as a .c file and then
            compile it on Linux using gcc -o cbugs Cbugs.c -ldl
    
    */
    
    #include <dlfcn.h>
    #include <stdio.h>
    #include <string.h>
    
    int main (int argc, char **argv)
    {
            void * handle;
    
            handle = dlopen("./bugs.so", RTLD_LAZY);
            if (handle)
            {
                    dlclose(handle);
            }
            return 0;
    }

An example

  1. Start OpenBUGS by
    ./linbugs

    in the OpenBUGS directory

  2. If OpenBUGS successfully run, you will see
    OpenBUGS ClassicBUGS release 2.1.1
    type 'modelQuit()' to quit
    Bugs> 
  3. Then type in the following commands (those after >)
     Bugs> modelCheck("Examples/Airmodel.txt")
    model is syntactically correct
    Bugs> modelData("Examples/Airdata.txt")
    data loaded
    Bugs> modelCompile()
    model compiled
    Bugs> modelInits("Examples/Airinits.txt")
    model is initialized
    Bugs> modelUpdate(100000)
    100000 updates took 4 s
    Bugs> samplesSet("theta")
    monitor set
    Bugs> summarySet("theta")
    monitor set
    Bugs> modelUpdate(10000)
    10000 updates took 0 s
    Bugs> samplesStats("theta")
                             mean      sd        MC_error  val2.5pc  median    val97.5pc start     sample
    theta[1]                 -1.1      1.332     0.1092    -5.243    -0.7288   0.2504    101001    10000
    theta[2]                 0.05332   0.05231   0.004327  0.002579  0.03949   0.2046    101001    10000
    Bugs> samplesCoda("*","output")
    CODA files written
    Bugs> modelQuit()
    
2009/03/05 09:50 · 0 Comments · 0 Linkbacks

Copy Tables from Excel to LyX

This is the way to copy tables from Excel to Lyx I found on the web.

  1. In LyX, insert a table with the same dimensions as the one in the excel.
  2. Place the mouse cursor in the top left cell of the table.
  3. From the menu of LyX, choose Edit → Paste Special → Plain Text, Join Lines.
2009/01/12 13:27 · 0 Comments · 0 Linkbacks

Welcome!

After I moved to the University of Notre Dame for 4 months, I finally found some time to set my ND website up. This does not replace my old website at http://www.psychstat.org/us because it is mainly for the classes I teach. And, unfortunately, for obvious reasons, the class pages cannot be accessed publicly. I will give authorization to the students in my classes. For those who are not on the roster of the classes and are still interested in accessing the class pages, you may have to contact me first to get the authorization.

2008/11/08 10:52 · 0 Comments · 0 Linkbacks

<< Newer entries


Note. Everything on this blog only reflects my personal view which may or may not be true and is not related to any organization or institute.

blog.txt · Last modified: 2024/09/17 13:50 by johnny