Comment by westurner

5 years ago

If only I had started my math career with a binder of notebooks or at least 3-hole-punched notes.

- [ ] Create a git repo with an environment.yml that contains e.g. `mamba install -y jupyter-book jupytext jupyter_contrib_extensions jupyterlab-git nbdime jupyter_console pandas matplotlib sympy altair requests-html`, build a container from said repo with repo2docker, and git commit and push changes made from within the JupyterLab instance that repo2docker layers on top of your reproducible software dependency requirement specification ("REES"). {bash/zsh, git, docker, repo2docker, jupyter, [MyST] markdown and $$ mathTeX $$; Google Colab, Kaggle Kernels, ml-workspace, JupyterLite}

"How I'm able to take notes in mathematics lectures using LaTeX and Vim" https://www.google.com/search?q=formula+for+entropy :

  S=k_{b}\ln\Omega

Entropy > Statistical mechanics: https://en.wikipedia.org/wiki/Entropy#Statistical_mechanics

SI unit for [ ] entropy: joules per kelvin (J*K*-1)

*****

In terms of specifying tasks for myself in order to learn {Logarithms,} I could use e.g. todo.txt markup to specify tasks with [project and concept] labels and contexts; but todo.txt doesn't support nested lists like markdown checkboxes with todo.txt markup and/or codelabels (if it's software math)

  - [ ] Read the Logarithms wikipedia page <url> and take +notes +math +logarithms @workstation
    - [o] Read
    - [x] BLD: mathrepo: generate from cookiecutter or nbdev
    - [ ] DOC: mathrepo: logarithm notes
    - [ ] DOC,ART: mathrepo: create exponential and logarithmic charts +logarithms @workstation
    - [ ] ENH,TST,DOC: mathrepo: logarithms with stdlib math, numpy, sympy (and *pytest* or at least `assert` assertion expressions)
    - [ ] ENH,TST,DOC: mathrepo: logarithms and exponents with NN libraries (and *pytest*)

Math (and logic; ultimately thermodynamics) transcend disciplines. To bikeshed - to worry about a name that can be sed-replaced later - but choose a good variable name now, Is 'mathrepo' the best scope for this project? Smaller dependency sets (i.e. simpler environment.yml) seem to result in less version conflicts. `conda env export --from-history; mamba env export --from-history; pip freeze; pipenv -h; poetry -h`

### LaTeX

  $$ \log_{b} x = (b^? = x) $$
  $$ 2^3 = 8 $$
  $$ \log_{2} 8 = 3 $$
  $$ \ln e = 1 $$
  $$ \log_b(xy)=\log_b(x)+\log_b(y) $$

  $ \begin{align}
  \textit{(1) } \log_b(xy) & = \log_b(x)+\log_b(y)
  \end{align} $

Sources: https://en.wikipedia.org/w/index.php?title=List_of_logarithm... ,

#### sympy2latex

What e.g. sympy2latex parses that LaTeX into, in terms of symbolic objects in an expression tree:

  # install
  #!python -m pip install antlr4-python3-runtime sympy
  #!mamba install -y -q antlr-python-runtime sympy
  
  import sympy
  from sympy.parsing.latex import parse_latex
  
  def displaylatexexpr(latex):
      expr = parse_latex(latex)
      display(str(expr))
      display(expr)
      return expr
    
  displaylatexexpr('\log_{2} 8'))
  # 'log(8, 2)'
  displaylatexexpr('\log_{2} 8 = 3'))
  # 'Eq(log(8, 2), 3)'
  displaylatexexpr('\log_b(xy) = \log_b(x)+\log_b(y)'))
  # 'Eq(log(x*y, b), log(x, b) + log(y, b))'
  displaylatexexpr('\log_{b} (xy) = \log_{b}(x)+\log_{b}(y)')
  # 'Eq(log(x*y, b), log(x, b) + log(y, b))'
  displaylatexexpr('\log_{2} (xy) = \log_{2}(x)+\log_{2}(y)')
  # 'Eq(log(x*y, 2), log(x, 2) + log(y, 2))'

### python standard library

https://docs.python.org/3/library/operator.html#operator.pow

https://docs.python.org/3/library/math.html#power-and-logari...

math. exp(x), expm1(), log(x, base=e), log1p(x), log2(x), log10(x), pow(x, y) : float, assert sqrt() == pow(x, 1/2)

## scipy

https://docs.scipy.org/doc/scipy/reference/generated/scipy.s... scipy.special. xlog1py()

https://docs.scipy.org/doc/scipy/reference/generated/scipy.s...

### sagemath

https://doc.sagemath.org/html/en/reference/functions/sage/fu...

### statsmodels

### TensorFlow https://www.tensorflow.org/api_docs/python/tf/math tf.math. log(), log1P(), log_sigmoid(), exp(), expm1()

https://keras.io/api/layers/activations/

SmoothReLU ("softplus") adds ln to the ReLU activation function, for example: https://en.wikipedia.org/wiki/Rectifier_(neural_networks)#So...

E.g. Softmax & LogSumExp also include natural logarithms in their definitions: https://en.wikipedia.org/wiki/Softmax_function

### PyTorch

https://pytorch.org/docs/stable/generated/torch.log.html torch. log(), log10(), log1p(), log2(), exp(), exp2(), expm1(); logaddexp() , logaddexp2(), logsumexp(), torch.special.xlog1py()

***

Regarding this learning process and these tools, Now I have a few replies to myself (!) in not-quite-markdown and with various headings: I should consolidate this information into a [MyST] markdown Jupyter Notebook and re-lead the whole thing. If this was decent markdown from the start, I'd have less markup work to do to create a ScholarlyArticle / Notebook.