Introduction#
I’m currently working on 5. A-level-further and 14. Quantum Mechanics.
For completed courses, see my LinkedIn certificates. Any questions, please email: jonny.tang745@education.nsw.gov.au
Project Euler (PE)
Jonny workbook started from Project Euler. Jonny loves coding and number theory, especially the PE-style (VS. CS-style) when he was 10YO. Therefore, Tom assisted him with guidance and searching hidden info and knowledge.
PE problems can be solved using multiple approaches and often involve a combination of techniques.
Sometimes, I face math problems while coding is easy, e.g. 99-Largest Exponential
Sometimes, I face computational (or programming) problems while math is easy, e.g. 187-Semiprimes (very time-consuming)
So, I need two streams of knowledge to solve PE: 1) Math: see PE-Hidden-Math where I present math by PE questions and math-topics; and 2) CS or Programming
Mathematics & FP(Functional Programming)/Language (updating)
In 2024, Jonny went through 4U math (HSC-NSW) once, Tom chose A-level math for Jonny’s review and progress, with a approach of computational coding for A-level math. In this workbook, Jonny worked on A-level and A-level further which are transitional-math between secondary and tertiary education.
A-level math, including four courses
A-level further math, including four courses
Go along with A-level math, Tom summarised math, FP, and linguistics (natural languages). Tom advocates 6. Math-FP-Lang Combo in guiding kids learning.
CS-Python & Physics (updating)
I already finished these two courses in 2024 as below, and a physics in 2025 (planned). My notes are included in this workbook:
Mathematical and Computational Methods: learning Physics through Math (updating)
MITx-6.00.1x-Introduction to Computer Science and Programming Using Python
MITx-6.00.2x-Introduction to Computational Thinking and Data Science
Others
Geography, Maps, Lottery math
For help
For questions about phys, try Physics Stack Exchange. For research-level questions, Physics Overflow.
For questions about math, try Math Stack Exchange. for research-level questions, Math Overflow.
For more free-wheeling discussions of math and physics, try Physics Forums.
Ubuntu & SCE (Scientific Computing Environment)#
Ubuntu is the key in SCE. To build a SCE is the first step to learn programming, two ways:
Cloud Computing - Google Colab, Cocalc(Rust, Julia, GNU Octave(vs.Matlab)), Binder - are good, but Colab and Binder require further installation (originally Python)
Self-built - Docker’s images and containers (self-maintained not self-installation) are the best
I already build SageMath and IHaskell using Docker, both running
ipynb
Key to Science - reproducibility, so we need a managing Environment and Container
Use one environment(or Container) per project! Creating environments to accommodate specific workflows/projects — and to do so early on
Containers is better, which package tools with underlying operating system, are larger and more complicated than environments, but are more portable
Steps:
install Ubuntu
install Chrome
sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome*.deb
git:
sudo apt install git
download github project
git clone weblink
for github conflicted problem
git stash
git pull –rebase
git stash pop
Install Docker
sudo apt install curl
curl -fsSL https://get.docker.com -o get-docker.sh
dockerd-rootless-setuptool.sh install
docker ps ; docker images ;
Google Drive - rclone, now Dropboxsudo -v ; curl https://rclone.org/install.sh | sudo bash
run “rclone config”, follow guide: https://rclone.org/drive/
run “sudo nano /etc/fuse.conf” Uncomment this line: user_allow_other
rclone mount gdrive: /home/tom/gdrive –allow-other –vfs-cache-mode full
automatic boot: 2 issues - connection & mount
Test rclone connection:
rclone lsd remote:
sudo nano /etc/systemd/system/rclone-gdrive.service # see T430’s file
systemctl daemon-reload
sudo systemctl enable rclone-gdrive.service
sudo systemctl start rclone-gdrive.service
uni-direction synchronize two folders
rsync -avu --delete source_folder/ destination_folder/
for many PDFs in folder
My PC has two disks, I installed Ubuntu goes along original windows in the first disk (original sys). Now the second disk can’t seen as Ubuntu still hardly manage Microsoft Windows dynamic disk (LDM). Solutions:
ldmtool to read data in Ubuntu, or wait Ubuntu updates in the future
convert LDM to basic disk while lossing all data
Basic commands & more:
ls -a ; env ; pwd ; rm ; echo > aa.hs (create file); nano aa.hs (edit file, Ctrl+X for quit)
run Ubuntu commands in GHCI, add
:!
aheadremove top bar:
sudo apt install gnome-shell-extension-manager
, then search “hide top bar”PDF arranger (App Center): edit PDF
printer brother driver
More
PL
While a qualified coder mastering 6 programming languages (PL), how to choose PLs is really a hard decision.
We started this workbook using Python in VScode:
Python: we began from Python, then we moved to Math Tools, like MMA and SageMath(the second best CAS - computer algebra system).
diagrams: Coding diagrams
manim: Math Animation
handcalcs: render calculation as if it were written with a pencil: write the symbolic formula, then numeric substitutions, and then show result automatically
Next, a PL with more FP? Ocaml? F#(Fsharp)? Scala? Haskell? Rust? Make a comparison:
PL’s Coding-look in defining a Fibonacci;
Which FP is best for mathematics? Haskell is NO.1, but I really don’t like Haskell;
Math-related supports for these four languages;
Balance between FP and OOP;
Number of users in Project Euler for each PL;
libgen supports for each PL;
When the PL first appeared.
Decision: Rust & Haskell.
Google endorse Codeworld - Educational Haskell programming platform with Github Repository
Math Tools
Three large-scale mathematical software packages
Numerical computing systems: floating point, accurate estimation, numerical analysis. Matlab, Octave
CAS(Computer algebra system): exact computation, view \(\pi\) as a symbol instead of a decimal number, symbolic computation/computer algebra/computational algebra
Statistical packages: SAS, R
Mathematics and Self-Study Roadmaps
Instead of Python, then we started Mathematica (Wolfram languages, MMA or Wolfram after):
We are running Wolfram in ipynb-file using VScode
Mathematica (.nb): the best CAS. Shall we convert .nb -> .ipynb ??
installing
SageMath isn’t a pip-installable package, instead it’s large and requires C/Fortran/Python… lots of pre-installed environments
SageMath is the best open-source CAS
CoCalc (.ipynb) online platform includes all open-source computing environments, so surprising!!
Google Colab can also install SageMath, but with problems
or Docker + SageMath + JupyterLab to work with symbolic mathematics programmatically
Sage installed by miniconda is the best option
we can use self-built functions every time starting Sage, like s()
go to folder
/home/tom/.sage
, open fileinit.sage
Resources:
Julia is the best for DE, and is also more FP than python - reason 1, reason 2
Organization & Management
Website Management
Git and GitHub
Project Management
Visual Studio Code
Jupyter notebooks (.ipynb): interactive computational notebooks, easy to prototype, create visualizations, interactive presentations
MarkDown and Latex: writing natural language and math formulus
Citations and Bibliographies
Zotero: a free, easy-to-use tool to help you collect, organize, cite, and share research. I use Zotero to generate .bib files
(*Convert nb file into vsnb using the wl coding*)
Get["_static/Mathematica2VSCode.wl"]
Needs["Mathematica2VSCode`"]
Mathematica2VSCode["aa.nb"] (*path and specific MMA notebook*)
OOP to FP#
We started workbook using Python in OOP (Object-oriented Programming) way, then we move to FP (Functional Programming) way in both MMA and Python.
Even though both Python and Wolfram are not pure FP, they do help us understand the FP way.
From my view, OOP coding is more natural language, FP is more math lanuage.
FP
PE solutions in Java, Python, Mathematica, Haskell: Nayuki use OOP in Python and FP in Haskell.
FP - languages
FP in Python: a web-notebook for beginner.
FP in Wolfram: official website.
Why no Matlab? To model and simulate dynamic systems
Simulink(Matlab) uses a signal flow-based or causal approach,
while Modelica uses an equation-based or acausal approach. – still OOP vs. FP
Haskell#
cabal init --interactive
(Haskell project)
IHaskell in Ubuntu
A. step-by-step to avoid skipping; B.if using IHaskell packages, the ipynb must locate in IHaskell folder
sudo apt-get install -y python3-pip git libtinfo-dev libzmq3-dev libcairo2-dev libpango1.0-dev libmagic-dev libblas-dev liblapack-dev
curl -sSL https://get.haskellstack.org/ | sh # install stack
export PATH=”/usr/local/bin:$PATH”
export PATH=”/home/tom/.local/bin:$PATH”
git clone gibiansky/IHaskell
cd IHaskell
pip3 install -r requirements.txt -break-system-packages # install Python requirements
stack install –fast # install ihaskell
ihaskell install –stack # install the Jupyter kernelspec with ihaskell
Restart PC and make sure Jupyter access fully
jupyter notebook –generate-config
nano ~/.jupyter/jupyter_notebook_config.py
add into:
c.NotebookApp.token = ‘’
c.NotebookApp.password = ‘’
c.NotebookApp.allow_origin = ‘*’
c.NotebookApp.allow_root = True
make sure lts = 22.10 (consist to Github version)
nano /home/tom/.stack/global-project/stack.yaml
In IHaskell folder, run
stack exec jupyter -- notebook
or Click Jupyter icon at Dash
IHaskell in docker:
IHaskell computation = Docker + Haskell + Jupyter (Docker building: 1. download zip, 2. go to Docker terminal, run
"docker build -t ihaskell:latest ."
)Haskell’s interpreter: IHaskell, HyperHaskell, ptGHCi
I am using ihaskell-notebook Docker image: JupyterLab version is low, unable to use AutoCompletion.
can also use IHaskell docker and Docker build py
IHaskell disscusion for reference
wsl2-Ubuntu-Haskell in windows:
Microsoft Store -> search ‘Ubuntu’ and install (345 MB)
Open Ubuntu in Windows, update by:
sudo apt update
sudo apt install build-essential -y
sudo apt install make -y
sudo apt install automake -y
windows-msys2-Haskell in powershell:
Two lauch commands:
ghci
is the interactive environment of the GHC compiler itselfstack ghci
is the interactive environment of the Stack build tool: 1) automatically handles dependency and installation (VS. GHC and Cabal), 2) config to install packages C:\Users\tangc\AppData\Roaming\stack\global-project\stack.yaml
Image & Cross-citations#
Image-Hosting
All figures are synchronised in Tom’s GitHub folder ./NB_img/
. Using codes to insert pic:
<img src="https://raw.githubusercontent.com/tomctang/NB_img/main/3bias.png" alt="Causality-confounder" width="500">
Markdown image center:
<div align=center>{width=60%}
Cross-citations
Header automatically generate {#mathFP}, so[anytext](#mathFP)
in citing
Between pages: [Discrete & Continuous](../10pe/02discrete_continuous.ipynb#discrete-continuous)
(ipynb auto changed to html in website)