philip1209 on June 30, 2018

One of my favorite classes in college was a physics course taught in this way:

1. Before class, we were assigned to read a chapter from the textbook, understand the material, and complete two or three homework problems from the material we had just self-learned.

2. After submitting homework, lectures focused on discussing the concepts more in-depth. Everybody already had a baseline knowledge, so the professor would highlight the important takeaways, applications, live demonstrations of concepts, etc. I found these lectures engaging because I had already learned the material – and the lectures focused on mastering it.

3. Sometimes there would be follow-up homework problems focusing on advanced applications or derivations. These advanced problems were closest to exam questions.

Some takeaways for me:

• If we didn’t have homework to do before class, I doubt I would have consistently learned the material before lecture.

• Lectures taught us more than the “what” – it taught us the “why” and how these concepts related to other areas.

• Lectures focused on answering questions, exploring curiosities (like “what if” questions), demonstrations/experiments, and mastery. The professor added value beyond the written material!

I hope this helps OP because it sounds like they have material prepared beforehand, which means that the lectures could go beyond the material.

— Hacker News

.

.

2022.12.13 Tuesday ACHK

# 人生 Presentation, 2.1

.

（安：雖然我不是從事教學工作，但是，在公司解釋東西給上司時，其實很多時也需要使用到，所謂的「教學技巧」。

.

（安：但是，除了這一點外，你應該還有其他技巧，因為，我覺得你很多時也會，在適當時候，講適當的東西。）

.

「在適當時候，講適當的東西」這個講法好得意，因為，你可以反問：

.

— Me@2022-12-12 02:40:07 PM

.

.

# Direct from Dell

Euler problem 9.2

.

There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.

g p =
[ [a, b, c]
| m <- [2 .. limit],
n <- [1 .. (m - 1)],
let a = m ^ 2 - n ^ 2,
let b = 2 * m * n,
let c = m ^ 2 + n ^ 2,
a + b + c == p
]
where
limit = floor . sqrt . fromIntegral \$ p


.

Euclid’s formula is a fundamental formula for generating Pythagorean triples given an arbitrary pair of integers $m$ and $n$ with $m > n > 0$. The formula states that the integers

$\displaystyle{ a=m^{2}-n^{2},\ \,b=2mn,\ \,c=m^{2}+n^{2}}$

form a Pythagorean triple. The triple generated by Euclid’s formula is primitive if and only if $m$ and $n$ are coprime and one of them is even. When both $m$ and $n$ are odd, then $a$, $b$, and $c$ will be even, and the triple will not be primitive; however, dividing $a$, $b$, and $c$ by 2 will yield a primitive triple when $m$ and $n$ are coprime.

Every primitive triple arises (after the exchange of $a$ and $b$, if $a$ is even) from a unique pair of coprime numbers $m$, $n$, one of which is even.

— Wikipedia on Pythagorean triple

— Me@2022-12-10 09:57:27 PM

.

.

# Ex 2.1 Curves

Functional Differential Geometry

.

a. The rectangular coordinate equation for the Lemniscate of Bernoulli is

$\displaystyle{(x^2 + y^2)^2 = 2 a^2 (x^2 - y^2)}$.

Find the expression in polar coordinates.

b. Describe a helix space curve in both rectangular and cylindrical coordinates.

~~~

(define-coordinates (up x y) R2-rect)

(define-coordinates (up r theta) R2-polar)

;

(define R2-rect-chi (chart R2-rect))

; R2-rect-chi
;     generates the rectangle coordinates of a point.

(define R2-rect-chi-inverse (point R2-rect))

; R2-rect-chi-inverse
;     gets the abstract representation.

(x (R2-rect-chi-inverse (up 'x0 'y0)))

; Function x
;     gets the x coordinate
;          of an (abstract-represented) point.

;

(define R2-polar-chi (chart R2-polar))

(define R2-polar-chi-inverse (point R2-polar))

(x (R2-polar-chi-inverse (up 'r0 'theta0)))

(r (R2-polar-chi-inverse (up 'r0 'theta0)))

(r (R2-rect-chi-inverse (up 'x0 'y0)))

(theta (R2-rect-chi-inverse (up 'x0 'y0)))

;

(define h (+ (* x (square r)) (cube y)))

(define R2-rect-point
(R2-rect-chi-inverse (up 'x_0 'y_0)))

(show-expression
(h R2-rect-point))

(show-expression
(h (R2-polar-chi-inverse (up 'r_0 'theta_0))))


(show-expression
((- r (* 2 'a (+ 1 (cos theta))))
((point R2-rect) (up 'x 'y))))


; Ex 2.1 a

(show-expression
((- (square (+ (square x) (square y)))
(* 2 (square 'a) (- (square x) (square y))))
((point R2-rect) (up 'x 'y))))

(show-expression
((- (square (+ (square x) (square y)))
(* 2 (square 'a) (- (square x) (square y))))
((point R2-polar) (up 'r 'theta))))


; Ex 2.1 b

(define-coordinates (up r theta z) R3-cyl)

(define-coordinates (up x y z) R3-rect)

(show-expression
((- (up r z) (up 'R (* 'a theta)))
((point R3-cyl) (up 'r 'theta 'z))))

(show-expression
((- (up r z) (up 'R (* 'a theta)))
((point R3-rect) (up 'x 'y 'z))))


— Me@2022-12-10 10:29:59 AM

.

.

Posted in FDG

# Why does the universe exist? 7.0

ParEdit, 2

.

What is there before the beginning of the universe?

What does the universe change from?

— Me@2016-07-20 06:16:34 AM

.

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

"paredit" "Turn on pseudo-structural editing." t)

;;;;;;;;;;;

(mapc (lambda (hook)
hooks))

'emacs-lisp-mode-hook
'eval-expression-minibuffer-setup-hook
'ielm-mode-hook
'lisp-mode-hook
'lisp-interaction-mode-hook
'scheme-mode-hook)

#'enable-paredit-mode)

;;;;;;;;;;;

(lambda () (paredit-mode +1)))

(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map

'override-slime-repl-bindings-with-paredit)

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


— Me@2022-12-09 01:24:55 PM

.

.

# Computing Note, 3


Summer 2002

1. Perhaps the Encyclopedia Britannica
Research Assistant
is written by[in] Java.

2. Work Hard Play Hard
Live your life with[in] all [its] fullness.

3. H(Learning): HyperLearning 真切學習:
[]
Be a professional professional: 比專業還專業



.

To edit Lazarus code in Emacs:

1. Open Emacs’ initialization file, whose location should be

~/.emacs


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

(defmacro compile-with (command-string)

(progn

(save-buffer)

(unless visual-line-mode
(visual-line-mode 1))

(universal-argument)

(compile ,command-string)))

(defmacro defcomp (fn command-string kbd-string)

(progn

(defun ,fn ()

(interactive)

(compile-with ,command-string))

(global-set-key (kbd ,kbd-string) ',fn)))

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

(defcomp g-la-com

(concat
"lazbuild "
(replace-regexp-in-string
"pas" "lpi" buffer-file-name))

"C-x C-p")

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

(defcomp g-la-run

(replace-regexp-in-string
".pas" "" buffer-file-name)

"C-x C-[")

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


3. Close Emacs.

4. Use the Lazarus IDE to create a console project named p11.

5. Close Lazarus.

6. Use Emacs to open the file p11.pas.

— Me@2022-12-07 08:35:48 PM

.

.

# Combinatorial proof

.

— Me@2022-12-06 09:58:50 AM

.

.

# Pier, 2.2

Euler problem 9.1

.

There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.

(defun e9c ()
(loop :for a :from 1 :to 1000 :do
(loop :for b :from 1 :to a :do
(let ((c (- 1000 (+ a b))))
(if (= (+ (* a a) (* b b)) (* c c))
(return-from e9c
(list a b c (* a b c))))))))


— colorized by palette fm

— Me@2022-12-05 05:59:49 PM

.

.

# Fortran Package Manager

.

The goal of this blog post is to set up an integrated programming environment for Fortran.

.

3. Install the package manager Anaconda.

4. Use Anaconda to install the Fortran Package Manager (fpm), by following the fpm installation guide.

4.1. Add the additional channel mentioned in the fpm installation guide.

4.2. Install the fpm itself:

conda create -n fpm_env fpm

conda activate fpm_env

5. Install the Fortran language server:

conda install fortls

6. Install the Emacs plugin:

sudo apt-get install elpa-pyvenv


7. Open Emacs’ initialization file, whose location should be

~/.emacs


8. Add the following code to the file.


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

(defun gfortran-run ()

(interactive)

(save-buffer)

(unless visual-line-mode
(visual-line-mode 1))

(universal-argument)

(compile "fpm run"))

(global-set-key (kbd "C-x C-r") 'gfortran-run)

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

(setenv "WORKON_HOME" "~/anaconda3/envs")

(pyvenv-mode 1)

(pyvenv-workon "fpm_env")

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

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

— Me@2022-12-01 09:18:59 AM

.

.

# Why does the universe exist? 7.3

Euler problem 10.4

.

program main

implicit none

integer :: p_max, p_count, i, j
integer(kind = 16) :: p_sum
logical, ALLOCATABLE, DIMENSION(:) :: is_prime

p_max = 2000000

ALLOCATE(is_prime(p_max))

is_prime = .true.

is_prime(1) = .false.

do i = 2, ceiling(sqrt(real(p_max)))
if (is_prime(i)) then
do j = i*i, p_max, i
is_prime(j) = .false.
end do
end if
end do

p_count = 0
p_sum = 0
do i = 1, p_max
if (is_prime(i)) then
p_count = p_count + 1
p_sum = p_sum + i
end if
end do

print *, "p_count == ", p_count
print *, "p_sum == ", p_sum

DEALLOCATE(is_prime)

end program main


For a universe part, which is partial in space or in time, you can ask for its cause.

But for the universe as a whole, you cannot.

If the big bang is the first cause, you cannot ask for the cause of its existence.

Asking for the cause of the existence of the universe is the same as asking for the cause of the first cause.

— Me@2012-10-15 08:33:01 AM

— Me@2022-11-27 09:09:53 PM

.

.

# Hacking Reality

Good marriage is better than no marriage.

No marriage is better than bad marriage.

— John T Reed

.

Your wife should be the exception of the (brutal) reality of this world.

If someone is just another reality, better not to marry her.

— Me@2022-11-10 01:21:15 AM

.

.

# 大恩養仇人

.

no good deed goes unpunished

Beneficial actions often go unappreciated or are met with outright hostility.

— Wiktionary

.

.

1. 那是你自己的能力範圍以內。

2. 當事人有明確要求，或者情境預設，例如，當事人已昏迷，需立刻送院。

.

「幫助別人」就有如「責備別人」，雖然有時必須，但是越小越好，越少越好。

「幫助別人」就有如「服用藥物」，雖然有時必須，但是越小越好，越少越好。

.

— Me@2022-12-02 04:34:36 PM

.

.

# ParEdit

.

(autoload 'enable-paredit-mode
"paredit" "Turn on pseudo-structural editing." t)

#'enable-paredit-mode)

#'enable-paredit-mode)

#'enable-paredit-mode)

#'enable-paredit-mode)

#'enable-paredit-mode)

#'enable-paredit-mode)

(lambda () (paredit-mode +1)))

(defun override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map

'override-slime-repl-bindings-with-paredit)

.

— Me@2022-11-29 10:03:49 PM

.

.

# Ex 1.2-1 Stationary States

Quantum Methods with Mathematica

.

Assume a wavefunction of the form psi[x, t] == f[t] psi[x] and perform a separation of variables on the wave equation.

Show that f[t] = E^(-I w t) where h w is the separation constant. Try the built-in function DSolve.

Equate h w to the Energy by evaluating the [expected] value of hamiltonian[V] in the state psi[x, t].

~~~

Remove["Global*"]

hbar := \[HBar]

H[V_] @ psi_  := -hbar^2/(2m) D[psi,{x,2}] + V psi

psi[x_,t_] := f[t] psi[x]

I hbar D [psi[x,t],t] == H[V] @ psi[x, t]

I hbar D [psi[x,t],t] / psi[x,t] == H[V] @ psi[x,t] / psi[x,t]


$\displaystyle{i \hbar \psi (x) f'(t)=V f(t) \psi (x)-\frac{\hbar ^2 f(t) \psi ''(x)}{2 m}}$

$\displaystyle{\frac{i \hbar f'(t)}{f(t)}=\frac{V f(t) \psi (x)-\frac{\hbar ^2 f(t) \psi ''(x)}{2 m}}{f(t) \psi (x)}}$

E1 := I hbar D [psi[x,t],t] / psi[x,t] == H[V] @ psi[x,t] / psi[x,t]

Simplify[E1]


$\displaystyle{\frac{1}{2} \hbar \left(\frac{\hbar \psi ''(x)}{m \psi (x)}+\frac{2 i f'(t)}{f(t)}\right)=V}$

E2 := - 1/2 hbar hbar (D[D[psi[x],x],x]/(m psi[x])) == hbar omega

DSolve[E2, psi[x], x]

E3 := 1/2 hbar 2 i D[f[t],t] / f[t] == hbar omega

DSolve[E3, f[t], t]


$\displaystyle{\left\{\left\{\psi (x)\to c_1 \cos \left(\frac{\sqrt{2} \sqrt{m} \sqrt{\omega } x}{\sqrt{\hbar }}\right)+c_2 \sin \left(\frac{\sqrt{2} \sqrt{m} \sqrt{\omega } x}{\sqrt{\hbar }}\right)\right\}\right\}}$

$\displaystyle{\left\{\left\{f(t)\to c_1 e^{\frac{\omega t}{i}}\right\}\right\}}$


k

psi[x_] := c E^(I k x)

psi[x]

f[t_] := E^(-I omega t)

f[t]

psi[x_,t_] := f[t] psi[x]

psi[x,t]


$\displaystyle{ \left\{k,c e^{i k x},e^{-i \omega t},c e^{i k x-i \omega t}\right\} }$

E4 := Conjugate[psi[x,t]] H[0] @ psi[x,t]

E4

E5 := Simplify[E4]

E5

k := Sqrt[2 m omega / hbar]

Refine[E5, {Element[{c, omega, m, t, hbar, k, x}, Reals]}]

$\displaystyle{ \frac{c k^2 \hbar ^2 c^* \exp \left(-i \left(-(\omega t-k x)^*-k x+\omega t\right)\right)}{2 m} }$

$\displaystyle{ = c^2 \omega \hbar }$

E6 := Conjugate[psi[x,t]] psi[x,t]

Simplify[E6]

$\displaystyle{ c c^* \exp \left(-i \left(-(\omega t-k x)^*-k x+\omega t\right)\right) }$

$\displaystyle{ = c^2 }$

.

\displaystyle{\begin{aligned} \langle E \rangle &= \frac{\int_{-\infty}^{\infty} \psi^* H_{V=0} \psi dx}{\int_{-\infty}^{\infty} \psi^* \psi dx} \\ \\ &= \frac{c^2 \omega \hbar \int_{-\infty}^{\infty} dx}{c^2 \int_{-\infty}^{\infty} dx} \\ \\ &= \omega \hbar \\ \end{aligned}}

.

— Me@2022-11-26 07:17:29 PM

.

.

# Why does the universe exist? 7.2

“There is nothing in that region of space”

and

“there is nothing outside the universe”

have different meanings.

.

there is nothing except quantum fluctuations in that region of space

= the best detector detects nothing but quantum fluctuations

.

there is nothing outside the universe

= whatever detected, label the whole collection as “the universe”

.

“There is nothing outside the universe” does not (!!!) mean that “we go outside the universe to keep searching, but find nothing”.

— Me@2012-10-15 08:33:01 AM

— Me@2022-11-27 09:09:53 PM

.

.

.

.

.

# Euler problem 8.3

Directory[]

mString := Import["n.txt"]

nString := StringDelete[mString, "\n" | "\r"]

nList := Map[FromDigits, Characters[nString]]

take13[lst_] := Times @@ Take[lst,13]

Fmax13n[lst_, n_] := If[Length[lst] < 13,
n,
With[{t13 = take13[lst]},
If[n > t13,
Fmax13n[Rest[lst], n],
Fmax13n[Rest[lst], t13]]]]

Fmax13n[nList, 0]

Wmax13n[lst_, n_] := Which[
Length[lst] < 13, n,
t13 = take13[lst];
n > t13, Wmax13n[Rest[lst], n],
True, Wmax13n[Rest[lst], t13]]

Wmax13n[nList, 0]

Fmax13n[nList, 0] - Wmax13n[nList, 0]


— colorized by palette fm

— Me@2022-11-24 05:51:56 PM

.

.

# Problem 14.5d1.2.2

A First Course in String Theory

.

The generating function is an infinite product:

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

\displaystyle{\begin{aligned} &f_{L, NS+}(x) \\ &= a_{NS+} (r) x^r \\ &= \frac{1}{x} \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ \end{aligned}}

.

To evaluate the infinite product, you can use Mathematica (or its official free version Wolfram Engine) with the following commands:

TeXForm[
HoldForm[
(1/x)*Product[
(1+x^(r-1/2))^32/(1-x^r)^8,
{r, 1, Infinity}]]]

f[x_] := (1/x)*Product[
(1+x^(r-1/2))^32/(1-x^r)^8,
{r, 1, Infinity}]

Print[f[x]]

TeXForm[f[x]]

TeXForm[Series[f[x], {x,0,3}]]

$\displaystyle{\frac{1}{x}\prod _{r=1}^{\infty } \frac{\left(1+x^{r-\frac{1}{2}}\right)^{32}}{\left(1-x^r\right)^8}}$

1        32
QPochhammer[-(-------), x]
Sqrt[x]
------------------------------------
1    32                    8
(1 + -------)   x QPochhammer[x, x]
Sqrt[x]

$\displaystyle{\frac{\left(-\frac{1}{\sqrt{x}};x\right)_{\infty }^{32}}{\left(\frac{1}{\sqrt{x}}+1\right)^{32} x (x;x)_{\infty }^8}}$

$\displaystyle{\frac{1}{x}+\frac{32}{\sqrt{x}}+504+5248 \sqrt{x}+40996 x+258624 x^{3/2}+1384320 x^2+O\left(x^{5/2}\right)}$

`

\displaystyle{ \begin{aligned} &f_{L, NS+}(x) \\ \end{aligned}}

$\displaystyle{ \approx \frac{1}{x}+\frac{32}{\sqrt{x}}+504+5248 \, \sqrt{x}+40996 \, x+258624 \, x^{\frac{3}{2}}+1384320 \, x^{2}+6512384 \, x^{\frac{5}{2}} + ...}$

— Me@2022-11-23 04:40:28 PM

.

.

# Why does the universe exist? 7.1

Why is there something instead of nothing?

Why is there the universe?

.

The existence of the universe is not a property of the universe itself.

Instead, it is a property of the system that the universe is in.

.

However, there is no bigger system that contains the universe, because by the definition of the word “universe”, the universe contains everything.

So the question “why is there the universe” should be transformed to “why is there something instead of nothing?”

.

For example, the watch exists because the watchmaker has made it.

Similarly, if someone has created the universe, we can say that that someone is the cause of the existence of the universe.

However, there is no “someone” outside the universe, because of the definition of the word “universe”.

The universe has no outside.

— Me@2012-10-15 08:33:01 AM

— Me@2022-11-21 09:41:23 PM

.

.