# Ideal clock 5

Clock time is the extreme case of event time, by considering the weighted average of all events.

— Me@2011.05.19

.

.

# 11X

~~~

... 中化口試

~~~

10k trimmer pot: 7.31k

~~~

3150, 4260: Samuel

3170: Danny, 達
3260: Dennis

~~~


.

.

# Presentation 基本原理 1.2.2.3

.

.

（安：但是，有時正正就是需要，解釋兩個要點的關係。那又如何做到，一節課只講一要點呢？）

.

「一課一要點」只是大概而言的企圖，毋須百分百執行。

.

（安：你的意思是，第一、二、三節課，分別講甲、乙、丙？）

.

.

— Me@2022-08-28 07:56:28 PM

.

.

# It doesn’t matter

Euler problem 3.1

.

The bad news is: You cannot make people like, love, understand, validate, accept, or be nice to you.

The good news is: It doesn’t matter.

(defmacro sq (x)
(* ,x ,x))

(car ,lst))

(defmacro list-tail (lst)
(cdr ,lst))

(defmacro last-item (lst)
(car (last ,lst)))

(defun good-reverse (lst)
(labels ((rev (lst acc)
(if (null lst)
acc
(rev
(cdr lst)
(cons (car lst) acc)))))
(rev lst nil)))

(defun prime-sieve-a-list (input-lst)
(labels ((sieve-iter (go-lst acc-list)
(if (not go-lst)
acc-list
(last-item go-lst))

(append (good-reverse acc-list)
go-lst)

(sieve-iter
(remove-if #'(lambda (x)
(=
0))
(list-tail go-lst))
acc-list))))))

(sieve-iter input-lst '())))

(defun range (max &key (min 0) (step 1))
(loop :for n :from min :below max :by step
collect n))

(defmacro prime-sieve (n)
(prime-sieve-a-list (cons 2 (range (1+ ,n)
:min 3
:step 2))))

(time (length (prime-sieve 1234567)))

;; 0.764 seconds of real time
;; 95360

(time (length (prime-sieve 12345678)))

;; 20.128 seconds of real time
;; 809227


— Me@2022-08-27 07:59:30 PM

.

.

# 3.1 Lorentz covariance for motion in electromagnetic fields, 2

.

Is $\displaystyle{\frac{d p_\mu}{ds} = \frac{q}{c} F_{\mu \nu} \frac{d x^\nu}{ds}}$ gauge invariant?

.

~~~

… the defining property of a Lorentz transformation, $\Lambda^\mu_{\;\;\nu}$:

$\eta_{\mu\nu} \Lambda^{\mu}_{\;\;\alpha} \Lambda^\nu_{\;\;\beta} = \eta_{\alpha\beta}$

.

… 4-vectors and (Lorentz)-tensors are transformed like this:

$U'^\mu = \Lambda^\mu_{\;\;\nu}U^\nu$

and

$F'_{\mu\nu} = \Lambda_\mu^{\;\;\alpha} \Lambda_\nu^{\;\;\beta}F_{\alpha\beta}= \Lambda_\mu^{\;\;\alpha} F_{\alpha\beta} (\Lambda^{-1})^{\beta}_{\;\;\nu}$

where we have used the conventional notation

$\displaystyle{\Lambda_\nu^{\;\;\mu} = (\Lambda^{-1})^\mu_{\;\;\nu}}$

.

Let us then take your equation and apply $\displaystyle{\Lambda_\sigma^{\;\;\mu}}$ on both sides (recall this Lorentz transformation does not depend on $\displaystyle{\tau}$), and try rewriting everything in terms of prime quantities:

\displaystyle{ \begin{aligned} m \Lambda_\sigma^{\;\;\mu}\frac{{\rm d}U_\mu}{{\rm d}\tau} &= e \Lambda_\sigma^{\;\;\mu} F_{\mu\nu} U^\nu \\ &= e \Lambda_\sigma^{\;\;\mu} F_{\mu\nu}\eta^{\nu\alpha} U_\alpha\\ m\frac{{\rm d}U'_\sigma}{{\rm d}\tau} &= e \Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\alpha} ((\Lambda^{-1})^{\beta}_{\;\;\nu} \Lambda^\alpha_{\;\;\beta}) U_\alpha\\ &= e \Big(\Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\alpha}(\Lambda^{-1})^{\beta}_{\;\;\nu}\Big) \Big(\Lambda^\alpha_{\;\;\beta} U_\alpha\Big)\\ &= e \Big(\Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu\Big) U'_\beta\\ &= e \Big(\Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu\Big) U'_\beta\\ &= e F'_{\sigma\nu}\eta^{\nu\beta} U'_\beta \\ \\ m\frac{{\rm d}U'_\sigma}{{\rm d}\tau} &= e F'_{\sigma\nu} U'^\nu \\ \end{aligned}}

This “game” can always be done with contracted indices, …

— answered Jul 7, 2020 at 15:06

— ohneVal

— Lorentz invariance of the Lorentz force law

— Physics StackExchange

.

How come \displaystyle{ \begin{aligned} \eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu &= \eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu \\ \end{aligned}}?

.

Note that

\displaystyle{ \begin{aligned} \sum ... \sum \Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu &= \sum ... \sum \Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu \\ \end{aligned}}

does not mean that

\displaystyle{ \begin{aligned} \eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu &= \eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu \\ \end{aligned}}

.

Also

\displaystyle{ \begin{aligned} \sum \eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu &= \sum \eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu \\ \end{aligned}}

does not mean that

\displaystyle{ \begin{aligned} \eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu &= \eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} A = \sum_{\alpha, \beta, \nu} F_{\mu\alpha}\eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu U_\beta' &= \sum_{\alpha, \beta} F_{\mu\alpha}\eta^{\alpha\alpha}\Lambda^{\;\;\beta}_{\nu=\alpha} U_\beta' \\ &= \sum_{\beta} \left( - F_{\mu 0} \Lambda^{\;\;\beta}_{0} + F_{\mu 1} \Lambda^{\;\;\beta}_{1} + F_{\mu 2} \Lambda^{\;\;\beta}_{2} + F_{\mu 3} \Lambda^{\;\;\beta}_{3} \right) U_\beta' \\ \\ \end{aligned}}

\displaystyle{ \begin{aligned} B = \sum_{\alpha, \beta, \nu} F_{\mu\alpha}\eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu U_\beta' &= \sum_{\alpha, \beta} F_{\mu\alpha} \eta^{\beta \beta}\Lambda^{\;\;\alpha}_{\nu=\beta} U_\beta \\ &= \sum_{\alpha} F_{\mu\alpha} \left( - \Lambda^{\;\;\alpha}_{0} U_0' + \Lambda^{\;\;\alpha}_{1} U_1' + \Lambda^{\;\;\alpha}_{2} U_2' + \Lambda^{\;\;\alpha}_{3} U_3' \right) \\ \end{aligned}}

At the first glance, it seems to be unlikely that

\displaystyle{ \begin{aligned} \sum_{\alpha, \beta, \nu} F_{\mu\alpha}\eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu U_\beta' &= \sum_{\alpha, \beta, \nu} F_{\mu\alpha}\eta^{\nu\beta}\Lambda^{\;\;\alpha}_\nu U_\beta' \\ \end{aligned}},

because while in $A$, for any $\beta$, $U_\beta'$‘s have visible negative terms; in $B$, only $U_0'$‘s do.

Without additional mathematical properties among those physical quantities, the identity is impossible to prove.

.

Just for future reference:

From the invariance of the spacetime interval it follows

$\displaystyle{\eta =\Lambda ^{\mathrm {T} }\eta \Lambda}$

— Wikipedia on Lorentz transformation

.

\displaystyle{ \begin{aligned} \eta_{\mu \nu} = \eta'_{\mu \nu} &= \Lambda^{\alpha}{}_{\mu} \Lambda^{\beta}{}_{\nu} \eta_{\alpha \beta} \\ &= (\Lambda^T)_{\mu}{}^{\alpha} \eta_{\alpha \beta} \Lambda^{\beta}{}_{\nu} \\ \\ \eta_{\alpha\beta} &= \Lambda^{\mu}_{\;\;\alpha} \Lambda^{\nu}_{\;\;\beta}\eta_{\mu\nu} \\ \eta^{\alpha\beta} &= \Lambda^{\alpha}_{\;\;\mu} \Lambda^{\beta}_{\;\;\nu}\eta^{\mu\nu} \\ \end{aligned}}

.

\displaystyle{ \begin{aligned} m \Lambda_\sigma^{\;\;\mu}\frac{{\rm d}U_\mu}{{\rm d}\tau} &= e \Lambda_\sigma^{\;\;\mu} F_{\mu\nu} U^\nu \\ & = e \Lambda_\nu^{\;\;\mu} F_{\mu\nu}\eta^{\nu\alpha} U_\alpha\\ \end{aligned}}

Inserting the identity $\sum_\beta (\Lambda^{-1})^{\beta}_{\;\;\nu} \Lambda^\alpha_{\;\;\beta}$ into the expression:

\displaystyle{ \begin{aligned} m\frac{{\rm d}U'_\sigma}{{\rm d}\tau} &= e \Big(\Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\alpha}(\Lambda^{-1})^{\beta}_{\;\;\nu}\Big) \Big(\Lambda^\alpha_{\;\;\beta} U_\alpha\Big) \\ &= e \Big(\Lambda_\sigma^{\;\;\mu} F_{\mu\alpha}\eta^{\nu\alpha}\Lambda^{\;\;\beta}_\nu\Big) U'_\beta\\ \end{aligned}}

This path does not work. Also, the formula $\displaystyle{ \Lambda^\alpha_{\;\;\beta} U_\alpha = U'_\beta }$ is plain wrong!

.

Inserting the identity $\sum_\beta (\Lambda^{-1})^{\beta}_{\;\;\nu} \Lambda^\alpha_{\;\;\beta}$ into the expression before (actually without) lowering the index:

\displaystyle{ \begin{aligned} m \Lambda_\sigma^{\;\;\mu}\frac{{\rm d}U_\mu}{{\rm d}\tau} &= e \Lambda_\sigma^{\;\;\mu} F_{\mu\nu} U^\nu \\ &= e \Lambda_\sigma^{\;\;\mu} F_{\mu\alpha} ((\Lambda^{-1})^{\alpha}_{\;\;\beta} \Lambda^\beta_{\;\;\nu}) U^\nu \\ m \frac{{\rm d}U_\sigma'}{{\rm d}\tau} &= e (\Lambda_\sigma^{\;\;\mu} F_{\mu\alpha} (\Lambda^{-1})^{\alpha}_{\;\;\beta}) (\Lambda^\beta_{\;\;\nu} U^\nu) \\ &= e {F'}_{\sigma \beta} {U'}^\beta \\ \end{aligned}}

— Me@2022-08-23 12:03:54 PM

.

.

# High level machine language

susam 16 days ago

The first article in this issue of BYTE has a very interesting characterization of Lisp that I have not come across before. I mean, famous quotes like “Lisp is a programmable programming language” by John Foderaro and “The greatest single programming language ever designed” by Alan Kay are often mentioned in articles about Lisp. But in this issue of BYTE, the article “An Overview of LISP” by John Allen at page 10 has something very interesting to say. Excerpt from the article:

“The best description of the LISP programming language is that it is a high level machine language. That is, it shares many of the facets of contemporary machine language –the necessity for attention to detail and the freedom to manipulate the machine’s data and programs without restriction– yet LISP is high level in that the language contains the expressive power and convenience of traditional high level languages. The contradiction is resolvable: a LISP machine is just a higher level machine whose data items are organized differently from the binary bit patterns of most machines, and the LISP programming language is the assembly language for this machine.”

Consider the Emacs Lisp (Elisp) interpreter for example. Elisp interpreter is the Lisp machine. It understands Elisp symbolic expressions, the language of this machine. With enough code written in this machine’s language, we get this fine editing and productivity software known as Emacs!

aap_ 16 days ago

This exactly matches my thoughts. It seems that machine language and LISP are the only two languages (that I know anyway) where code and data are fundamentally the same kind of thing.

— Byte Magazine: LISP (1979)

— Hacker News

.

.

2022.08.22 Monday ACHK

# Daily life is boring

.

YOU are the missing MAGIC in your daily life.

— Me@2016-08-24 12:32 AM

.

.

# 反情感勒索

.

.

.

.

— Me@2022-08-20 11:27:16 PM

.

.

The goal of this blog post is to install an advanced Haskell mode, called LSP mode, for Emacs.

0. In this tutorial, you will need to go to the official website of NixOS and that of MELPA (Milkypostman’s Emacs Lisp Package Archive). Make sure that both websites are the real official ones. Any instructions from an imposter website can get your machine infected with malware.

1. Assuming your computer OS is Ubuntu 20.04 or above, go to the NixOS official website. Follow the instructions to install the Nix package manager (not the NixOS) onto your OS. Choose the “single-user installation” method.

2. On the NixOS official website, click the magnifying glass at the top right corner to reach the package search engine.

3. Search “haskell language server” and then copy its installation command.

nix-env -iA nixpkgs.haskell-language-server


4. Run the command in the bash terminal to install the Haskell Language Server.

.

5. Search “stack” on the package search engine.

6. Run its installation command

nix-env -iA nixpkgs.stack


to install the Haskell Tool Stack.

7. Search “ghc” on the package search engine.

8. Run its installation command

nix-env -iA nixpkgs.ghc


to install the Glasgow Haskell Compiler.

.

This step is needed for triggering the OS to recognize the Nix package manager setup.

.

10. Go to MELPA package manager’s official website. Follow the instructions to install “Melpa”, not “Melpa Stable”.

11. Open the Emacs editor. Click "Options" and then "Manage Emacs Packages".

Install the following packages. For each of them, make sure that you have chosen the source archive as “melpa“. Versions from other sources would not work.

company Modular text completion framework
flycheck On-the-fly syntax checking
lsp-mode LSP mode
lsp-ui UI modules for lsp-mode

12. Open Emacs’ initialization file, which has the filename

.emacs

Its location should be

~/.emacs


13. Add the following code to the file.

;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'company)

(require 'flycheck)

(require 'lsp-ui)

;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'lsp)

(save-place-mode 1)

;;;;;;;;;;;;;;;;;;;;;;;;;;

(interactive)

(windmove-up))

(global-set-key
(kbd "C-n")

;;;;;;;;;;;;;;;;;;;;;;;;;;


14. Close the Emacs program.

.

15. Create a dummy Haskell source code file named “test.hs”.

16. Use Emacs to open it.

17. You should see this message:

18. Select one of the first 3 answers. Then you can start to do the Haskell source code editing.

19. To compile your code, hold the Ctrl key and press n.

Ctrl+n


— Me@2022-08-18 05:22:02 PM

.

.

# Clojupyter

SICMUtils, 4

.

The goal of this post is to run SICMUtils in Clojure in Jupyter Notebook.

.

1. Read and follow the exact steps of my post titled “SICMUtils“.

2. Do the same for my another post “Jupyter Notebook“.

.

3. Use Emacs to open the file:

~/my-stuff/project.clj


4. Replace the existing :dependencies line with this one:

  :dependencies [[org.clojure/clojure "1.11.1"]
[sicmutils "0.22.0"]
[clojupyter "0.3.3"]]


And make sure that all version numbers are the most updated ones.

5. Save the file.

.

6. In bash terminal, go to your project folder such as “~/my-stuff“:

cd ~/my-stuff


lein deps


.

8. Clojupyter is a Jupyter kernel for Clojure. According to its documentation, Clojupyter has provided some command line tools. However, I could not understand how to use those commands in the bash terminal.

Finally, I found out that to run a Clojupyter command, such as “list-commands“, we just need to add the following code before it:

lein run -m clojupyter.cmdline


.

That results the whole command as

lein run -m clojupyter.cmdline list-commands


However, that would be wordy. So we create a shortcut for it.

.

9. Use Emacs to open the file:

~/my-stuff/project.clj


10. Below the entry “:dependencies“, add another one called “:aliases“.

:dependencies [[org.clojure/clojure "1.11.1"]
[sicmutils "0.22.0"]
[clojupyter "0.3.3"]]
;
:aliases {"cjcmd"
;
["run" "-m" "clojupyter.cmdline"]}


11. Then, the shortcut is made. To test, run:

lein cjcmd list-commands


.

12. Go to your project folder:

cd ~/my-stuff


13. And then run

lein uberjar


to create a binary file named my-stuff-0.1.0-SNAPSHOT-standalone.jar, which includes not only the program itself, but also all its dependencies.

We are going to use it to generate a Jupyter kernel that includes not only the Clojure language, but also the SICMUtils mechanics library.

.

14. For the following code,

lein cjcmd install
--ident cj-kernel
--jarfile
~/my-stuff/target/uberjar/standalone.jar


replace the file name

standalone.jar


with

my-stuff-0.1.0-SNAPSHOT-standalone.jar


15. In the bash terminal, run the code in one line.

.

16. In your OS, try to open the SageMath program. It will open a Jupyter notebook page.

17. Click the “New” button at the top right corner and then select “cj-kernel“.

18. There might be some error messages, such as

“The kernel appears to have died. It will restart automatically.”

However, you can actually use the program, i.e. the Clojure language with the SICMUtils mechanics library.

.

19. Type

(clojure-version)


onto the input line.

20. Hit the keys shift-enter to get the output.

.

21. Input

(require '[sicmutils.env :as env])


and hit shift-enter.

22. Also

(env/bootstrap-repl!)


There might be some WARNING messages. But you can just ignore them.

.

23. Code

(->TeX (simplify ((D cube) 'x)))


will result

3\\,{x}^{2}


.

24. Test some code examples provided by the official website of Clojupyter.

.

25. Go to the official website of SICMUtils. Go to its jupyter directory to read the example notebooks.

sicmutils/jupyter/


.

26. Go to the documentation of SICMUtils. Read the page “Comparison to scmutils“.

— Me@2022-07-30 12:18:50 PM

— Me@2022-08-18 09:07:36 AM

.

.

# Before Mathematica

I figured if I couldn’t explain something clearly in documentation, nobody was ever going to understand it, and it probably wasn’t designed right. And once something was in the documentation, we knew both what to implement, and why we were doing it.

I think this a great practice to follow. I often find it very helpful to write documentation before writing code. I find I end up with a better designed system this way, and as an added bonus it has great documentation too.

— There Was a Time before Mathematica

— Stephen Wolfram

.

The main idea is to regard a program as a communication to human beings rather than as a set of instructions to a computer.

— Donald Knuth

.

Programs are meant to be read by humans and only incidentally for computers to execute.

— Structure and Interpretation of Computer Programs

.

.

2022.08.16 Tuesday ACHK

# Presentation 基本原理 1.2.2.2

.

.

（安：但是，有時正正就是需要，解釋兩個要點的關係。那又如何做到，一節課只講一要點呢？）

.

「一課一要點」只是大概而言的企圖，毋須百分百執行。

— Me@2022-08-15 11:16:21 AM

.

.

# 開心 vs 關心

Euler problem 2

.

The older I get, the less I care about what people think about me. Therefore the older I get, the happier I am.

.

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

(defun fib (n)
(cond ((= n 0) 0)
((= n 1) 1)
((> n 1) (+ (fib (- n 2)) (fib (- n 1))))))

(time (fib 40))

;; Evaluation took:
;;   2.648 seconds of real time
;;   2.640080 seconds of total run time
;;   99.70% CPU
;;   9,002,590,370 processor cycles
;;   0 bytes consed
;;

;; tail resursion

(defun fib-t (n)
(labels ((fib-iter (m a b)
(if (= m 0)
a
(fib-iter (- m 1) b (+ a b)))))
(fib-iter n 0 1)))

(time (fib-t 40))

;; Evaluation took:
;;   0.000 seconds of real time
;;   0.000002 seconds of total run time
;;   100.00% CPU
;;   2,184 processor cycles
;;   0 bytes consed
;;

;; infinite list

(defmacro append-last (lst obj)
(append ,lst (list ,obj)))

(defun fib-i (n)
(labels ((fib-iter (m fib-list a b)
(if (> m (- n 2))
fib-list
(fib-iter (1+ m)
(append-last fib-list (+ a b))
b
(+ a b)))))
(fib-iter 0 '(0 1) 0 1)))

(time (fib-i 40))

;; Evaluation took:
;;   0.000 seconds of real time
;;   0.000008 seconds of total run time
;;   100.00% CPU
;;   21,960 processor cycles
;;   32,768 bytes consed

(defun filter (fn lst)
(let ((acc nil))
(dolist (x lst)
(let ((val (funcall fn x)))
(if val (push val acc))))
(nreverse acc)))

(defmacro filter-list (fn lst)
(filter #'(lambda (x)
(if (funcall ,fn x) x))
,lst))

(defmacro filter-2 (fn1 fn2 lst)
(filter-list #'(lambda (x)
(if (and
(funcall ,fn1 x)
(funcall ,fn2 x))
x))
,lst))

(reduce #'+ (filter-2 #'evenp
#'(lambda (x) (< x 4000000))
(fib-i 100)))

; 4613732

— Me@2022-08-07 12:34:19 PM

.

.

# 3.1 Lorentz covariance for motion in electromagnetic fields, 1

A First Course in String Theory

.

The Lorentz force equation (3.5) can be written relativistically as

$\displaystyle{\frac{d p_\mu}{ds} = \frac{q}{c} F_{\mu \nu} \frac{d x^\nu}{ds}}$,

where $\displaystyle{p_{\mu}}$ is the four-momentum.

(a) Check explicitly that this equation reproduces (3.5) when $\displaystyle{\mu}$ is a spatial index.

(b) What does (1) gives when $\displaystyle{\mu = 0}$? Does it make sense?

~~~

Eq. (3.5):

$\displaystyle{\frac{d \vec p}{dt} = q \left( \vec E + \frac{\vec v}{c} \times \vec B \right)}$

Eq. (2.20):

$\displaystyle{ds \equiv \sqrt{ds^2}}$    if    $\displaystyle{ds^2 > 0}$

Eq. (2.21):

$\displaystyle{-ds^2 = \eta_{\mu \nu} dx^\mu dx^\nu}$

The spacetime interval $\displaystyle{ds^2}$ is Lorentz invariant. If $\displaystyle{ds^2 > 0}$, we have Eq. (2.27) and (2.28):

\displaystyle{\begin{aligned} ds &= c dt_p \\ ds &= c dt \sqrt{1 - \beta^2} \end{aligned}}

.

$\displaystyle{\frac{d p_\mu}{ds} \left( \frac{ds}{dt} \right) = \frac{q}{c} F_{\mu \nu} \frac{d x^\nu}{ds}} \left( \frac{ds}{dt} \right)$

\displaystyle{ \begin{aligned} \frac{d p_1}{dt} &= \frac{q}{c} F_{1 \nu} \frac{d x^\nu}{dt} \\ &= \frac{q}{c} \left( F_{1 0} \frac{d x^0}{dt} + F_{1 1} \frac{d x^1}{dt} + F_{1 2} \frac{d x^2}{dt} + F_{1 3} \frac{d x^3}{dt} \right) \\ \frac{d p_x}{dt} &= \frac{q}{c} \left( E_x c \frac{d t}{dt} + (0) \frac{d x^1}{dt} + B_z \frac{d x^2}{dt} - B_y \frac{d x^3}{dt} \right) \\ &= q \left( E_x + \frac{1}{c} \left( \vec v \times \vec B \right)_x \right) \\ \end{aligned}}

\displaystyle{ \begin{aligned} \frac{d p_0}{dt} &= \frac{q}{c} \left( F_{0 0} \frac{d x^0}{dt} + F_{0 1} \frac{d x^1}{dt} + F_{0 2} \frac{d x^2}{dt} + F_{0 3} \frac{d x^3}{dt} \right) \\ &= \frac{q}{c} \left( 0 \frac{d x^0}{dt} - E_x \frac{d x^1}{dt} - E_y \frac{d x^2}{dt} - E_z \frac{d x^3}{dt} \right) \\ \frac{d }{dt} \left( \frac{-E}{c} \right)&= - \frac{q}{c} \left( \vec v \cdot \vec E \right) \\ \frac{d E}{dt} &= \vec v \cdot \vec F_E \\ \end{aligned}}

— Me@2022-08-04 04:17:59 PM

.

.

Anyone who expects to create, be it as scientist or artist, scholar or writer, needs self-confidence, even bravado. How else can one dare to imagine understanding what no one else has understood, discovering what no one else has discovered? Where does this confidence come from? Fortunately, every young person is blessed with some of it. It is part of human character. What of the girl or boy who reads about Newton and Maxwell and Bohr and Einstein and says, “I want to build on what they have built; I want to add to the sum of knowledge about the most basic laws of nature”?

– Geons, Black Holes & Quantum Foam, p. 84

– 2000
.

.

# CSCI3420


~~~

~~~

Design:
1: make car moving
2: make car stop itself
4: change direction
5: tuning

~~~

CSCI3420 Project Phase 2

~~~



.

.

# 排列組合 1.1

nCr, 0

.

$\displaystyle{n!}$

.

1.1  意思：

$\displaystyle{n}$ 個人 $\displaystyle{n}$ 個座位的話，有多少種坐法？

1.2.1  算式：

$\displaystyle{n! = (n)(n-1)(n-2) \cdots (3)(2)(1)}$

1.2.2  由來：

.

1.3

$\displaystyle{n! = (n)(n-1)(n-2) \cdots (3)(2)(1)}$

\displaystyle{\begin{aligned} 5! &= (5)(4)(3)(2)(1) \\ \\ \end{aligned}}

$\displaystyle{3!}$，就有 3 項；等等。

\displaystyle{\begin{aligned} 3! &= (3)(2)(1) \\ \end{aligned}}

.

1.4.0  零的階乘，$\displaystyle{0!}$，還未有定義，因為，算式 $\displaystyle{n! = (n)(n-1) \cdots (2)(1)}$ 中的 $\displaystyle{n}$，只可以是正整體，不可以零。

1.4.1  既然 $\displaystyle{n!}$意思是「$\displaystyle{n}$ 個人 $\displaystyle{n}$ 個座位，有多少種坐法」，那樣，你就可以視，$\displaystyle{0!}$ 的意思是「$\displaystyle{0}$ 個人 $\displaystyle{0}$ 個座位，有多少種坐法」；那明顯是一，因為，那個情況之下，只有一個「坐法」，就是「沒有人又沒有位」這個唯一的可能性。

$\displaystyle{0! = 1}$

.

1.4.2  另外一種設計定義的想法是，由 $\displaystyle{n!}$算式取靈感。

$\displaystyle{0! = a^0}$

「零項相乘」即是「乘了等如沒有乘」，所以是一，因為任何數乘了一，效果都等於沒有乘。

$\displaystyle{a^0 = 1}$

（「零項相乘」的正式學名是，「空積」或「零項積」。）

$\displaystyle{0! = 1}$

— Me@2022-08-02 02:41:43 PM

.

.

# Mega Man Zero 3

Euler problem 1

.

(proclaim '(optimize speed))

(reduce #'+ '(1 2 3 4))

; 10

(loop :for n :below 10 :collect n)

; (0 1 2 3 4 5 6 7 8 9)

(describe :below)

(defun range (max &key (min 0) (step 1))
(loop :for n :from min :below max :by step
collect n))

(- (+ (* 3 (reduce #'+ (range 334 :min 1 :step 1)))
(* 5 (reduce #'+ (range 200 :min 1 :step 1))))
(* 15 (reduce #'+ (range 67 :min 1 :step 1))))

; 233168

(defun sum-1-n (n)
(/ (* n (+ n 1)) 2))

(- (+ (* 3 (sum-1-n 333))
(* 5 (sum-1-n 199)))
(* 15 (sum-1-n 66)))

; 233168

— Me@2022-08-01 03:29:01 PM

.

.

# Jupyter Notebook

SICMUtils, 3

.

The goal of this post to setup Jupyter Notebook.

.

1. Read and follow the exact steps of my post titled “SICMUtils“.

.

2. To install the Jupyter Notebook software in Ubuntu, use this command:

sudo apt-get install sagemath-jupyter


3. Try to open the SageMath program.

4. It will open a Jupyter notebook page.

5. Click the “New” button at the top right corner and then select “SageMath“.

.

6. Type

1 + 1


onto the input line.

7. Hit the keys shift-enter to get the output

2


.

8. Input

Integrate(x^3, x)


9. Hit shift-enter:

NameError: name 'Integrate' is not defined


.

10. Input

from sage.symbolic.integration.integral import *

indefinite_integral(x^3, x)


11. Hit shift-enter:

1/4*x^4


.

12. Input

%display latex


13. Hit shift-enter.

.

14. Input

indefinite_integral(x^3, x)


15. Hit shift-enter:

$\displaystyle{\frac{1}{4} \, x^{4}}$

— Me@2022-07-30 12:18:50 PM

.

.