Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,9 @@
|
|||
say "Arithmetic derivative for n in range [-99, 100]:"
|
||||
-99 .. 100 -> map { .arithmetic_derivative }.each_slice(10, {|*a|
|
||||
a.map { '%4s' % _ }.join(' ').say
|
||||
})
|
||||
|
||||
say "\nArithmetic derivative D(10^n)/7 for n in range [1, 20]:"
|
||||
for n in (1..20) {
|
||||
say "D(10^#{n})/7 = #{arithmetic_derivative(10**n) / 7}"
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
subset Integer < Number { .is_int }
|
||||
subset Positive < Integer { .is_pos }
|
||||
subset Negative < Integer { .is_neg }
|
||||
subset Prime < Positive { .is_prime }
|
||||
|
||||
func arithmetic_derivative((0)) { 0 }
|
||||
func arithmetic_derivative((1)) { 0 }
|
||||
|
||||
func arithmetic_derivative(Prime _) { 1 }
|
||||
|
||||
func arithmetic_derivative(Negative n) {
|
||||
-arithmetic_derivative(-n)
|
||||
}
|
||||
|
||||
func arithmetic_derivative(Positive n) is cached {
|
||||
|
||||
var a = n.factor.rand
|
||||
var b = n/a
|
||||
|
||||
arithmetic_derivative(a)*b + a*arithmetic_derivative(b)
|
||||
}
|
||||
|
||||
func arithmetic_derivative(Number n) {
|
||||
var (a, b) = n.nude
|
||||
(arithmetic_derivative(a)*b - arithmetic_derivative(b)*a) / b**2
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue