Search This Blog

Wednesday, September 7, 2011

Monday, May 23, 2011

Latex tips and tricks - keep checking for newer ones

Some  tips,
  • While creating a new book or article, if you intend to have a modified family of default font across all the pages in your doc, use
                 " \renewcommand{\familydefault}{\sfdefault} "
    in the preamble. The above, for example, sets the font to sans serif.

  • How to embed an image into a table? - Use the graphicx package and your problem is solved.
    \begin{table}[ht]
    \caption{A table arranging images}
    \centering
    \begin{tabular}{cc}
    \includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
    \newline
    \includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
    \end{tabular}
    \label{tab:gt}
    \end{table}%

Friday, May 20, 2011

Java and References

Point to note;
  1. Java has pointers!!
    Java : Dog d = new Dog("Wicky"); is same as
    C++: Dog *d;

  2. When you pass foo(d) in Java, you actually pass the pointer


Thursday, May 19, 2011

New Hope to Moores Law

The new 3-D processor

I very much believed that Moores law is no longer true with the RND coming to a standstill to no longer being able to increase the number of transistors on a processor and (so) we have been going for multi cored architecture. However, Intel has found some new way to address this limitation. It might have thought "If not XY; haaa let me go for XYZ dimension!!" and it has come up with a production solution.

This is truly going to be a real Mile stone in hardware technology and even more promising to small scale devices like IPhones, handhelds and like for this new technology can save upto 50% of power.




Play this video for some experience of the new technology.

Sources
  1. http://newsroom.intel.com/community/intel_newsroom/blog/2011/05/04/intel-reinvents-transistors-using-new-3-d-structure
  2. http://www.hindu.com/seta/2011/05/19/stories/2011051950191300.htm

Tuesday, May 10, 2011

How to calculate 'differentiation' of a given function??

  • Forward difference






  • Centered difference





Now, using a computer one can easily compute the value of  up to a certain approximation. This is one such example where a continuous computation can be approximated using discrete formulation. The key here is the value of which should be chosen NOT too large (such that curvatures are totally avoided) nor too small (such that IEEE754 might fail to represent using the system hardware). Now, one can easily write off a C/Java program so as to calculate the differentiation of a function at a given value.

Refer "Press et al, Numerical Recipes, The Art of Scientific Computing, Cambridge Univ Press, III Ed, 2007" for more details.

    Thursday, April 28, 2011

    Computers' Time Line


    1. ~1000BC The abacus 
    2. 1621 The slide rule invented
    3. 1625 Wilhelm Schickard's mechanical calculator
    4. 1822 Charles Babbage's Difference Engine
    5. 1926 First patent for a semiconductor transistor 
    6. 1937 Alan Turing invents the Turing Machine 
    7. 1939 Atanasoff-Berry Computer created at Iowa State
      • the world's first electronic digital computer
    8. 1939 to 1944 Howard Aiken's Harvard Mark I (the IBM ASCC)
    9. 1940 Konrad Zuse -Z2 uses telephone relays instead of mechanical logical circuits 
    10. 1943 Collossus - British vacuum tube computer 
    11. 1944 Grace Hopper, Mark I Programmer (Harvard Mark I) 
    12. 1945 First Computer "Bug", Vannevar Bush "As we may think" 
    13. 1948 to 1951 The first commercial computer – UNIVAC 
    14. 1952 G.W.A. Dummer conceives integrated circuits 
    15. 1954 FORTRAN language developed by John Backus (IBM) 
    16. 1955 First disk storage (IBM) 
    17. 1958 First integrated circuit 
    18. 1963 Mouse invented by Douglas Englebart 
    19. 1963 BASIC (standing for Beginner's All Purpose Symbolic Instruction Code) was written (invented) at Dartmouth College, by mathematicians John George Kemeny and Tom Kurtzas as a teaching tool for undergraduate 
    20. 1969 UNIX OS developed by Kenneth Thompson 
    21. 1970 First static and dynamic RAMs 
    22. 1971 First microprocessor: the 4004 
    23. 1972 C language created by Dennis Ritchie 
    24. 1975 Microsoft founded by Bill Gates and Paul Allen 
    25. 1976 Apple I and Apple II microcomputers released 
    26. 1981 First IBM PC with DOS 
    27. 1985 Microsoft Windows introduced 
    28. 1985 C++ language introduced 
    29. 1992 Pentium processor 
    30. 1993 First PDA 
    31. 1994 JAVA introduced by James Gosling 
    32. 1994 Csharp language introduced
    33. ..will see to get other stuff

    Information taken from some random computer science ppt. Not responsible if some date is wrong ;).

    Monday, March 7, 2011

    OpenGL and Physics - Some Learnings

    MIT link
    http://web.mit.edu/8.02t/www/802TEAL3D/visualizations/resources/resources.htm


    Magnet Formulae:
    http://www.netdenizen.com/emagnet/index.htm


    Useful Links:
    http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=26
    http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=39

    OpenGL Book:
    Field visualization techniques..
    http://books.google.co.in/books?id=rmgXE9jWjVgC&pg=PA561&lpg=PA561&dq=arrow+plot+in+openGL&source=bl&ots=UFEFAZpgvQ&sig=ysyP-wzNzLnXM3qEtfh6EX0V1us&hl=en&ei=A0eETfqSKYH0vQOzqNm8CA&sa=X&oi=book_result&ct=result&resnum=4&ved=0CDUQ6AEwAw#v=onepage&q&f=false

    http://books.google.co.in/books?id=ZFrlULckWdAC&pg=PA290&lpg=PA290&dq=%22openGL+%22+solenoid+OR+%22bar+magnet%22+OR+%22vector+field%22&source=bl&ots=4AuJNUP6VX&sig=lzwLsqrVR7GR0vTBSIlU7GDLTxc&hl=en&ei=-VqETYelMYrsvQPhr-ndCA&sa=X&oi=book_result&ct=result&resnum=55&ved=0CIwDEOgBMDY#v=onepage&q=%22openGL%20%22%20solenoid%20OR%20%22bar%20magnet%22%20OR%20%22vector%20field%22&f=false

    Good ppt:
    http://www.authorstream.com/Presentation/Sophia-27431-25-Modeling-Simulating-Electromagnetism-Begin-Solution-Why-gravity-so-weak-Outlin-as-Entertainment-ppt-powerpoint/

    GameDev:
    http://www.gamedev.net/topic/541552-magnetic-fields-in-2d-space/
    http://www.gamedev.net/topic/550586-magnetic-moment-of-a-moving-charge/
    http://www.gamedev.net/topic/496159-circular-particle-system-optimization/
    http://www.gamedev.net/topic/549373-calculating-the-angle-between-2-points-in-a-2d-system/

    Image Based Flow Visualization: (The code works; Understand the code using the pdf file)
    http://www.win.tue.nl/~vanwijk/ibfv/

    http://www.devmaster.net/forums/showthread.php?t=13566

    http://www.evilmadscientist.com/article.php/fields/print

    Geometry using Matlab

    Following are few of the Matlab interpreter commands to understand the geometries of some selected functions. These help me understand few of the complex convex optimization problems.

    S.No.
    Topic
    Command
    Description
    Output
    1
    Norms
    norm([3,4],1)
    7
    7


    norm([3,4],inf)
    4
    4


    norm([3,4],2) = norm([3,4])
    5
    5
    2
    2D plots
    x=[-10:1:10];
    plot(x, x.^2);

    y = x^2




    x=[-10:1:10];
    plot(x, 3.^x);

    y = 3^x




    x=[-10:1:10];
    plot(x, x.^3);

    y = x^3


    3
    3D plots
    t=[0:pi/30:6*pi];
    x=t.*cos(t);
    y=t.*sin(t);
    z=t;
    plot3(x,y,z);

    grid on
    x=t x cos(t)
    y=t x sin(t)
    z=t



    [x,y]=meshgrid(-2:1:2,-2:1:2);
    surf(x,y,x.^2-y.^2)
    z =x2y2




    [x,y]=meshgrid(-2:1:2,-2:1:2);
    surf(x,y,x.^2+y.^2)
    z =x2+y2




    [x,y]=meshgrid(-2:0.1:2,-2:0.1:2);
    surf(x,y,x.^2-y.^2)
    z =x2y2




    [x,y]=meshgrid(-2:0.1:2,-2:0.1:2);
    surf(x,y,x.^2+y.^2)
    z =x2+y2




    [x,y]=meshgrid(-2:0.1:2,-2:0.1:2);
    surfc(x,y,x.^2+y.^2)
    z =x2+y2

    4
    Comparing graphs
    [x,y]=meshgrid(-1:.1:1,-1:.1:1);
    subplot(1,2,1)
    surf(x,y,x.^2+y.^2)
    axis square

    subplot(1,2,2)
    contourf(x,y,x.^2+y.^2)
    axis square
    z =x2+y2



    [x,y]=meshgrid(-1:.1:1,-1:.1:1);
    subplot(1,2,1)
    surf(x,y,sqrt(x.^2+y.^2) )
    axis square

    subplot(1,2,2)
    contourf(x,y, sqrt(x.^2+y.^2) )
    axis square




    [x,y]=meshgrid(-1:.1:1,-1:.1:1);
    subplot(1,2,1)
    surf(x,y,nthroot(x.^4+y.^4, 4))
    axis square

    subplot(1,2,2)
    contourf(x,y,nthroot(x.^4+y.^4, 4))











    References:

    Friday, March 4, 2011

    Using Apache's log4j library - how to?


    • Create a properties file "log4j.properties" (same as this file name) with following contents.
    • Write a simple class like this..
    • Wherever you create a new class just add the static member "logger" to your class, and start using it.
    • Start writing the log statements.
    • Collect all your log statements in your log file (as well as the console because of stdout in the properties file).
    • Thats it!! Enjoy debugging complex interleaving scenarios between multiple threads. You can use Notepad++ for filtering and using such log files when they are too big to browse through.
    References:
    1. http://www.laliluna.de/articles/log4j-tutorial.html
    2. http://logging.apache.org/log4j/1.2/download.html
    3. http://en.wikipedia.org/wiki/Log4j