1 / 28

scientific programming

scientific programming. a language comparison or why python is really the best. determine. programming languages. how you think what you can think of what problems you can solve. Languages shape the way we think, or don't.

charo
Download Presentation

scientific programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. scientific programming a language comparisonor why python is really the best

  2. determine programming languages how you think what you can think of what problems you can solve Languages shape the way we think, or don't. Erik Naggum

  3. prototyping (scripting, light-weight syntax, succinctness, repl) libraries (plotting, algebra, stats, optimization, ml, bioinformatics) performance(execution speed) multiplatform(windows, linux, mac) scalability ( OO, encapsulation, immutability, static type system) support(documentation, googliness, news groups) concurrency (threading, actors, stm) ide(Eclipse, Intelli J, Visual Studio, ...) criteria se short se betrme

  4. bias Assembly Modula 2 APL Haskell Forth Perl LOGO MathematicaAda Fortran KEE Lisp Groovy RBasic C++ Pascal MatlabScala Python Java C If you only have a hammer, you tend to see every problem as a nail.A. Maslow

  5. picked 386 languages http://en.wikipedia.org/wiki/List_of_programming_languages C/C++ Java Perl RubyPython Fortran RAPL Matlab Scala Haskell Clojure There is no programming language, no matter how structured, that will prevent programmers from making bad programs. Larry Flon

  6. #include <stdio.h> int add(int a, int b) { return a+b; }main() { printf("%d",add(1,2)); } C/C++ fast huge number of libraries low level language no memory management no REPL, not for scripting related: Objective-C, D C is quirky, flawed, and an enormous success. Dennis M. Ritchie

  7. obfuscated C #define _ -F<00||--F-OO--; int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO() { _-_-_-_ _-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_-_-_-_-_ _-_-_-_-_-_-_-_ _-_-_-_ } http://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest calculates pi by looking at its own area

  8. class Calc { public static int add(int a, int b) { return a+b; } public static void main(String[] args) {System.out.println(add(1,2)); }} java object oriented fast JVM huge set of libraries, biojava no REPL, not for prototyping related: C# Software and cathedrals are much the same – first we build them, then we pray. Sam Redwine

  9. sub add { $_[0] + $_[1]; } perl the “Swiss Army Chainsaw” designed for sys-admin jobs huge number of libraries, bioperl complex syntax doesn't scale well related: AWK, sed, sh One day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" Larry Wall

  10. obfuscated perl @P=split//,".URRUU\c8R";@d=split//,"\nrekcahxinU / lrePrehtonatsuJ";sub p{ @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&& close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print http://en.wikipedia.org/wiki/Just_another_Perl_hacker Though I'll admit readability suffers slightly... Larry Wall

  11. def add(a,b)a+bend ruby "the better perl" light-weight, consistent syntax object oriented, functional web development good community bioruby slow

  12. def add(a,b): return a+b python light-weight syntax dynamic/duck typing multi-paradigm many scientific libraries, biopython good support doesn't scale well related: Ruby t = arange(0.0, 1.0, 0.01) s = cos(4*pi*t)+2 plot(t, s) There should be one - and preferably only one - obvious way to do it.

  13. INTEGER FUNCTION add(a,b) INTEGER, INTENT(IN): a,b add = a+bEND FUNCTION fortran old (1957) but alive many versions: 66, 77, 90, 95, 2003 fast, compiled many numeric/scientific libraries not a scripting language In the good old days physicists repeated each other's experiments, just to be sure. Today they stick to FORTRAN, so that they can share each other's programs, bugs included. E.W. Dijkstra 

  14. add <- function(a,b) a+b R strong for stats & plotting large number of libraries slow mediocre IDE not really for scripting related: Splus, SAS, SPSS freqs <- c(1, 3, 6, 4, 9)barplot(freqs)

  15. R ← ADD XR ← +/X APL array programming language old (1964), alive but declining special character set many scientific/numeric libraries related: J, K http://en.wikipedia.org/wiki/APL_%28programming_language%29 APL code that calculates prime numbers within 1 to R

  16. function add(a,b)a+b matlab array programming language high quality code, documentation many scientific libraries expensive doesn't scale well string/file processing is awkward related: Mathematica, Maple, Octave x = -pi:0.1:pi; y = sin(x);plot(x,y)

  17. add a b = a + b haskell purely functional, lazy static inferred typing very clean syntax does it scale? small community related: OCaml, ML, F# qsort [] = [] qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)

  18. def add(a:Int,b:Int) = a+b scala combines OO and FP nicely static typing with inference scales well JVM based new, little but growing support related: F#, Groovy With great power comes great responsibility!spiderman

  19. quicksort , ++ scala def qsort: List[Int] => List[Int] = { case Nil => Nil case x::xs => qsort(x filter (xs >)):::x::qsort(x filter (xs <=)) } def ++[B >: A, That](that: Traversable[B]) (bf: CanBuildFrom[List[A], B, That]): That

  20. (defn add [a b] (+ a b)) clojure prefix notation JVM based incanter library concurrency supported probably doesn't scale well related: lisp, scheme Lisp isn't a language, it's a building material. Alan Kay

  21. incanter clojure (use '(incanter core charts latex)) (doto (function-plot (fn [x] ($= x ** 3 - 5 * x ** 2 + 3 * x + 5)) -10 10) (add-latex 0 250 "x^3 - 5x^2 + 3x +5") view)

  22. googliness C 1340 6.9 Java 69717.4 C++ 395 1.7 C# 241 0.7 Perl 66 14.9 Python 186 30.6 Ruby 118 1.7 R 296 47.5 Fortran 62 0.007 Matlab 30 5.6 Scala64 0.007 Haskell 10 1.4 "X language" "X bioinformatics" Why bother with subroutines when you can type fast? Vaughn Rokosz kilo-hits, June 2010

  23. summary File not found. Should I fake it ? (Y/N)

  24. ? questions The most important thing in a programming language is the name. A language will not succeed without a good name. I have recently invented a very good name, and now I am looking for a suitable language. Donald E. Knuth

  25. speed http://shootout.alioth.debian.org/ 2008, 12 benchmarks, linux

  26. www.tiobe.com, 2010

  27. www.tiobe.com

  28. links http://www.tiobe.com http://en.wikipedia.org/wiki/List_of_programming_languages http://stackoverflow.com/questions/1348896/what-is-the-best-functional-language-for-scientific-programming

More Related