Skip to content

Instantly share code, notes, and snippets.

@stesh
Created March 4, 2011 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stesh/855703 to your computer and use it in GitHub Desktop.
Save stesh/855703 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def y(n)
case n
when 0 then 1
when 1 then 0
when 2 then -4
when 3 then 0
else y(n - 4)
end
end
puts (0..(ARGV.pop or gets).to_i).map { |n| "\\frac{#{y(n)}}{#{n}!}x^{#{n}}" }.join(' + ') + "\\dots"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment