A log(101,base=10) that doesn't reply log(101)/log(10)

asked 2013-10-25 13:00:47 +0100

Pedro gravatar image

How can we develop the function below ? Where should we start to read?

"""
HSLOG = "High School Log".

Treat forms like `\log_b(a^p)` in a special manner.

Standard sage log with integer arguments works like this:

::     
    sage: log(101^3,10)
    log(1030301)/log(10)
    sage: 3*log(101,10)
    3*log(101,10)
    sage: 10^log(101,base=10)  #101
    10^(log(101)/log(10))

and     

::    
    sage: log(101,10)
    log(101)/log(10)
    sage: latex( log(101,10) )
    \frac{\log\left(101\right)}{\log\left(10\right)}  %ie: log(101)/log(10)

What we want is:

    sage: HSLOG(101,10,3)   #log_{10}(101^3)
    3*log(101,10)
    sage: HSLOG(101,10) #log_{10}(101)
    log(101,10)
    sage: 10^HSLOG(101,10) #10^log_{10}(101^3) = 101
    101
    sage: latex( HSLOG(101,10) )
    \log_{10}(101)


"""
edit retag flag offensive close merge delete