Skip to content

Commit cebfd56

Browse files
author
Oskar Lundström
committed
Fixade socker-todo i Quantity
1 parent af8cb31 commit cebfd56

34 files changed

+3124
-63
lines changed

Book/build/Calculus/Differential calculus.html

Lines changed: 300 additions & 0 deletions
Large diffs are not rendered by default.

Book/build/Calculus/Function expressions.html

Lines changed: 161 additions & 0 deletions
Large diffs are not rendered by default.

Book/build/Calculus/Integral calculus.html

Lines changed: 243 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Learn You a Physics for Great Good!</title>
6+
<link rel="stylesheet" type="text/css" href="../style.css">
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-AMS_CHTML-full" type="text/javascript"></script>
8+
</head>
9+
10+
<body>
11+
<header>
12+
<a href="../index.html"><h1>Learn You a <span class="physics">Physics</span> for Great Good!</h1></a>
13+
<h1>&gt;&gt;&gt; WORK IN PROGRESS &lt;&lt;&lt;</h1>
14+
<h2>Calculus / Introduction</h2>
15+
<nav>
16+
<span>[src: <a href="https://github.com/DSLsofMath/BScProj2018/blob/master/Physics/src/Calculus/Intro.lhs">Calculus/Intro.lhs</a>]</span>
17+
<span>Previous: <a href="../Introduction/Introduction'.html">Introduction'</a></span>
18+
<a href="../index.html">Table of contents</a>
19+
<span>Next: <a href="../Calculus/Function expressions.html">Function expressions</a></span>
20+
</nav>
21+
</header>
22+
23+
<main>
24+
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="kw">module</span> <span class="dt">Calculus.Intro</span> <span class="kw">where</span></code></pre></div>
25+
<h1 id="what-is-calculus">What is calculus?</h1>
26+
<p>Plain equations where all values are of the same dimension are all fine and well. The importance of being able to solve basic problems like &quot;If Jenny has 22 meters, and Richard has 18 meters: how many meters do they have together?&quot; cannot be understated, but they're not especially fun!</p>
27+
<p>&quot;An unstoppable car has an unchanging velocity of 141.622272 km/h. How many kilometers has it droven after a day?&quot;. To solve more interesting problems like this, we need calculus.</p>
28+
<p>Calculus is the study of stuff that continuously change over time (or some other continuous variable). For example, a distance that changes over time is equivalent to a speed or a velocity, depending on how many dimensions you have. You can have rates of changes with respect to other units, like length, as well, but those are not as common.</p>
29+
<p>There are two major branches of calculus, differential calculus and integral calculus. Differential calculus is all about those rates of changes and graph slopes. Differences, differentials, derivatives, and the like. Integral calculus, on the other hand, is all about accumulation and areas. Sums, integrals, and such.</p>
30+
<p>In this chapter we'll expore the syntax of diffences, the problem with differentials, symbolic differentiation, numeric and symbolic integration, and some applied problem solving.</p>
31+
32+
</main>
33+
34+
<footer>
35+
<nav>
36+
<span>[src: <a href="https://github.com/DSLsofMath/BScProj2018/blob/master/Physics/src/Calculus/Intro.lhs">Calculus/Intro.lhs</a>]</span>
37+
<span>Previous: <a href="../Introduction/Introduction'.html">Introduction'</a></span>
38+
<a href="../index.html">Table of contents</a>
39+
<span>Next: <a href="../Calculus/Function expressions.html">Function expressions</a></span>
40+
</nav>
41+
© Kandidatboisen (2018), GPL
42+
</footer>
43+
</body>
44+
</html>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Learn You a Physics for Great Good!</title>
6+
<link rel="stylesheet" type="text/css" href="../style.css">
7+
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-AMS_CHTML-full" type="text/javascript"></script>
8+
</head>
9+
10+
<body>
11+
<header>
12+
<a href="../index.html"><h1>Learn You a <span class="physics">Physics</span> for Great Good!</h1></a>
13+
<h1>&gt;&gt;&gt; WORK IN PROGRESS &lt;&lt;&lt;</h1>
14+
<h2>Calculus / Visualization</h2>
15+
<nav>
16+
<span>[src: <a href="https://github.com/DSLsofMath/BScProj2018/blob/master/Physics/src/Calculus/VisVerApp.lhs">Calculus/VisVerApp.lhs</a>]</span>
17+
<span>Previous: <a href="../Calculus/Integral calculus.html">Integral calculus</a></span>
18+
<a href="../index.html">Table of contents</a>
19+
<span>Next: <a href="../Vectors/Vector.html">Vector</a></span>
20+
</nav>
21+
</header>
22+
23+
<main>
24+
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="kw">module</span> <span class="dt">Calculus.VisVerApp</span> <span class="kw">where</span>
25+
26+
<span class="kw">import </span><span class="dt">Calculus</span>
27+
28+
<span class="kw">import </span><span class="dt">Hatlab.Plot</span></code></pre></div>
29+
<h2 id="plotting-with-hatlab">Plotting with Hatlab</h2>
30+
<p>The brain likes seeing things. Let's give it a good looking reward!</p>
31+
<p>We'll now make combined use of all of our nice functions. <code>simplify</code>, <code>derive</code>, <code>integrate</code>, <code>eval</code>, and <code>show</code>, all together: the most ambitious crossover event in history!</p>
32+
<p>First, we create some function expressions ready to be <code>show</code>n and <code>eval</code>uated.</p>
33+
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell">f <span class="fu">=</span> <span class="dt">Const</span> <span class="dv">3</span> <span class="fu">:*</span> <span class="dt">Id</span><span class="fu">:^</span><span class="dt">Const</span> <span class="dv">2</span>
34+
f&#39; <span class="fu">=</span> simplify (derive f)
35+
_F <span class="fu">=</span> simplify (integrate f <span class="dv">0</span>)</code></pre></div>
36+
<p>Then, we define a helper function to plot a list of function expressions with Hatlab.</p>
37+
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><span class="ot">plotFunExprs ::</span> [<span class="dt">FunExpr</span>] <span class="ot">-&gt;</span> <span class="dt">IO</span> ()
38+
plotFunExprs <span class="fu">=</span> plot <span class="fu">.</span> fmap (\f <span class="ot">-&gt;</span> <span class="dt">Fun</span> (eval f) (show f))</code></pre></div>
39+
<p>Now try it for yourself! Let's see the fruits of our labour!</p>
40+
<div class="sourceCode"><pre class="sourceCode haskell"><code class="sourceCode haskell">ghci<span class="fu">&gt;</span> plotFunExprs [f, f&#39;, _F]</code></pre></div>
41+
<p>For fun, we can also plot the same functions but using our approximative functions for differentiation and integration</p>
42+
<div class="sourceCode"><pre class="sourceCode literate haskell"><code class="sourceCode haskell">g x <span class="fu">=</span> <span class="dv">3</span> <span class="fu">*</span> x<span class="fu">^</span><span class="dv">2</span>
43+
g&#39; x <span class="fu">=</span> deriveApprox g <span class="fl">0.001</span> x
44+
_G x <span class="fu">=</span> integrateApprox g <span class="fl">0.001</span> <span class="dv">0</span> x</code></pre></div>
45+
<p>Then plot with</p>
46+
<div class="sourceCode"><pre class="sourceCode haskell"><code class="sourceCode haskell">ghci<span class="fu">&gt;</span> plot [<span class="dt">Fun</span> g <span class="st">&quot;3x^2&quot;</span>, <span class="dt">Fun</span> g&#39; <span class="st">&quot;D(3x^2)&quot;</span>, <span class="dt">Fun</span> _G <span class="st">&quot;I(3x^2)&quot;</span>]</code></pre></div>
47+
<p>Waddaya know! They look identical! I guess it just goes to show that a good approximation is often good enough.</p>
48+
49+
</main>
50+
51+
<footer>
52+
<nav>
53+
<span>[src: <a href="https://github.com/DSLsofMath/BScProj2018/blob/master/Physics/src/Calculus/VisVerApp.lhs">Calculus/VisVerApp.lhs</a>]</span>
54+
<span>Previous: <a href="../Calculus/Integral calculus.html">Integral calculus</a></span>
55+
<a href="../index.html">Table of contents</a>
56+
<span>Next: <a href="../Vectors/Vector.html">Vector</a></span>
57+
</nav>
58+
© Kandidatboisen (2018), GPL
59+
</footer>
60+
</body>
61+
</html>

Book/build/Calculus/delta.png

330 KB
Loading

Book/build/Calculus/expressive.png

439 KB
Loading

Book/build/Calculus/integral.png

120 KB
Loading

Book/build/Calculus/shrinking.png

405 KB
Loading
7.42 KB
Loading

0 commit comments

Comments
 (0)