• 朝韩将军级会谈时隔11年后在板门店重启 2019-07-23
  • Conférence de presse du Premier ministre chinois 2019-07-09
  • 大观园举办“古琴雅集” 市民感受“古韵端午” 2019-06-30
  • 文脉颂中华——黄河新闻网 2019-06-30
  • 水费欠账竟“穿越”16年?用户质疑:为何没见催缴过? 2019-06-21
  • 买房怎么看风水这个真的实在是太重要了 ——凤凰网房产北京 2019-06-11
  • 6月14日凤凰直通车:茅台再开市场化招聘大门,32个部门要285人葡萄 种植 2019-06-07
  • 习近平为传统文化“代言” 2019-05-27
  • 中巴建交一周年 一系列庆祝活动在巴拿马举行 2019-05-24
  • 招聘启事丨西部网诚聘新媒体编辑记者、实习编辑等人员 2019-05-23
  • A title= href=httpwww.snrtv.comlivech=8 target= 2019-05-23
  • 不止消灭刘海屏 vivo NEX发布会看点汇总 2019-05-22
  • 世相【镜头中的陕西人】 2019-05-20
  • 邓紫棋首任明星制作人 吴亦凡身兼二职 2019-05-20
  • 陶昕然女儿正面照曝光 吃蛋糕萌到爆 2019-05-19
  • 11选5前三神奇公式:This is an Jupyter notebook backed by a Ruby kernel

    500元 倍投方案 稳赚 www.gvqn.net I am developing IRuby a kernel in Ruby that adheres to the Jupyter/IPython messaging protocol. It integrates nicely with different Rubygems as will be shown later.

    What does this give you?

    This gives us a very fancy web notebook interface for Ruby. It's a very good tool for programming presentations. It's basically an in-browser REPL loop, with some extra goodies.

    Usage

    Install IRuby with:

    gem install iruby

    Start the IRuby notebook with:

    iruby notebook

    Example

    $stdout and $stderr are redirected to the notebook

    In [1]:
    puts 'Hello, world!'
    
    Hello, world!
    
    In [2]:
    $stderr.puts 'Error!'
    
    Error!
    

    The last computed result is returned.

    In [3]:
    Math.sqrt(2)
    
    Out[3]:
    1.4142135623730951

    This works even for images.

    In [4]:
    File.open('IRuby Examples/ruby.svg')
    
    Out[4]:
    image/svg+xml
    In [5]:
    File.open('IRuby Examples/ruby.png')
    
    Out[5]:

    Display

    IRuby provides a method to display objects IRuby.display and methods to create $\LaTeX$ and HTML representations.

    In [6]:
    IRuby.display '<b style="color:green">Hello, world!</b>', mime: 'text/html'
    
    Hello, world!
    In [7]:
    IRuby.html '<iframe src=//en.mobile.wikipedia.org/?useformat=mobile width=700 height=350></iframe>'
    
    Out[7]:

    $\LaTeX$ is rendered using MathJax.

    In [8]:
    IRuby.display IRuby.latex <<-'TEX'
    \begin{eqnarray}
    \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\
    \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
    \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
    \nabla \cdot \vec{\mathbf{B}} & = 0 
    \end{eqnarray}
    TEX
    
    IRuby.math('F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx')
    
    \begin{eqnarray} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{eqnarray}
    Out[8]:
    $$F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx$$

    Arrays and Hashes can be printed as HTML tables.

    In [9]:
    IRuby.display IRuby.table([1,2,[],3])
    IRuby.display IRuby.table({a:1,b:2,c:3})
    IRuby.display IRuby.table([[11,12,13,14],[21,22,23],'not an Array',[31,32,33,34]])
    IRuby.display IRuby.table({a:[11,12,13,14],b:[21,22,23],c:[31,32,33,34]})
    IRuby.display IRuby.table([{a:1,b:2,c:3},'not an Array',{a:2,b:3,c:4,e:5}])
    IRuby.display IRuby.table([{a:1,b:2,c:3},{a:2,b:3,c:4,d:5},{0=>:x,1=>:y},[:a,:b,:c]])
    
    1
    2
    3
    abc
    123
    11121314
    212223
    not an Array
    31323334
    abc
    112131
    122232
    132333
    1434
    abce
    123
    not an Array
    2345
    abcd012
    123
    2345
    xy
    abc

    Integration with Ruby gems

    Pry

    Pry is an enhanced Ruby REPL. It will be automatically used by IRuby if available. You can use the code browsing utilities for example.

    In [10]:
    ls Array
    
    Object.methods: yaml_tag
    Array.methods: []  try_convert
    Array#methods: 
      &            concat      hash                reject                slice     
      *            count       include?            reject!               slice!    
      +            cycle       index               repeated_combination  sort      
      -            delete      insert              repeated_permutation  sort!     
      <<           delete_at   inspect             replace               sort_by!  
      <=>          delete_if   join                reverse               take      
      ==           drop        keep_if             reverse!              take_while
      []           drop_while  last                reverse_each          to_a      
      []=          each        length              rindex                to_ary    
      any?         each_index  map                 rotate                to_h      
      assoc        empty?      map!                rotate!               to_s      
      at           eql?        pack                sample                transpose 
      bsearch      fetch       permutation         select                uniq      
      clear        fill        pop                 select!               uniq!     
      collect      find_index  pretty_print        shelljoin             unshift   
      collect!     first       pretty_print_cycle  shift                 values_at 
      combination  flatten     product             shuffle               zip       
      compact      flatten!    push                shuffle!              |         
      compact!     frozen?     rassoc              size                
    

    Gnuplot

    Gnuplot::Plot objects are automatically displayed inline as SVG.

    In [11]:
    require 'gnuplot'
    
    Gnuplot::Plot.new do |plot|  
        plot.xrange '[-0.5:0.5]'
        plot.title  'Example plot'
        plot.ylabel 'x'
        plot.xlabel 'sin(1/x)'
        plot.samples 10000
        plot.data << Gnuplot::DataSet.new('sin(1/x)') do |ds|
            ds.with = 'lines'
            ds.linewidth = 2
        end
    end
    
    Out[11]:
    Gnuplot - 500元 倍投方案 稳赚 Produced by GNUPLOT 5.0 patchlevel 3 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 -0.4 -0.2 0 0.2 0.4 x sin(1/x) Example plot sin(1/x) - 500元 倍投方案 稳赚 sin(1/x)

    You can also create nice 3D plots

    In [12]:
    Gnuplot::SPlot.new do |plot|
        plot.title 'Spiral'
        plot.nokey
        plot.parametric
        plot.hidden3d
        plot.view '80,50'
        plot.isosamples '60,15'
        plot.xrange '[-8:8]'
        plot.yrange '[-8:8]'
        plot.zrange '[-8:8]'
        plot.urange '[-2*pi:2*pi]'
        plot.vrange '[-pi:pi]'
        plot.data << Gnuplot::DataSet.new('cos(u)*(cos(v)+3), sin(u)*(cos(v)+3), sin(v)+u') do |ds|
            ds.with = 'lines'
        end
    end
    
    Out[12]:
    Gnuplot - 500元 倍投方案 稳赚 Produced by GNUPLOT 5.0 patchlevel 3 Spiral gnuplot_plot_1 - 500元 倍投方案 稳赚 gnuplot_plot_2 - 500元 倍投方案 稳赚 -8 -6 -4 -2 0 2 4 6 8 -8 -6 -4 -2 0 2 4 6 8 -8 -6 -4 -2 0 2 4 6 8

    Rubyvis

    Rubyvis objects are automatically displayed inline as SVG.

    In [13]:
    require 'rubyvis'
        
    Rubyvis::Panel.new do 
      width 150
      height 150
      bar do
        data [1, 1.2, 1.7, 1.5, 0.7, 0.3]
        width 20
        height {|d| d * 80}
        bottom(0)
        left {index * 25}
      end
    end
    
    Out[13]:

    Matrix & GSL

    Matrix and GSL::Matrix objects are automatically displayed as $\LaTeX$.

    In [14]:
    require 'matrix'
    Matrix[[1,2,3],[1,2,3]]
    
    Out[14]:
    $$\left(\begin{array}{ccc} 1&2&3\\ 1&2&3\\ \end{array}\right)$$

    Nyaplot

    In [15]:
    require 'nyaplot'
    
    x = []; y = []; theta = 0.6; a=1
    while theta < 14*Math::PI do
      x.push(a*Math::cos(theta)/theta)
      y.push(a*Math::sin(theta)/theta)
      theta += 0.1
    end
    plot1 = Nyaplot::Plot.new
    plot1.add(:line, x, y)
    plot1.show
    
  • 朝韩将军级会谈时隔11年后在板门店重启 2019-07-23
  • Conférence de presse du Premier ministre chinois 2019-07-09
  • 大观园举办“古琴雅集” 市民感受“古韵端午” 2019-06-30
  • 文脉颂中华——黄河新闻网 2019-06-30
  • 水费欠账竟“穿越”16年?用户质疑:为何没见催缴过? 2019-06-21
  • 买房怎么看风水这个真的实在是太重要了 ——凤凰网房产北京 2019-06-11
  • 6月14日凤凰直通车:茅台再开市场化招聘大门,32个部门要285人葡萄 种植 2019-06-07
  • 习近平为传统文化“代言” 2019-05-27
  • 中巴建交一周年 一系列庆祝活动在巴拿马举行 2019-05-24
  • 招聘启事丨西部网诚聘新媒体编辑记者、实习编辑等人员 2019-05-23
  • A title= href=httpwww.snrtv.comlivech=8 target= 2019-05-23
  • 不止消灭刘海屏 vivo NEX发布会看点汇总 2019-05-22
  • 世相【镜头中的陕西人】 2019-05-20
  • 邓紫棋首任明星制作人 吴亦凡身兼二职 2019-05-20
  • 陶昕然女儿正面照曝光 吃蛋糕萌到爆 2019-05-19
  • 杜塞尔多夫vs菲尔特 北京pk10幸运飞艇 黑龙江十一选五的走势 北京单场6串1奖金计算 幸运双星连线 罗曼诺夫财富电子游戏 女王之女王怎么玩 澳门极速快乐十分开奖结果 斗破苍穹剧照 森林狼vs公牛 1zplay电竞比分直播 天津时时彩和值走势图 北京pk计划第三名在线 天津十一选五玩法规则 跑跑卡丁车手游什么时间上线 广东彩票36选7走势图