Handling Log function (floored/ceilinged) with or without a base

Issue #49 resolved
MohamedE created an issue

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?

1[2][1].png

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)

  1. Axel Kramer 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)
    } )
    
  2. Log in to comment