Handling Log function (floored/ceilinged) with or without a base
Issue #49
resolved
Sum[log(i),{i, 1, n}] doesn't yield any result, but if you look at the picture, ceiled log(i) from the range 1 to n has a precise formula.
How do you handle the base in Symja?
I have the formula for the floored version as well.
I can provide more peculiar functions to include in Symja (verified for the range 1 to n only).
Comments (4)
-
repo owner -
reporter How can I do that?
-
repo owner In this Load user-defined rules on startup example you can see how to load user defined rules.
You can try your Sum rules as function "MySum" for example with the following package:
Package( "SymjaInit", (* define the public available symbols *) { "MySum" }, { checkparam(i_,n_):=FreeQ(n,i), checkparam(a_,i_,n_):=FreeQ(a,i)&&FreeQ(n,i), MySum(i_^(-1), {i_Symbol,1,n_Symbol}) := HarmonicNumber(n) /; checkparam(i,n), MySum(i_^(k_IntegerQ), {i_Symbol,1,n_Symbol}) := HarmonicNumber(n,-k) /; FreeQ(n,i)&&Negative(k), MySum(Ceiling(Log(i_)), {i_Symbol,1,n_Symbol}):= ( Floor(Log(n))*E^(Floor(Log(n))+1)-(Floor(Log(n))+1)*E^Floor(Log(n))+1 ) * (E-1)^(-1) + (n-E^Floor(Log(n)))*Ceiling(Log(n)) /; FreeQ(n,i), MySum(Ceiling(Log(a_,i_)), {i_Symbol,1,n_Symbol}):= ( Floor(Log(a,n))*a^(Floor(Log(a,n))+1)-(Floor(Log(a,n))+1)*a^Floor(Log(a,n))+1 ) * (a-1)^(-1) + (n-a^Floor(Log(a,n)))*Ceiling(Log(a,n)) /; checkparam(a,i,n) } )
-
repo owner - changed status to resolved
- Log in to comment
You can now define Sum() rules in the SumRules.m file
See commit: https://bitbucket.org/axelclk/symja_android_library/commits/c94f24d2d095b2794f9299c5d73f45007edc379b