Yesterday 3.14 was the Happy Pi-day, how to derive Pi in a sum series?

Penne used 2 sum techniques: Cauchy Product of 2 sums, then change variable.

Yesterday 3.14 was the Happy Pi-day, how to derive Pi in a sum series?

Penne used 2 sum techniques: Cauchy Product of 2 sums, then change variable.

华罗庚只用10 lines 证明Cartan (陈省身的法国师傅)18 page的theorem， 厉害👆华有intuition 直觉的能力，尤其是Matrix （ Divisional Ring 除环）: 华罗庚教的学生都会“打洞”(zero). https://v.ixigua.com/SxP3pqY/

Study Abstract Algebra, must see thru “General” with Concrete examples to grasp key concepts :

Ring ( Matrix)

Similar matrix

Commutative

Central (of Ring)

…

Matrix or Integer or Polynomial are all Rings.

Why called it a Ring? It is like CLOCK integer number (0,1, 2,…11,12) or “Z mod 12”, German calls it like “Ring”- shaped Clock. 中文叫环， 法文Anneau , 德文= 英 都叫 Ring.

Origami has equations by a Jap mathematician.

Langlands Programme:

Bridge between 2 Math Camps :

Algebra – Analysis

Implication: If a problem can’t solve by Algebra，then use Analysis :

Fermat’s Last Theorem 358 years unsolved by Algebra, Andrew Wiles proved by contradiction with Elliptic Curve / Modular Form.

Key Players:

- Canadian Langlands
- André Weil
- 吴宝珠 Ngoh BaoChao (Vietnamese French, École Normale Supérieure）

Building AI apps with Haskell on Android devices that have a UI is possible, but requires a few steps and tools. Here’s a general idea of what you can do:

- Write the AI logic in Haskell: This can be done using functional programming concepts and libraries like Haskell’s
`lens`

or`cabal`

. - Compile the Haskell code to run on Android: This can be done using tools like
**Haskell for Android (HFa) or Mobile Haskell**, which allow you to compile Haskell code into an APK that can run on Android devices. - Create the UI for the app: This can be done using Android UI tools like Android XML or using a cross-platform UI toolkit like Flutter.
- Integrate the AI logic into the app’s UI: This can be done by calling the AI functions from within the UI code and passing data back and forth between the two.

Keep in mind that building AI apps can be complex and time-consuming, and that optimizing the app for mobile devices can also be challenging. Additionally, finding Haskell developers with expertise in both AI and mobile app development may be difficult.

https://uhideyuki.sakura.ne.jp/studs/index.cgi/en/BunnyHaskellCompiler009

A monad in category theory is a way to describe a concept of computation within a mathematical framework. To apply a monad in the context of category theory, one typically needs to:

- Define the category in which the monad is to be applied.
- Define the endofunctor that generates the monad. An endofunctor is a functor from a category to itself.
- Define the two natural transformations that form the monad structure: “unit” and “bind.” The “unit” natural transformation maps objects in the category to the monad, while the “bind” natural transformation maps morphisms in the category to morphisms in the monad.
- Show that the endofunctor and natural transformations satisfy the monad laws, which ensure that the monad structure is well-behaved.

Once the monad is defined, it can be used to model a variety of computational concepts, such as data structures, computations, and effects. Monads are commonly used in functional programming and are a fundamental concept in the study of category theory and its applications to computer science.

ChatGPT Jan 30 Version. Free Research Preview

Open sidebar

How to apply Monad in Haskell

A Monad in Haskell is a type class with a specific set of functions that allow you to build and chain computations in a predictable and composable manner. Here are the key steps to apply a Monad in Haskell:

- Define a type: To use a Monad, you need to define a custom type to hold your computations. This type must be an instance of the Monad type class.
- Implement the
`return`

function:`return`

takes a value and returns a Monad that wraps this value. This function is used to inject values into your computation. - Implement the
`(>>=)`

function:`(>>=)`

, also known as the “bind” operator, is used to chain computations together. It takes a Monad and a function that transforms the value inside the Monad and returns a new Monad. - Use Monadic functions: Once you have defined your Monad type, you can use Monadic functions, such as
`mapM`

and`filterM`

, to perform operations on your computations.

Here’s a simple example of how to create a Monad in Haskell:

kotlinCopy code`data MyMonad a = MyMonad a`

`instance Monad MyMonad where`

`return x = MyMonad x`

`(MyMonad x) >>= f = f x`

In this example, `MyMonad`

is a custom type that holds a value of type `a`

, and `return`

and `(>>=)`

are implemented to wrap and chain the computations, respectively.

To write an application with a Haskell back-end and an Android front-end, you’ll need to use a method of interoperation between the two languages, such as a Foreign Function Interface (FFI) or a third-party library.

One approach could be to write the business logic in Haskell and then expose it as a REST API. The Android front-end can then make API calls to the Haskell back-end to access the logic.

Here’s a high-level overview of the steps you can follow:

- Write the business logic in Haskell: Use Haskell to implement the core logic of your application. You can use any appropriate libraries and frameworks to assist with this.
- Expose the logic as a REST API: Use a library such as Servant or Scotty to expose the logic as a REST API. This will allow other systems, including your Android front-end, to interact with the logic through HTTP requests.
- Build the Android front-end: Use Android’s native development tools, such as Android Studio and the Android SDK, to build the user interface for your application. You can use Retrofit or another library to make API calls to the Haskell back-end from your Android code.
- Deploy the Haskell back-end: You can deploy the Haskell back-end on a server or cloud platform and configure it to serve the REST API.
- Test and iterate: Once you have the basic architecture in place, you can test the application and iterate on it until it meets your requirements.

Note that this is just one approach to building an application with a Haskell back-end and an Android front-end. There may be other approaches that are better suited to your specific use case.

ChatGPT Jan 30 Version. Free Research Preview. Our goal is

Which is the best Functional Programming language : Haskell, Scala, Rust, C++, Python, Typescript?

It’s subjective to say which is the best functional programming language as it depends on various factors such as personal preference, specific use case, and project requirements. However, here’s a brief overview of some popular functional programming languages:

- Haskell: A pure functional language that is known for its strong type system and theoretical foundations. It’s popular among researchers and academics.
- Scala: A hybrid functional/object-oriented language that runs on the JVM and can be used for a wide range of applications.
- Rust: A systems programming language that combines functional and imperative programming paradigms, and emphasizes safety and concurrency.
- C++: A multi-paradigm language that supports functional programming, but is primarily used for systems programming and performance-critical applications.
- Python: A multi-paradigm language that has functional programming features, but is primarily used for scripting and general-purpose programming.
- TypeScript: A statically typed language that builds on JavaScript and adds features for large-scale applications, including functional programming constructs.

In conclusion, the best functional programming language for you will depend on your specific use case and preferences.

**Can Haskell run on JVM or Android**

Yes, Haskell can run on the Java Virtual Machine (JVM) through the use of a Haskell to Java bytecode compiler, such as JHC or Jakarta Haskell Compiler. However, it’s not a native runtime for the JVM and may not perform as well as a language that was designed to run on the JVM, such as Scala.

As for running Haskell on Android, there are some experimental projects that aim to bring Haskell to Android, but it’s not a widely supported platform for Haskell at this time.

**How is Haskell UI** ?

Haskell is primarily a back-end language and is not widely used for building user interfaces. However, it’s possible to create graphical user interfaces (GUIs) in Haskell using libraries such as GTK, Qt, and wxWidgets.

These libraries provide a way to create windows, buttons, and other GUI elements using Haskell code. However, building a GUI in Haskell can be more challenging compared to using a GUI framework in a language that is specifically designed for UI development, such as Java or C#.

In summary, while it’s possible to build UIs in Haskell, it may not be the most convenient or efficient option for most UI development tasks.

**Can Haskell interoperate with C++ or Java**

Yes, Haskell can interoperate with both C++ and Java. There are several ways to achieve this, including:

- FFI (Foreign Function Interface): Haskell provides a standard FFI, which allows Haskell functions to be called from other languages and vice versa. This enables interoperation with C++ and Java by writing wrapper functions in these languages that call Haskell code.
- Third-party libraries: There are also libraries available, such as HsFFI and hs-java, that provide more convenient ways to interact with C++ and Java code from Haskell.

In conclusion, while Haskell is a purely functional language and has a different programming paradigm compared to C++ and Java, it is possible to interface with these languages and leverage their libraries and tools in Haskell projects

Applied in Gamma function (eg . ½ !)

Yoneda is a Japanese mathematician, who met the Category Theory (CT) inventor Harvard Prof MacLane in Paris, both waiting for the train at ‘Gare du Nord’ station. Yoneda mentioned his discovery to Prof that all Categories in fact can be ‘faithfully’ viewed as “Set”, like my example of 家族 Category C consists of 吴氏家族x with object a (= 我), b(=兄/弟)， is exactly (faithfully) depicted in 吴氏家谱 of the “Set of F” between (x->a ) to (x->b).

F is a Functor (like function) called ‘Natural Transformation’.

MacLane called this Lemma Yoneda, the only Theorem / Lemma in CT.

Use Chat-GPT to build a GPT.

Fermat and Descartes both invented the Analytical Geometry (解析几何) by different approaches – Fermat’s method (using a rough notion of “Limit”) is better, also laid the foundation of “Calculus” for Newton who admitted he stood on the shoulder of a giant (Fermat).

Lycée Pierre de Fermat (Classe Préparatoire) was my “alma mater” (1977-1979) where Fermat worked as a Toulouse (AirBus City) Chief Judge in 17CE.

Probability:

17CE : inventors Pascal & Fermat,

thru 19CE mostly by French mathematicians using (Finite) Set Theory.

Forgotten : Renaissance era the Italian Cardano (reveal to the world the “i” complex number secret in solving cubic equation) who gave the operations “+” or “x” for probability of 2 dependent or independent events, respectively.

After 20 CE ,

“Modern Probability” by Russian.

Gaussian Integral (I) by Laplace trick :

- I² : change to double integral,
- Fubini’s condition : if ‘convergence”, then dx.dy = dy.dx

1977-1979 evenings at 6 pm – 7 pm, I walked on these big staircases of Lycée Fermat with nervous mind, on the way to “Colles” (Weekly Oral Interrogations) for Maths / Physics / Chemistry or Foreign Language.

Superman 白天是 office worker , 晚上 化身变 大侠。其实 白天/夜晚两人是同一人： 这就是 Category Theory 的 (日本数学家 “Yoneda Lemma“）: Isomorphism (“Equality” in Category sense)

https://www.sitepoint.com/make-javascript-functional/

To summarize, here are the five rules that will help you achieve functional code:

- Keep your functions
*pure*. - Always declare variables and functions using
*const*. - Use
*arrow*notation for functions. - Avoid using
`for`

*loops*. - Use type declaration comments and avoid type coercion shortcuts.

FP: Object fixed, behavior (Functor) varies

OO: Object varies, behavior (polymorphism) fixed.

Complex-value Matrix aka Hermitian Matrix, Fourier Transform towards FFT.

Charles Hermite ：(小15 年)师弟 of Galois from same Lycée Louis Le Grand with same high school Math teacher Mr. Richard.

key concepts: Orthogonal, orthonormal, conjugate, inverse

为什么几何Geometry 很难？

如何从群论(Group)的角度看几何学 – Félix Klein “Erlangen Programme” ？

为什么流形 (manifold)很重要？

这个中学数学老师： 不用记所有公式, “找他爸”技巧 aka

“Derive From 1st Principle”.

化学也是如此， 不用记化学公式 (Chemical Equation), “找它爸”： Electrons balance.

(French) “les Suites = Séries,

“les Séries” = “Sum of series”.

Séquence (eg Fibonacci) is the same (English) Sequence.

[1] 简易版：

[2] 详细版：

Group Theory included in A-level Junior College / High School ? Yes , only for H3 & Further Math(?), not for majority H2 Science students. In French Baccalaureate , Group Theory is taught for Science students.

This math teacher found those who had learnt Group Theory (or even Set Theory) do well in University Modern Math.

六个阶段：代表人物

1. **启蒙 第一代**： 1900 – 1949 （留美博士： 姜立夫 / 江泽涵 (翻译 同调Homology/同伦 Homotopy) / 杨武之（杨振宁的父亲，陈省身的老师）， 留法博士：熊庆来 (华罗庚的恩师), 留日： 陈健功 / 苏步青 ）

1a: 外国教授来华教书： Bertrand Russell (UK, Logic), Hadamard (France),维纳(USA, MIT), etc.

1b. 数学系建立： 北京大学， 南开， 浙江/复旦，东南大学（现 南京大学）。

2. **第二代**： 1949 – 1978 （中间10年断层： 文化大革命）- 留法博士：陈省身 (“Gauss II”)，留英：华罗庚 (3 years under Cambridge Prof Hardy)

2a: **1950s 中学数学教育改革**， 大量翻译外国中学教材： 范氏大代数 (College Algebra), 葛氏三角(Grandville Trigonometry), 欧式几何。

3. **第三代**： 1978 邓小平恢复大学科研教育 – 本土：陈景润 （厦门大学本科毕业，华罗庚 的 研究生），留法博士： 吴文俊

3a. 1985 中国参加IMO Olympiad 比赛。1989-1990 首 2 次 中国得 IMO 团体冠军。

4. **第四代**： 留美博士：丘城桐（陈省身的学生）， 张益唐（北大 硕士 / Purdue PhD)

5. **第五代**： 留美博士： 田刚（丘城桐的哈佛学生）

6. **第六代**［ **本土**］： 北大：韦东奕， 清华：“求真学院”（丘城桐回国建立 80数学 天才 培训班：本科+硕/博 = 8 年）

【数学家却经常数学考试不及格】

Charles Hermite是 Galois 的同校&同师傅的Lycée Louis Le Grand学弟（小15届），数学老师Richard留着Galois 的旧作业交给Hermite 学习。

他发明 共轭矩阵 Conjugate Matrix， 第一人1873 证明 e is Transcendental, 他的德国学生Lindemann 1882 用他的方法证明 (pi) π transcendental. Lindermann 回德国，培养德国Gottingen派的学生Félix Klein, Gauss, Riemann, Hilbert, Noether…取代巴黎派，德国成为“世界数学中心”（till WW2中心 移到美国哈佛）

Hermite 跛脚， 被 军校 Ecole Polytechnique “X” 踢出大学一年级。（他是最后一名考进“X“, after 5 attempts）!

后来他出名了， X 请他 当Concours （ 科举）数学主考官。大讽刺！ 他出的X 数学 特别难，现在依旧。考生要进 特别的Top Préparatoires （M’ 班 ）老师训练题目，déjà -vu past year 考题 才会解。（同IMO Olympiad 数学难题的道理， Galois就是自以为“天下第一天才”，没练习旧考题，不及格 2次）

韦神 解 Quintic Polynomial Équation (by Galois Group Theory, no radical root formula), must use trick (change variable).

How did he come out with x= a – 2/a ?👍

a^5 = 8 => a = 1.5157

x = a- 2/a = 0.1962

a^5 = – 4 => a = -1.31950791

x = a-2/a = 0.1962

Inequality ” ≤ “is an EQUIVALENCE RELATION “∼” (3 properties : Reflexive 自反, Symmetric 对称性 , Transitive 传递性 ) ， more interesting than “<“.

” ≤ “： 一正二定三相等

凡是 structures（aka Set， Category，Group, Ring, …）除了 内部结构 (elements), 结构间的 “关系” (relation, aka arrow or Morphism) interesting to use /apply if it is a “∼” :

eg. 1. Congruence/Similarity (Geometry).

- Function 函数 / Mapping 映射 (between Sets)
- Functor 函子 (between Categories)
- Natural Transformation 自然变换 ( between Functors)
- Morphism (Homo-, Endo-, Iso-, -Auto between Groups, Rings, Vector Space…)
- Homeomorphism 同胚 (between Topologies eg. Mug and Donut )

…

Integration by Parts: American “DI Method” is better. GCE-A Method is recursive, more steps.

“General Manager smaller than Assistant Manager”

Put 27 cubes (Length =a, Width=b, Height =c), inside a big Cube of side (a+b+c), can’t fill the big Cube completely.

Generalized:

GM ≦AM

GM = Geometric Mean

AM = Arithmetic Mean

Solution: use ‘Promote’ technique to general case:

Let n=2005

[QED]

Answer= 222

Since 1850, Pure Math leading with Abstract Algebra “Group Theory”, etc …however, after 2000, Applied Math catching up with Pure Math in IT (Category Theory, Fuzzy Logic, AI, Algebraic Toplology…).

17 yo MIT Prodigy Larson proved CarMichael Number (c), using 张益唐 Twin Primes Gap and Bertrand’s Postulate (n < c < 2n).

Free eBook of CT for Programmers by (Nuclear Physicist turned Software Expert in CT with Haskell/C++) Milewski, who also gave lectures of each chapter in YouTube .

https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/

Vidéos of the same eBook.

https://youtube.com/playlist?list=PLbgaMIhjbmEnaH_LTkxLI7FMa2HsnawM_

The basic intro to CT.

**Free** Group, **Free** Vector Space are the “Category Theory” version of Group and Vector Space by “U” Functor – the “Forgetful” functor !

数学的4个层次maturity level:

Level 1: PSLE

Level 2: Secondary School (O and A-Level)

Level 3: University (Undergrad to grad)

Level 4: Mathematical Thinkers (Grand Masters: Leibniz, Galois, Gauss, Descartes, Pascal, Fermat, Poincaré)

数学优化 Optimization by Trust Region Method = 孙悟空 划圈子防妖怪

Function 函数 is a “special” case of Mapping 映射 (L’application) with ONLY 1 Image, whereas Mapping can have 0, or 1 or >2 images.

The British GCE “abuse” the term “Function” for all cases.