Commit b41d2f56 authored by josd's avatar josd

retest

parent d5753ea8
from sympy import *
x = Symbol('x')
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('"integrate(exp(-x**2), (x, -oo, oo))" :integral "%s".' % (integrate(exp(-x**2), (x, -oo, oo))))
if __name__ == "__main__":
x = Symbol('x')
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('"integrate(exp(-x**2), (x, -oo, oo))" :integrate-bell "%s".' % (integrate(exp(-x**2), (x, -oo, oo))))
PREFIX : <http://josd.github.io/eye/imagining#>
"integrate(exp(-x**2), (x, -oo, oo))" :integral "sqrt(pi)".
"integrate(exp(-x**2), (x, -oo, oo))" :integrate-bell "sqrt(pi)".
from datetime import date
def easter(year):
"Returns Easter as a date object."
"see http://code.activestate.com/recipes/576517-calculate-easter-western-given-a-year/"
a = year % 19
b = year // 100
c = year % 100
d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30
e = (32 + 2 * (b % 4) + 2 * (c // 4) - d - (c % 4)) % 7
f = d + e - 7 * ((a + 11 * d + 22 * e) // 451) + 114
month = f // 31
day = f % 31 + 1
return date(year, month, day)
"Returns Easter as a date object."
"see http://code.activestate.com/recipes/576517-calculate-easter-western-given-a-year/"
a = year % 19
b = year // 100
c = year % 100
d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30
e = (32 + 2 * (b % 4) + 2 * (c // 4) - d - (c % 4)) % 7
f = d + e - 7 * ((a + 11 * d + 22 * e) // 451) + 114
month = f // 31
day = f % 31 + 1
return date(year, month, day)
print('PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>')
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('2019 :easter "%s"^^xsd:date.' % (easter(2019)))
print('2020 :easter "%s"^^xsd:date.' % (easter(2020)))
print('2021 :easter "%s"^^xsd:date.' % (easter(2021)))
print('2022 :easter "%s"^^xsd:date.' % (easter(2022)))
print('2023 :easter "%s"^^xsd:date.' % (easter(2023)))
if __name__ == "__main__":
print('PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>')
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('2019 :easter "%s"^^xsd:date.' % (easter(2019)))
print('2020 :easter "%s"^^xsd:date.' % (easter(2020)))
print('2021 :easter "%s"^^xsd:date.' % (easter(2021)))
print('2022 :easter "%s"^^xsd:date.' % (easter(2022)))
print('2023 :easter "%s"^^xsd:date.' % (easter(2023)))
from sympy import *
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('"E**(I*pi) + 1" :eval %d .' % (E**(I*pi) + 1))
if __name__ == "__main__":
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('"E**(I*pi) + 1" :euler-identity %d .' % (E**(I*pi) + 1))
PREFIX : <http://josd.github.io/eye/imagining#>
"E**(I*pi) + 1" :eval 0 .
"E**(I*pi) + 1" :euler-identity 0 .
......@@ -4,8 +4,9 @@ def fib(n, c={0:1, 1:1}):
c[n] = fib(x-1) * fib(n-x-1) + fib(x) * fib(n-x)
return c[n]
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('0 :fib %d .' % (fib(0)))
print('91 :fib %d .' % (fib(91)))
print('283 :fib %d .' % (fib(283)))
if __name__ == "__main__":
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('0 :fib %d .' % (fib(0)))
print('91 :fib %d .' % (fib(91)))
print('283 :fib %d .' % (fib(283)))
......@@ -84,4 +84,4 @@ if __name__ == "__main__":
n3_lst = '(' + ' '.join([str(i) for i in lst]) + ')'
print('PREFIX : <http://josd.github.io/eye/imagining#>')
print('')
print('"grover(7_bits, alternating_bits_oracle)" :answer %s.' % (n3_lst))
print('"grover(7_bits, alternating_bits_oracle)" :grover %s.' % (n3_lst))
PREFIX : <http://josd.github.io/eye/imagining#>
"grover(7_bits, alternating_bits_oracle)" :answer (1 0 1 0 1 0 1).
"grover(7_bits, alternating_bits_oracle)" :grover (1 0 1 0 1 0 1).
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment