Skip to content

FrnkBaum/DSLsofMath

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

806 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Domain-Specific Languages of Mathematics

Homepage for the 2018 instance of a 7.5hec BSc course at Chalmers and GU.

Homepage: https://github.com/DSLsofMath/DSLsofMath/

Course codes: DAT326 / DIT982

News

Course team

  • Examiner & main lecturer: Patrik Jansson (patrikj AT)
  • Guest lecturer: Cezar Ionescu (cezar AT)
  • Teaching assistant: Daniel Schoepe (schoepe AT)
  • (Project assistants: Daniel Heurlin, Sólrún Einarsdóttir)

Objectives

The course presents classical mathematical topics from a computing science perspective: giving specifications of the concepts introduced, paying attention to syntax and types, and ultimately constructing DSLs of some mathematical areas mentioned below.

Learning outcomes as in the course syllabus.

  • Knowledge and understanding
    • design and implement a DSL (Domain Specific Language) for a new domain
    • organize areas of mathematics in DSL terms
    • explain main concepts of elementary real and complex analysis, algebra, and linear algebra
  • Skills and abilities
    • develop adequate notation for mathematical concepts
    • perform calculational proofs
    • use power series for solving differential equations
    • use Laplace transforms for solving differential equations
  • Judgement and approach
    • discuss and compare different software implementations of mathematical concepts

The course is elective for both computer science and mathematics students at both Chalmers and GU.

Course material

Lecture notes + references therein cover the course but there is no printed course textbook.

The main references are listed below.

Course setup

  • Lectures (Tue. 13-15 and Thu 13-15 in EB. [TimeEdit])
    • Introduction: Haskell, complex numbers, syntax, semantics, evaluation, approximation
    • Basic concepts of analysis: sequences, limits, convergence, ...
    • Types and mathematics: logic, quantifiers, proofs and programs, Curry-Howard, ...
      • Type classes, derivatives, differentiation, calculational proofs
    • Domain Specific Languages and algebraic structures, algebras, homomorphisms
    • Polynomials, series, power series
    • Power series and differential equations, exp, sin, log, Taylor series, ...
    • Linear algebra: vectors, matrices, functions, bases, dynamical systems as matrices and graphs
    • Laplace transform: exp, powers series cont., solving PDEs with Laplace
  • Weekly exercise sessions (Tue 15-17 and Thu 15-17 in ES52)
    • Half time helping students solve problems in small groups
    • Half time joint problem solving at the whiteboard
  • Schedule exceptions:
    • 2018-01-19 Thu exercises moved to Fri (same time) in ES52.
    • 2018-01-26 Thu exercises moved to Fri (same time) in ES52.
    • 2018-02-09 Thu exercises moved to Fri (same time) in ES52.
    • 2018-02-16 Thu lecture + ex. moved to Fri (same time) in EA + ES52.
    • 2018-03-05 Thu lecture + ex. moved earlier to Mon at 10 and 15.15.

Changes from last year

The main changes for 2018 (based on the course eval meeting) are

  • New course literature (lecture notes covering the full course)
  • More material on functional programming in Haskell
  • Developed more exercises to solve (primarily easier exercises to start each week with)
  • More solving of exercises at the whiteboard
  • Schedule changes (alternating L, E, L, E instead of L, L, E, E)
  • Weekly hand-ins to encourage students to spend more hours on the course (not part of the formal examination)

One of the student evaluators from 2017 (DaHe) was hired part time to help out with these improvements.

Examination

There are two compulsory course elements:

  • A = Assignments (written + oral examination in groups of three students)
    • two compulsory hand-in assignments (2018-01-30, 2018-02-27)
    • Grading: Pass or fail
    • The assignments are to be handed in via Fire
  • E Exam (individual written exam at the end of the course)
    • Grading: Chalmers: U, 3, 4, 5; GU: U, G, VG
    • Date: 2018-03-13 at 14.00
    • Aids: One textbook of your choice

To pass the course you need to pass both course elements.

Lectures

The latest PDF snapshot of the full lecture notes can be found in L/snapshots.

The "source code" for the lecture notes are in subdirectories of L/: L/01/, L/02/, etc.

Exercises

Chapter 1-8 of the Lecture Notes end with weekly exercises for weeks 1-8.

In L/RecEx.md you will find a list of recommended exercises for each chapter of the lecture notes.

Using the DSLsofMath

In order to do some of the exercises, you may need/want to have access to the DSLs introduced during the lectures and in the lecture notes.

To do this, first make sure you have installed stack. Next, download this tarball and extract it in a desired location (on Linux and Mac, you can do this by running tar -zxf DSLsofMath-x.x.x.x.tar.gz in the terminal. In Windows, you might have to use a tool like 7-Zip).

Now go into the extracted folder DSLsofMath-x.x.x.x/ and run stack init. You can now interact with the code from the lectures by typing stack ghci, which puts you in ghci with all DSLs loaded. You can also place your own haskell files inside this folder and import the DSLs you want by typing the following at the start of your file:

import DSLsofMath.W0X

where X is the chapter that contains the code you want to use. You should be able to load your own haskell files in normal ghci.

Evaluation

DSLsofMath course evaluation student representatives 2018:

Email (@student) Name
markusi Markus Ingvarsson
marcuols Marcus Lindvärn
jlucas Lucas Norman Jonsson
annunt Anna-Maria Unterberger
vonejo Jonas von Essen

References

Some important references:

Functional programming

  • Thinking Functionally with Haskell, Richard Bird, Cambridge University Press, 2014 URL
  • Introduction to Functional Programming Using Haskell, Richard Bird, Prentice-Hall, 1998. A previous (but very different) version of the above.
  • An Introduction to Functional Programming, Richard Bird and Phil Wadler, Prentice-Hall, 1988. A previous (but very different) version of both of the above.

DSLs

  • Functional Programming for Domain-Specific Languages, Jeremy Gibbons. In Central European Functional Programming School 2015, LNCS 8606, 2015. URL

    This is currently the standard reference to DSLs for the functional programmer.

  • Folding Domain-Specific Languages: Deep and Shallow Embeddings, Jeremy Gibbons and Nicolas Wu, ICFP 2014. URL

    Available at the same link: a highly recommended short version and the two videos of Jeremy presenting the most important ideas of DSLs in a very accessible way.

  • Programming Languages, Mike Spivey. Lecture notes of a course given at the CS Department in Oxford. Useful material for understanding the design and implementation of embedded DSLs. URL

  • Domain Specific Languages, Martin Fowler, 2011. URL

    The view from the object-oriented programming perspective.

The computer science perspective

  • Communicating Mathematics: Useful Ideas from Computer Science, Charles Wells, American Mathematical Monthly, May 1995. URL

    This article was one of the main triggers of this course.

    Short summary of the recommendations

Mathematics

  • The Language of First-Order Logic, 3rd Edition, Jon Barwise and John Etchemendy, 1993. Out of print, but you can get it for one penny from Amazon UK. A vast improvement over its successors (as Tony Hoare said about Algol 60).

  • Mathematics: Form and Function, Saunders Mac Lane, Springer 1986. An overview of the relationships between the many mathematical domains. Entertaining, challenging, rewarding. Fulltext from the library

  • Functional Differential Geometry, Gerald Jay Sussman and Jack Wisdom, 2013, MIT. A book about using programming as a means of understanding differential geometry. Similar in spirit to the course, but more advanced and very different in form. An earlier version appeared as an AIM report.

About

Domain Specific Languages of Mathematics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Haskell 79.3%
  • TeX 16.3%
  • HTML 2.5%
  • Isabelle 1.2%
  • Makefile 0.4%
  • Agda 0.3%