Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement logarithms with bases other than E [FEATURE] #184

Open
andrew-murdza opened this issue Jul 5, 2024 · 2 comments
Open

Implement logarithms with bases other than E [FEATURE] #184

andrew-murdza opened this issue Jul 5, 2024 · 2 comments
Labels
feature New feature or enhancement

Comments

@andrew-murdza
Copy link

\log_c should be interpreted as a log with base c

Relevant simplification rules

Undefined

  • {match:\log_c(a),replace:NaN,condition:c==1}
  • {match:\log_c(a),replace:NaN,condition:c\le 0}
  • \log_c(0)->NaN

Simple

  • \log_c(1)->0
  • \log_c(c)->1,
  • \log_c(c^a)->a

Log Properties

  • \log_c(ab)->\log_c(a)+\log_c(b)
  • \log_c(\frac{a}{b})->\log_c(a)-\log_c(b)
  • \log_c(\frac{1}{b})=-\log_c(b)
  • \log_c(c^ab)->a+\log_c(b)
  • \log_c(\frac{c^a}{b})->a-\log_c(b)
  • \log_c(\frac{b}{c^a})->\log_c(b)-a
  • \log_c(b^a)->a\log_c(b)

Change of Base

  • \log_c(b)\ln(c)->\ln(b)
  • \frac{\log_c(b)}{\log_d(b)}->\frac{\ln(d)}{\ln(c)}
  • \log_{1/c}(b)->-\log_c(b)

Base of C

  • c^{\log_c(a)}->a
  • c^{b\log_c(a)}->a^b
  • c^{\log_c(a)+b}->a\cdot c^b
  • c^{\log_c(a)-b}->\frac{a}{c^b}
  • c^{d\log_c(a)+b}->a^d\cdot c^b
  • c^{\log_c(a)-b}->\frac{a^d}{c^b}
  • c^{-\log_c(a)-b}->\frac{1}{a^dc^b}
  • c^{-\log_c(a)+b}->\frac{b^c}{a^d}

Infinity

  • {match:\log_c(\infty),replace:\infty,condition:c>1}
  • {match:\log_c(\infty),replace:-\infty,condition:0<c<1}
@andrew-murdza andrew-murdza added the feature New feature or enhancement label Jul 5, 2024
@arnog
Copy link
Member

arnog commented Jul 7, 2024

log of arbitrary base should already be handled through canonicalization.

Do those represent cases that don’t work even though they should or is it just a placeholder list of possible simplifications? Could you check which ones are actually necessary?

You could also submit a PR with corresponding test cases. The relevant file should be test/compute-engine/simplify.test.ts

@andrew-murdza
Copy link
Author

I just checked and the are actually recognized by MathJSON. I had assumed that log_2 was not implemented because none of the log simplification rules worked for it. I will work on that. I will make the PR once the custom simplification rules can be implemented (it is a different bug)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement
Development

No branches or pull requests

2 participants