text:
## Systems as Wiring Diagram Algebras

28 January, 2019

Check out the video of Christina Vasilakopoulou’s talk, the third in the Applied Category Theory Seminar here at U. C. Riverside! It was nicely edited by Paola Fernandez and uploaded by Joe Moeller.

Abstract. We will start by describing the monoidal category of labeled boxes and wiring diagrams and its induced operad. Various kinds of systems such as discrete and continuous dynamical systems have been expressed as algebras for that operad, namely lax monoidal functors into the category of categories. A major advantage of this approach is that systems can be composed to form a system of the same kind, completely determined by the specific way the composite systems are interconnected (‘wired’ together). We will then introduce a generalized system, called a machine, again as a wiring diagram algebra. On the one hand, this abstract concept is all-inclusive in the sense that discrete and continuous dynamical systems are sub-algebras; on the other hand, we can specify succinct categorical conditions for totality and/or determinism of systems that also adhere to the algebraic description.

• Patrick Schultz, David I. Spivak and Christina Vasilakopoulou, Dynamical systems and sheaves.

• Dmitry Vagner, David I. Spivak and Eugene Lerman, Algebras of open dynamical systems on the operad of wiring diagrams.

## The Mathematics of the 21st Century

13 January, 2019

Check out the video of my talk, the first in the Applied Category Theory Seminar here at U. C. Riverside. It was nicely edited by Paola Fernandez and uploaded by Joe Moeller.

Abstract. The global warming crisis is part of a bigger transformation in which humanity realizes that the Earth is a finite system and that our population, energy usage, and the like cannot continue to grow exponentially. If civilization survives this transformation, it will affect mathematics—and be affected by it—just as dramatically as the agricultural revolution or industrial revolution. We should get ready!

The slides are rather hard to see in the video, but you can read them here while you watch the talk. Click on links in green for more information!

## Applied Category Theory Seminar

14 December, 2018

We’re going to have a seminar on applied category theory here at U. C. Riverside! My students have been thinking hard about category theory for a few years, but they’ve decided it’s time to get deeper into applications. Christian Williams, in particular, seems to have caught my zeal for trying to develop new math to help save the planet.

We’ll try to videotape the talks to make it easier for you to follow along. I’ll also start discussions here and/or on the Azimuth Forum. It’ll work best if you read the papers we’re talking about and then join these discussions. Ask questions, and answer any questions you can!

Here’s how the schedule of talks is shaping up so far. The talks are on Tuesdays 3:34–5:00 pm in Room 268 of Skye Hall, the mathematics building at U. C. Riverside.

January 8, 2019: John Baez
Mathematics in the 21st century

Abstract. The global warming crisis is part of a bigger transformation in which humanity realizes that the Earth is a finite system and that our population, energy usage, and the like cannot continue to grow exponentially. If civilization survives this transformation, it will affect mathematics – and be affected by it – just as dramatically as the agricultural revolution or industrial revolution. We should get ready!

Talk slides: Mathematics in the 21st century.

Also try these slides and videos from related talks:

January 15, 2019: Jonathan Lorand
Problems in symplectic linear algebra

Abstract. In this talk we will look at various examples of classification problems in symplectic linear algebra: conjugacy classes in the symplectic group and its Lie algebra, linear lagrangian relations up to conjugation, tuples of (co)isotropic subspaces. I will explain how many such problems can be encoded using the theory of symplectic poset representations, and will discuss some general results of this theory. Finally, I will recast this discussion from a broader category-theoretic perspective.

Talk slides: Problems in symplectic linear algebra.

• Jonathan Lorand, Classifying linear canonical relations.

• Jonathan Lorand and Alan Weinstein, Decomposition of (co)isotropic relations.

January 22, 2019: Christina Vasilakopoulou
Systems as wiring diagram algebras

Abstract. We will start by describing the monoidal category of labeled boxes and wiring diagrams and its induced operad. Various kinds of systems such as discrete and continuous dynamical systems have been expressed as algebras for that operad, namely lax monoidal functors into the category of categories. A major advantage of this approach is that systems can be composed to form a system of the same kind, completely determined by the specific way the composite systems are interconnected (‘wired’ together). We will then introduce a generalized system, called a machine, again as a wiring diagram algebra. On the one hand, this abstract concept is all-inclusive in the sense that discrete and continuous dynamical systems are sub-algebras; on the other hand, we can specify succinct categorical conditions for totality and/or determinism of systems that also adhere to the algebraic description.

Christina Vasilakopoulou’s talk was based on this paper:

• Patrick Schultz, David I. Spivak and Christina Vasilakopoulou, Dynamical systems and sheaves.

but she focused more on the algebraic description (and conditions for deterministic/total systems) rather than the sheaf theoretic aspect of the input types. This work builds on earlier papers such as these:

• Dmitry Vagner, David I. Spivak and Eugene Lerman, Algebras of open dynamical systems on the operad of wiring diagrams.

January 29, 2019: Daniel Cicala
Social contagion modeled on random networks

Abstract. A social contagion may manifest as a cultural trend, a spreading opinion or idea or belief. In this talk, we explore a simple model of social contagion on a random network. We also look at the effect that network connectivity, edge distribution, and heterogeneity has on the diffusion of a contagion.

• Mason A. Porter and James P. Gleeson, Dynamical systems on networks: a tutorial.

• Duncan J. Watts, A simple model of global cascades on random networks.

Backprop as functor: a compositional perspective on supervised learning

Abstract. Fong, Spivak and Tuyéras have found a categorical framework in which gradient descent algorithms can be constructed in a compositional way. To explain this, we first give a brief introduction to backprogation and gradient descent. We then describe their monoidal category Learn, where the morphisms are given by abstract learning algorithms. Finally, we show how gradient descent can be realized as a monoidal functor from Para, the category of Euclidean spaces with differentiable parameterized functions between them, to Learn.

• Brendan Fong, David I. Spivak and Rémy Tuyéras, Backprop as functor: a compositional perspective on supervised learning.

February 12, 2019: Christian Williams
The pi calculus: towards global computing

Abstract. Historically, code represents a sequence of instructions for a single machine. Each computer is its own world, and only interacts with others by sending and receiving data through external ports. As society becomes more interconnected, this paradigm becomes more inadequate – these virtually isolated nodes tend to form networks of great bottleneck and opacity. Communication is a fundamental and integral part of computing, and needs to be incorporated in the theory of computation.

To describe systems of interacting agents with dynamic interconnection, in 1980 Robin Milner invented the pi calculus: a formal language in which a term represents an open, evolving system of processes (or agents) which communicate over names (or channels). Because a computer is itself such a system, the pi calculus can be seen as a generalization of traditional computing languages; there is an embedding of lambda into pi – but there is an important change in focus: programming is less like controlling a machine and more like designing an ecosystem of autonomous organisms.

We review the basics of the pi calculus, and explore a variety of examples which demonstrate this new approach to programming. We will discuss some of the history of these ideas, called “process algebra”, and see exciting modern applications in blockchain and biology.

“… as we seriously address the problem of modelling mobile communicating systems we get a sense of completing a model which was previously incomplete; for we can now begin to describe what goes on outside a computer in the same terms as what goes on inside – i.e. in terms of interaction. Turning this observation inside-out, we may say that we inhabit a global computer, an informatic world which demands to be understood just as fundamentally as physicists understand the material world.” — Robin Milner

• Robin Milner, The polyadic pi calculus: a tutorial.

• Robin Milner, Communicating and Mobile Systems.

• Joachim Parrow, An introduction to the pi calculus.

February 19, 2019: Kenny Courser
Category theory for genetics

Abstract. Rémy Tuyéras has developed a categorical framework aimed at handling various commonly studied subjects from the theory of genetics. Some of these include alignment methods, CRISPR, homologous recombination, haplotypes, and genetic linkage. In this talk, I will introduce the foundations on which this framework is built and give a few examples related to DNA and RNA sequencing which are able to be described in this environment.

• Rémy Tuyéras, Category theory for genetics.

## ACT 2019 – First Announcement

2 October, 2018

animation by Marius Buliga

I’m helping organize ACT 2019, an applied category theory conference and school at Oxford, July 15-26, 2019.

If you’re a grad student or postdoc interested in this subject, you should apply for the ‘school’ before January 30th. Later people can submit papers for the conference:

Dear all,

As part of a new growing community in Applied Category Theory, now with a dedicated journal Compositionality, a traveling workshop series SYCO, a forthcoming Cambridge U. Press book series Reasoning with Categories, and several one-off events including at NIST, we launch an annual conference+school series named Applied Category Theory, the coming one being at Oxford, July 15-19 for the conference, and July 22-26 for the school. The dates are chosen such that CT 2019 (Edinburgh) and the ACT 2019 conference (Oxford) will be back-to-back, for those wishing to participate in both.

There already was a successful invitation-only pilot, ACT 2018, last year at the Lorentz Centre in Leiden, also in the format of school+workshop.

For the conference, for those who are familiar with the successful QPL conference series, we will follow a very similar format for the ACT conference. This means that we will accept both new papers which then will be published in a proceedings volume (most likely a Compositionality special Proceedings issue), as well as shorter abstracts of papers published elsewhere. There will be a thorough selection process, as typical in computer science conferences. The idea is that all the best work in applied category theory will be presented at the conference, and that acceptance is something that means something, just like in CS conferences. This is particularly important for young people as it will help them with their careers.

Expect a call for submissions soon, and start preparing your papers now!

The school in ACT 2018 was unique in that small groups of students worked closely with an experienced researcher (these were John Baez, Aleks Kissinger, Martha Lewis and Pawel Sobociński), and each group ended up producing a paper. We will continue with this format or a closely related one, with Jules Hedges and Daniel Cicala as organisers this year. As there were 80 applications last year for 16 slots, we may want to try to find a way to involve more students.

We are fortunate to have a number of private sector companies closely associated in some way or another, who will also participate, with Cambridge Quantum Computing Inc. and StateBox having already made major financial/logistic contributions.

On behalf of the ACT Steering Committee,

John Baez, Bob Coecke, David Spivak, Christina Vasilakopoulou

## What is Applied Category Theory?

18 September, 2018

Tai-Danae Bradley has a new free “booklet” on applied category theory. It was inspired by the workshop Applied Category Theory 2018, which she attended, and I think it makes a great complement to Fong and Spivak’s book Seven Sketches and my online course based on that book:

• Tai-Danae Bradley, What is Applied Category Theory?

Abstract. This is a collection of introductory, expository notes on applied category theory, inspired by the 2018 Applied Category Theory Workshop, and in these notes we take a leisurely stroll through two themes (functorial semantics and compositionality), two constructions (monoidal categories and decorated cospans) and two examples (chemical reaction networks and natural language processing) within the field.

Check it out!

## Complex Adaptive System Design (Part 8)

22 August, 2018

John Foley, Joe Moeller and I have made some nice progress on compositional tasking for the Complex Adaptive System Composition and Design Environment project.

‘Compositional tasking’ means assigning tasks to networks agents in such a way that you can connect or even overlay such tasked networks and get larger ones. This lets you build up complex plans from smaller pieces.

In my last post in this series, I sketched an approach using ‘commitment networks’. A commitment network is a graph where nodes represent agents and edges represent commitments, like “A should move toward B either for 3 hours or until they meet, whichever comes first”. By overlaying such graphs we can build up commitment networks that describe complex plans of action. The rules for overlaying incorporate ‘automatic deconflicting’. In other words: don’t need to worry about agents being given conflicting duties as you stack up plans… because you’ve decided ahead of time what they should do in these situations.

I still like that approach, but we’ve been asked to develop some ideas more closely connected to traditional methods of tasking, like PERT charts, so now we’ve done that.

‘PERT’ stands for ‘program evaluation and review technique’. PERT charts were developed by the US Navy in 1957, but now they’re used all over industry to help plan and schedule large projects.

Here’s simple example:

The nodes in this graph are different states, like “you have built the car but not yet put on the tires”. The edges are different tasks, like “put the tires on the car”. Each state is labelled with an arbitrary name: 10, 20, 30, 40 and 50. The tasks also have names: A, B, C, D, E, and F. More importantly, each task is labelled by the amount of time that task requires!

Your goal is to start at state 10 and move all the way to state 50. Since you’re bossing lots of people around, you can make them do tasks simultaneously. However, you can only reach a state after you have done all the tasks leading up to that state. For example, you can’t reach state 50 unless you have already done all of tasks C, E, and F. Some typical questions are:

• What’s the minimum amount of time it takes to get from state 10 to state 50?

• Which tasks could take longer, without changing the answer to the previous question? How much longer could each task take, without changing the answer? This amount of time is called the slack for that task.

There are known algorithms for solving such problems. These help big organizations plan complex projects. So, connecting compositional tasking to PERT charts seems like a good idea.

At first this seemed confusing because in our previous work the nodes represented agents, while in PERT charts the nodes represent states. Of course graphs can be used for many things, even in the same setup. But the trick was getting everything to fit together nicely.

Now I think we’re close.

John Foley has been working out some nice example problems where a collection of agents need to move along the edges of a graph from specified start locations to specified end locations, taking routes that minimize their total fuel usage. However, there are some constraints. Some edges can only be traversed by specified teams of agents: they can’t go alone. Also, no one agent is allowed to run out of fuel.

This is a nice problem because while it’s pretty simple and specific, it’s representative of a large class of problems where a collection of agents are trying to carry out tasks together. ‘Moving along the edge of a graph’ can stand for a task of any sort. The constraint that some edges can only be traversed by specified teams is then a way of saying that certain tasks can only be accomplished by teams.

Furthermore, there are nice software packages for optimization subject to constraints. For example, John likes one called Choco. So, we plan to use one of these as part of the project.

What makes this all compositional is that John has expressed this problem using our ‘network model’ formalism, which I began sketching in Part 6. This allows us to assemble tasks for larger collections of agents from tasks for smaller collections.

Here, however, an idea due to my student Joe Moeller turned out to be crucial.

In our first examples of network models, explained earlier in this series, we allowed a monoid of networks for any set of agents of different kinds. A monoid has a binary operation called ‘multiplication’, and the idea here was this could describe the operation of ‘overlaying’ networks: for example, laying one set of communication channels, or committments, on top of another.

However, Joe knew full well that a monoid is a category with one object, so he pushed for a generalization that allowed not just a monoid but a category of networks for any set of agents of different kinds. I didn’t know what this was good for, but I figured: what the heck, let’s do it. It was a mathematically natural move, and it didn’t make anything harder—in fact it clarified some of our constructions, which is why Joe wanted to do it.

Now that generalization is proving to be crucial! We can take our category of networks to have states as objects and tasks (ways of moving between states) as morphisms! So, instead of ‘overlaying networks’, the basic operation is now composing tasks.

So, we now have a framework where if you specify a collection of agents of different kinds, we can give you the category whose morphisms are tasks those agents can engage in.

An example is John’s setup where the agents are moving around on a graph.

But this framework also handles PERT charts! While the folks who invented PERT charts didn’t think of them this way, one can think of them as describing categories of a certain specific sort, with states as objects and tasks as morphisms.

So, we now have a compositional framework for PERT charts.

I would like to dive deeper into the details, but this is probably enough for one post. I will say, though, that we use some math I’ve just developed with my grad student Jade Master, explained here:

Open Petri nets (part 3), Azimuth, 19 August 2018.

The key is the relation between Petri nets and PERT charts. I’ll have more to say about that soon, I hope!

Some posts in this series:

Part 2. Metron’s software for system design.

Part 3. Operads: the basic idea.

Part 4. Network operads: an easy example.

Part 5. Algebras of network operads: some easy examples.

Part 6. Network models.

Part 7. Step-by-step compositional design and tasking using commitment networks.

Part 8. Compositional tasking using category-valued network models.

## Open Petri Nets (Part 3)

19 August, 2018

• John Baez and Jade Master, Open Petri nets.

In Part 1 we saw the double category of open Petri nets; in Part 2 we saw the reachability semantics for open Petri nets as a double functor. Now I’d like to wrap up by showing you the engine beneath the hood of our results.

I fell in love with Petri nets when I realized that they were really just presentations of free symmetric monoidal categories. If you like category theory, this turns Petri nets from something mysterious into something attractive.

In any category you can compose morphisms $f\colon X \to Y$ and $g\colon Y \to Z$ and get a morphism $gf \colon X \to Z.$ In a monoidal category you can also tensor morphisms $f \colon X \to X'$ and $g \colon Y \to Y'$ and get a morphism $f \otimes g \colon X \otimes X' \to Y \otimes Y'.$ This of course relies on your ability to tensor objects. In a symmetric monoidal category you also have $X \otimes Y \cong Y \otimes X.$ And of course, there is more to it than this. But this is enough to get started.

A Petri net has ‘places’ and also ‘transitions’ going between multisets of places:

From this data we can try to generate a symmetric monoidal category whose objects are built from the places and whose morphisms are built from the transitions. So, for example, the above Petri net would give a symmetric monoidal category with an object

2 susceptible + infected

and a morphism from this to the object

susceptible + 2 infected

(built using the transition infection), and a morphism
from this to the object

susceptible + infected + resistant

(built using the transition recovery) and so on. Here we are using $+$ to denote the tensor product in our symmetric monoidal category, as usual in chemistry.

When we do this sort of construction, the resulting symmetric monoidal category is ‘free’. That is, we are not imposing any really interesting equations: the objects are freely generated by the places in our Petri net by tensoring, and the morphisms are freely generated by the transitions by tensoring and composition.

That’s the basic idea. The problem is making this idea precise!

Many people have tried in many different ways. I like this approach the best:

• José Meseguer and Ugo Montanari, Petri nets are monoids, Information and Computation 88 (1990), 105–155.

but I think it can be simplified a bit, so let me describe what Jade and I did in our paper.

The problem is that there are different notions of symmetric monoidal category, and also different notions of morphism between Petri nets. We take the maximally strict approach, and work with ‘commutative’ monoidal categories. These are just commutative monoid objects in $\mathrm{Cat},$ so their associator:

$\alpha_{A,B,C} \colon (A + B) + C \stackrel{\sim}{\longrightarrow} A + (B + C)$

their left and right unitor:

$\lambda_A \colon 0 + A \stackrel{\sim}{\longrightarrow} A$

$\rho_A \colon A + 0 \stackrel{\sim}{\longrightarrow} A$

and even—disturbingly—their braiding:

$\sigma_{A,B} \colon A + B \stackrel{\sim}{\longrightarrow} B + A$

are all identity morphisms.

The last would ordinarily be seen as ‘going too far’, since while every symmetric monoidal category is equivalent to one with trivial associator and unitors, this ceases to be true if we also require the braiding to be trivial. However, it seems that Petri nets most naturally serve to present symmetric monoidal categories of this very strict sort. There just isn’t enough information in a Petri net to make it worthwhile giving them a nontrivial braiding

$\sigma_{A,B} \colon A + B \stackrel{\sim}{\longrightarrow} B+A$

It took me a while to accept this, but now it seem obvious. If you want a nontrivial braiding, you should be using something a bit fancier than a Petri net.

Thus, we construct adjoint functors between a category of Petri nets, which we call $\textrm{Petri},$ and a category of ‘commutative monoidal categories’, which we call $\textrm{CMC}.$

An object of $\textrm{Petri}$ is a Petri net: that is, a set $S$ of places, a set $T$ of transitions, and source and target functions

$s, t \colon T \to \mathbb{N}[S]$

where $\mathbb{N}[S]$ is the underlying set of the free commutative monoid on $S.$

More concretely, $\mathbb{N}[S]$ is the set of formal finite linear combinations of elements of $S$ with natural number coefficients. The set $S$ naturally includes in $\mathbb{N}[S]$, and for any function

$f \colon S \to S'$

there is a unique monoid homomorphism

$\mathbb{N}[f] \colon \mathbb{N}[S] \to \mathbb{N}[S']$

extending $f.$

A Petri net morphism from a Petri net

$s, t \colon T \to \mathbb{N}[S]$

to a Petri net

$s', t' \colon T' \to \mathbb{N}[S']$

is a pair of functions

$f \colon T \to T'$

$g \colon S \to S'$

making the two obvious diagrams commute:

There is a category $\textrm{Petri}$ with Petri nets as objects and Petri net morphisms as morphisms.

On the other hand, a commutative monoidal category is a commutative monoid object in $\mathrm{Cat}.$ Explicitly, it’s a strict monoidal category $(C,+,0)$ such that for all objects $A$ and $B$ we have

$A + B = B + A$

and for all morphisms $f$ and $g$

$f + g = g + f$

Note that a commutative monoidal category is the same as a strict symmetric monoidal category where the symmetry isomorphisms

$\sigma_{A,B} \colon A + B \stackrel{\sim}{\longrightarrow} B+A$

are all identity morphisms. Every strict monoidal functor between commutative monoidal categories is automatically a strict symmetric monoidal functor. So, we let $\mathrm{CMC}$ be the category whose objects are commutative monoidal categories and whose morphisms are strict monoidal functors.

There’s a functor

$U \colon \mathrm{CMC} \to \mathrm{Petri}$

sending any commutative monoidal category $C$ to its underlying Petri net. This Petri net has the set of objects $\mathrm{Ob}(C)$ as its set of places and the set of morphisms $\mathrm{Mor}(C)$ as its set of transitions, and

$s, t \colon \mathrm{Mor}(C) \to \mathrm{Ob}(C) \hookrightarrow \mathbb{N}[\mathrm{Ob}(C)]$

as its source and target maps.

Proposition. The functor $U \colon \mathrm{CMC} \to \mathrm{Petri}$ has a left adjoint

$F \colon \mathrm{Petri} \to \mathrm{CMC}$

This is Proposition 10 in our paper, and we give an explicit construction of this left adjoint.

So that’s our conception of the free commutative monoidal category on a Petri net. It’s pretty simple. How could anyone have done anything else?

Montanari and Meseguer do almost the same thing, but our category of Petri nets is a subcategory of theirs: our morphisms of Petri nets send places to places, while they allow more general maps that send a place to a formal linear combination of places. On the other hand, they consider a full subcategory of our $\mathrm{CMC}$ containing only commutative monoidal categories whose objects form a free commutative monoid.

Other papers do a variety of more complicated things. I don’t have the energy to explain them all, but you can see some here:

• Pierpaolo Degano, José Meseguer and Ugo Montanari, Axiomatizing net computations and processes, in Logic in Computer Science 1989, IEEE, New Jersey, 1989, pp. 175–185.

• Vladimiro Sassone, Strong concatenable processes: an approach to the category of Petri net computations, BRICS Report Series, Dept. of Computer Science, U. Aarhus, 1994.

• Vladimiro Sassone, On the category of Petri net computations, in Colloquium on Trees in Algebra and Programming, Springer, Berlin, 1995.

• Vladimiro Sassone, An axiomatization of the algebra of Petri net concatenable processes, in Theoretical Computer Science 170 (1996), 277–296.

• Vladimiro Sassone and Pavel Sobociński, A congruence for Petri nets, Electronic Notes in Theoretical Computer Science 127 (2005), 107–120.

Getting the free commutative monoidal category on a Petri net right is key to developing the reachability semantics for open Petri nets in a nice way. But to see that, you’ll have to read our paper!

Part 1: the double category of open Petri nets.

Part 2: the reachability semantics for open Petri nets.

Part 3: the free symmetric monoidal category on a Petri net.


text:
# Issues

Issue #150 wontfix

# request: beamerpauses labels

unhandyandy
created an issue

I'd like labels for the beamerpauses counter that work along the lines of the existing labels for cross-references.

For example, I'd like the following code to work (after running pdflatex twice):

{{{

# !latex

\only<+-\ref{done}>{ Testing,...

\pause testing,...

\pause\label{done} 1, 2, 3. } \pause Done!

}}}

1. This is fundamentally not how the \label/\ref mechanism works (there is nothing numbered for \label to pick up on). I'm also not really sure about the concept - I'm afraid without a good argument this is 'WONTFIX'.

format: plain


text:
# Write a multi-line equation with unmatched \left( and \right)

how can i write this long equation in beamer

 \mathbb{E}^{x}[f(X_{\tau})]&=f(x)+\mathbb{E}^{x}\left[\int_{0}^{\tau}\left(\sum_{i}u_{i}  (s,\omega)\frac{\partial
f}{\partial
x_{i}}(X_{s})+\frac{1}{2}\sum_{i,j}(v.v^{T})_{i,j}(s,\omega)\frac{\partial^{2}f}{\partial
x_{i}\partial x_{j}}(X_{s}) \right)\diff s \right]

guz when i use align give error told me that Missing of { that's because \right) or \right]

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{amssymb}
\newcommand{\diff}{\mathop{}\mathopen{}\mathrm{d}}
\begin{document}
\begin{frame}
\begin{align*}
\mathbb{E}^{x}[f(X_{\tau})]&=f(x)+\mathbb{E}^{x}\left[\int_{0}^{\tau}\left(\sum_{i}u_{i}(s,\omega)\frac{\partial
f}{\partial x_{i}}(X_{s})\\
&+\frac{1}{2}\sum_{i,j}(v.v^{T})_{i,j}(s,\omega)\frac{\partial^{2}f}{\partial
x_{i}\partial x_{j}}(X_{s}) \right)\diff s \right] \end{align*}
\end{frame}
\end{document}

-
Please provide a complete MWE whenever possible- it helps folks that look at your question :) –  cmhughes Oct 4 '13 at 18:51
this question, and others, provide useful information: How to make \left, \right pairs of delimiter work over multiple lines?. –  barbara beeton Oct 4 '13 at 19:57

The standard way to match an unpaired \left<( [ {> and \right<) ] }> is to use \right. or \left.

Here's a complete MWE that demonstrates the idea

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{beamer}
\usepackage{amsmath}
\usepackage{amssymb}
\newcommand{\diff}{\mathop{}\mathopen{}\mathrm{d}}
\begin{document}

\begin{frame}
\begin{align*}
\mathbb{E}^{x}[f(X_{\tau})] & =f(x)+\mathbb{E}^{x}\left[\int_{0}^{\tau}\left(\sum_{i}u_{i}(s,\omega)\frac{\partial f}{\partial x_{i}}(X_{s})\right.\right.                \\
& \left.\left.+\frac{1}{2}\sum_{i,j}(v.v^{T})_{i,j}(s,\omega)\frac{\partial^{2}f}{\partial x_{i}\partial x_{j}}(X_{s}) \right)\diff s \right]
\end{align*}
\end{frame}
\end{document}

Some folks would recommend that you use \bigg instead, or perhaps add a vphantom so that the measuring is exact.

-
Thanks its work –  Educ Oct 4 '13 at 18:54
@Educ glad it helped :) your edit is fine, but would have been unnecessary if you had provided a complete MWE- something to remember for the future :) –  cmhughes Oct 4 '13 at 19:24
Given that the big round paren and square bracket on the second line appear to be much larger than they are on the first line, use of explicit \bigg (or even \Bigg) directives would seem to be indicated. –  Mico Oct 4 '13 at 19:36
@Mico yes, indeed- or perhaps the vphantom idea I mentioned –  cmhughes Oct 4 '13 at 19:47
The downside of the \vphantom method is that it tends to clutter up the code. I think it's much easier to simply eyeball the situation and decide that \bigg is the size to go on both lines... –  Mico Oct 4 '13 at 20:04


text:
The natural logarithm, written mathematically as , is a specific case of the more familiar logarithms, denoted mathematically as . All logarithms must have a base value. If the base is not specified, as in the case of , the base can be assumed to be ten (the common logarithm). The same holds true of the natural logarithm, which has an inherently defined base of value

(Euler's number), which is recognized by the form the function takes: .

• Common Logarithm:
• Arbitrary Base Logarithm:
• Natural Logarithm:

The natural logarithm cannot have any other base specified. The function , on the other hand, can have any base value other than 1 or 0. And, as already stated, if log is left without a subscripted base, its assumed base value is ten.

The natural logarithm, because of its base value , has specific properties noted in the study of calculus, which make it the ideal base value for any logarithm. Non-Euler-based logarithms do not share these properties. Some engineers, however, use their own nomenclature for the natural logarithm which is ambiguous and easily mistaken for the common logarithm:.

## Definitions

There are various ways of giving a formal definition for the natural logarithm.

One of them is to define it is using definite integrals in the following way:

Another definition of the natural logarithm is the limit definition:


text:
# What cases does the word Zettel cover?

edited April 2020 in Random

Let me start straight with explaining why I ask this, since it should be obvious after reading several topics on this forum and posts on the site. I want to use my collection to not only hold what one would write on a slip of paper, which I believe to be the most common translation for Zettel, but also include files and data entries (contacts, bookmarks, calendar, any structured data really). I have read a web page that went into great detail of what is a Zettel in German, but it still mostly seems to fit the nature of what you would put on a slip of paper. Would Zettel still be the right word for my collection when it also include these other things? Is there an appropriate other word for this? I don't really care whether it is in German, English, or maybe even a different language if it has a very nicely fitting word for it.

At the moment I have been using the word "node", to imply it is something within a network with others, but I feel like it likely is too general a word, not really capturing my intent well. I have trouble even putting into word what the thing even is, something along the lines of a networked piece of information.

Edit: If Zettel does not quite cover what I am looking for, I did find a word that might fit after searching through some dictionaries: ideatum: (in epistemology) the object of knowledge as known by the mind. As I aim my Zettelkasten to be an extension of / aid to my mind.

Edit 2: Another word that seems to fit is detail as the noun implies it be a particular part of the whole, and the verb implies it "tells fully and distinctly" or to "list" things, which matches nicely with Zettel and structure notes. Although other than that it feels a bit too general.

• Would Zettel still be the right word for my collection when it also include these other things?

These other things being files and data entries. I have thought about it some more and after realizing I want to include a Zettel for each of the files I reference in my Zettelkasten, as I proposed to do here. Later I found a Youtube video from the author of Zettlr proposing a similar solution, only confirming for me that this is probably a good way to go about handling files within a Zettelkasten. And data entries have to written on something, which I so happen to plan to incorporate within my Zettels too, so actually all my use cases that differ from the standard use of the word Zettel, still end up being combined with a Zettel in some way. And then of course there is the cultural aspect surrounding Zettel / Zettelkasten, making me choose to stick with Zettel after all.

• @grayen, the original use of "zettel" by Luhmann referred to a physical object - a notecard - whose function was theoretically ambiguous (or polysemous) because he did not need to draw distinctions that people now are aiming to draw as they discuss the details of the method. If you want to make finer distinctions you need to add and define modifiers, as people do when discussing structure zettels, literature zettels/notes, etc. But I don't think there's any reason to get hung up on what zettel "should" mean - pick your terms and clarify them for your use.

• What @cobblepot just said is good advise: in the end, it's important you know what you mean when you talk about "Zettel", and writing this down in your Zettelkasten as a meta-discussion of sorts can be very helpful.

If you lived 60 years ago and all you had was scraps of paper and a lot of drawers where the paper fit in, of course you could've reserved one drawer for contacts, for example. I don't think it would make much practical sense to put the contact information between the notes about books you've read; while, true, it would unify both in a single system, access to contacts by name/alphabet would be much more useful.

With digital tools and for knowledge workers who mostly type on their computers, I think the equivalent of using the same tool for multiple kinds of content is to digitalize everything; have your notes on the computer, and your calendar, and your contacts. (Instead of e.g. maintaining a Rolodex.) This is hardly a ground-breaking thought in 2020. I refrained from putting most diary/journal like entries in my Zettelkasten, though, because that got on my nerves after a couple of years. If your journal entries were less shitty than mine, I can see how poignant reflections upon what happens in life can help generate material for novels. That is, apparently, not me, though

Could you explain the anticipated benefit of finding a general word that covers all special cases, like notes, contacts, calendar entries, bookmarks? I am afraid that when you e.g. say "Foobar" instead of any of these words, nobody knows what you're talking about: is "I wrote a great Foobar yesterday!" about a very well-written piece of prose, or is it about a calendar entry that you crafted with such attention to detail that your mind exploded? Clearly, that wouldn't be useful, so you must be onto something else

Author at Zettelkasten.de • https://christiantietze.de/

• edited April 2020

@cobblepot and @ctietze, you are completely right, even if I would find the perfect word for it, it is likely to be too general or unfamiliar to hold much meaning when conversing. The reason I started to think about this was that I wanted to use a custom protocol (e.g. zettel://202004211540) and since it would become part of permalinks (like UIDs are permanent), I would have to find a name for the protocol that I will not regret later on, since I won't be able to change it.

• You can use something lame like myuniqueid://

Author at Zettelkasten.de • https://christiantietze.de/

• @ctietze said:
You can use something lame like myuniqueid://

I would second that. As I detailed in my reply to the other thread I personally use the url-scheme zettel:// which sure is nice and appropriate, but given the current rise in interest in the Zettelkasten-Methode (or is this a filter bubble thing?), I'm only waiting for someone to take this url-scheme for some more public software, which might work differently and could potentially break my approach. So thinking about it, a more unique url-scheme would probably have been more future-proof.

• edited April 2020

@rhubarb That was indeed my reason to be doubtful about using zettel://, it might make sense now, but what if in a few years I move to a Foobar method and then it would be weird to still refer to things as Zettel.

@ctietze Haha, although fitting, it feels too much like a programming tutorial name, myFunction, MyClass, MyNumber, etc.. I think an unique identifier protocol would not work, because there are sure to be collisions in IDs across applications, but it should be possible to manage the IDs you use such that they are unique for your person. So I am now leaning towards puid:// Personally Unique IDentifier. This also implies that the permalinks are for your own usage, not for sharing with others.

• edited April 2020

My reasoning was not so much one of changing methods, after all it is just a name, and more so that the name zettel gets adopted publicly. I do not know, whether puid is much better in this regard as it is very short, what about something like grayenid for you and rhubarbid for me, etc.?

• edited April 2020

@rhubarb Although that might indeed happen, for those cases I doubt it would be too problematic, you should still be able to change the default handler for the protocol to be a script of yours.

Actually, I think puid is more likely to get taken, it is rather term used all over:
https://acronyms.thefreedictionary.com/PUID. So maybe myuid:// is not so bad after all...

Although names as grayenid would indeed almost guarantee not having such a thing happening to them, I don't know how unique the nickname is, and whether I will be using it permanently (they are for permalinks after all).

• After reading about Zettelkasten for a couple of weeks, I had the idea of a special protocol for linking to IDs. No surprise, I am not the first! But I was thinking these four forms ought to handle everything a multiple kasten-ator could need, and more than most would need:

zkn:202005230231 - relative link within same Zettelkasten as this note
zkn:somePath/202005230231 - relative link into some area (folder) within same Zettelkasten
zkn:/myKasten/202005230231 - absolute link into a named Zettelkasten
zkn:/myOtherKasten/202005230231 - absolute link into another named Zettelkasten

We just need some whipper-snapper to write a quick Python program that takes one of these URIs and returns a file name for it, and then we get it compiled to an executable for all the major platforms (or maybe it's a shell script). Then, you set it in your OS as the "zkn:" handler, and you don't need to script all your editors any more! You only need for your editor to know how to open an arbitrary link via the OS' built-in link/protocol handling. You could even be reading the HTML version of your notes in an off-the-shelf browser (no plugins), click a "zkn:" link, and the protocol handler handles it all!

(BUT: the editor/browser has to know that this file name is to be opened on receipt, not displayed as text. If that is a problem, we can have the protocol handler return the file contents like other protocols, but then the editor has to know where it came from as a file so you can then edit it and save. I don't know enough detail about the link/protocol standard to see how this issue would be addressed. Maybe someone does.)

This "zkn:" handler would find the right zettel by following a series of searches:
1. Parse to separate the kasten/path name and zettel ID.
2. Translate the kasten/path into a file path, following some simple user settings.
3. See whether a file exists in that path whose name begins with (contains?) the ID.
4. Recursively search any applicable subdirectories for same.
5. If no such file, fall back to a content search (grep) for this ID, with applicable subdirectories.
6. Return the file name (content?) of the file found.

Multi-kasten users would configure this one time up front by selecting a folder naming scheme. The simplest scheme would be to use absolute paths corresponding to each zettelkasten's folder on the disk, with relative URIs searching within the same folder. More complicated mappings might allow short names corresponding to specific root folders regardless of paths, etc., something like an Apache config but MUCH simpler. With a light configuration GUI with just a few options and text boxes, the average user could be up and running quickly with useful flexibility. Out of the box, it ought to "just work" for the simplest configuration of a single zettelkasten, interpreting any paths as folders, relative or absolute.

The ID template would also be a configuration option. It should let the user specify a little text template to wrap the ID in the target file, such as the ever-popular [[ID]]. We should not have to type that into every link, but the program's search should supply the template itself, to minimize false positives. Many non-zettelers use a timestamp naming scheme like this for their files, and if we start linking to those, their links will mistakenly look like zettel IDs.

If one day you need to use your zettelkasten without this handy protocol handler, you can still follow links manually the old way or grep or use an editor feature that opens the file name under the cursor, etc., so your content is still 100% portable. Worst case, if you used some folder-based nickname scheme, you might need to search and replace back to the real disk folders, but that is not too bad. Or... there's symlinks!

Any whipper-snappers want to try this out or solve the missing "BUT"?

• @bgj99co If you're on a Mac, you can make a functional URL scheme witk zkn:// yourself. See my instructions here: https://forum.zettelkasten.de/discussion/1121/open-files-in-any-app-from-the-archive-using-url-schemes

I don't know anything about Windows and Linux in that regard. Instructions or research results in separate threads/discussions would be much appreciated by everyone around here!

Author at Zettelkasten.de • https://christiantietze.de/


text:
First published in internet mathematics forums

Posted: Friday 4th August 2017

## Mathematics of profiles of water diffusers and nozzles

I derived this system of differential equations this week as I was researching possible profiles for water diffusers & nozzles, used when joining pipes with different bores.

Mathematics: Solve this system of differential equations.

$x' = y^{-2}$
$y' = - \sqrt {(t+1)^2- y^{-4}}$
$$x'$$ and $$y'$$ are derivatives with respect to $$t$$.

I have obtained a numerical solution (which was non-trivial because of the numerical instability of the Euler method with this system of differential equations) but I am curious to know "does an analytical solution exist?", which would be more efficient and convenient to use.

Derivation of the system of differential equations

Water is accelerated in a nozzle or a pipe of reducing width, which is rotationally symmetrical about the X-axis, with the bore, the inner diameter and the inner radius proportional to a function $$y(x)$$ .

Neglecting viscosity and considering averages for simplicity, the velocity of the water in the X-axis is inversely proportional to the bore's area of cross section and to $$y^2$$.

$x' = y^{-2}$

The average velocity $$r'$$, of a radial element, a thin slice of water "pie", is composed of the vector addition of the velocity along the X-axis $$x'$$ and in the radial direction $$y'$$, which are related in magnitude by Pythagoras,

$r'^2 = x'^2 + y'^2$

So

$y' = \sqrt{r'^2 - x'^2}$

Assume an acceleration $$r' = at + u$$, at a time $$t$$, with acceleration a and initial velocity u, but for simplicity here, both a and u are assumed to be 1.

$r' = t + 1$

Therefore

$y' = - \sqrt{ (t+1)^2 - y^{-4}}$

choosing the negative root corresponding to an radially inward $$y'$$ when water accelerates in a nozzle.

Numerical Solution

The numerical instability was managed by writing a computer program which could calculate in t-increments corresponding to the square root of linear increments in $$t^2$$.

$$t_{i+1} = t_i + \Delta t_i$$ where $$\Delta t_i = \min(h_1,\sqrt{t_i^2+h_2}-t_i)$$ and $$h_1$$, $$h_2$$ are step size constants.

Approximate solution for $$(x,y,t) = (0,1,0)$$

With the initial conditions $$t=0, x=0, y=1$$ then $$x' = r' = 1$$ and $$y'=0$$.

Assuming that then $$y' << x'$$ for all $$t>0$$ then approximately

$x' = t + 1$

Integrating with respect to t and substituting for t (or simplifying this equation for linear acceleration, $$x'^2 - u^2 = 2ax$$ with $$a=1$$ and $$u=1$$ ) gives

$x'^2 - 1 = 2x$

Substituting for $$x' = \sqrt{2x+1}$$ in the system equation $$x' = y^{-2}$$ and rearranging for y gives

$y = (2x+1)^{-0.25}$

As this graph shows, this is a good approximate solution for these starting conditions.

Note on numerical instability
The graph also shows how numerical stability interrupted the numerical solution part plotted using the free on-line Two Dimensional Differential Equation Solver and Grapher V 1.0. Investigate the numerical instability by selecting the option "System of first order DEs: x' = f(x, y, t), y' = g(x, y, t)" and typing for x', y' -
x' = y^(-2)
y' = -1*sqrt((t+1)^2-y^(-4))
with initial values (x=0, y $$\ge$$1)


text:
# zbMATH — the first resource for mathematics

Iterative refinement of linear least squares solutions. I. (English) Zbl 0159.20404

##### Keywords:
numerical analysis
Full Text:
##### References:
 [1] Bauer, F. L.,Elimination with Weighted Row Combinations for Solving Linear Equations and Least Squares Problems, Num. Math. 7 (1965), 338–352. · Zbl 0142.11504 [2] Björck, Å.,Solving Linear Least Squares Problems by Gram-Schmidt Orthogonalization, BIT 7 (1967), 1–21. · Zbl 0183.17802 [3] Collatz, L.,Funktionalanalysis und Numerische Mathematik, Berlin: Springer-Verlag (1964). · Zbl 0139.09802 [4] Golub, G. H.,Numerical Methods for Solving Linear Least Squares Problems, Num. Math. 7 (1965), 206–216. · Zbl 0142.11502 [5] Golub, G. H. and Wilkinson, J. H.,Note on the Iterative Refinement of Least Squares Solution, Num. Math. 9 (1966), 139–148. · Zbl 0156.16106 [6] Martin, R. S., Peters, G. and Wilkinson, J. H.,Iterative Refinement of the Solution of a Positive Definite System of Equations, Num. Math. 8, (1966), 203–216. · Zbl 0158.33804 [7] Moler, C. B.,Iterative Refinement in Floating Point, J. Assoc. Comput. Mach. 14, (1967), 316–321. · Zbl 0161.35501 [8] Wilkinson, J. H.,Rounding Errors in Algebraic Processes, London: Her Majesty’s Stationary Office; Englewood Cliffs, N.J.: Prentice-Hall 1963. [9] Wilkinson, J. H.,Error Analysis of Transformations Based on the Use of Matrices of the Form I-2ww T , Error in Digital Computations. Volume II. Rall, L. B. ed. New York: John Wiley (1965), 77–101.
This reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.


text:
## Basic College Mathematics (9th Edition)

$x=-4$
We are given the equation $-5x-4=16$. In order to solve, we can first add 4 to both sides. $-5x-4+4=16+4$ $-5x=20$ Divide both sides by -5. $\frac{-5x}{-5}=\frac{20}{-5}$ $x=-4$


text:
# Does anyone know what version of Scheme this is?

The one I'm talking about is the one on replit.com. Pic:

Oh and the first two examples for it are a Y-combinator and a macro.

the biwascheme interpreter version 0.6.4. it's a scheme interpreter written in javascript. its website is biwascheme.org.

Ok, but is it R5RS, R6RS, or what?

Because:

i dunno just look at the website
it says this at least

Yeah... I don't want to use R6RS or R7RS.

/*
* BiwaScheme 0.6.4 - R6RS Scheme in JavaScript
*
* Copyright (c) 2007-2014 Yutaka HARA (http://www.biwascheme.org/)
*/

R6RS...

You could check out UCB Scheme.

Wait what’s wrong with R6RS

I don't see a "use online" option there.

Brian could probably tell you.

There are two dialects of Lisp in common use today: Scheme and Common Lisp. Guy Steele, who was a co-developer of both of them, compares Scheme to his Swiss Army knife, which has a limited set of tools (five linear-head screwdrivers, one Philips-head, for example) but can come with him everywhere; he compares Common Lisp to his home workshop, which has a whole wall full of dozens of screwdrivers, including special-purpose ones such as non-metallic as well as different sizes of different head patterns.

But Scheme has gotten bigger and more industrial-strength with each revision of the standard. A big shift between R4 and R5 was the specification of hygienic macros, a change that I bitterly opposed at the time, partly because of a slew of messages on comp.lang.scheme from Lords of the Lambda Calculus (a name I just made up, like Knights of the Lambda Calculus but superstars) saying "I can't figure out how to do such-and-such with hygienic macros," but have since grudgingly come to accept for lexically scoped languages (i.e., not Logo).

But R6 was a huge shift away from Scheme's educational roots toward "real world" industrial programming. For example, R6 removes the requirement that the language have a Read-Eval-Print Loop (REPL), i.e., the requirement that it be usable interactively. You can have a Scheme built into some piece of software but invisible to the user of that software. A seemingly minor change that drives me crazy is that they made symbols case-sensitive, which is so wrong even though all the common programming languages do it. Upper case is a font decoration, like italics. There are conventions about when these decorations are used, e.g., capitalizing the first word of a sentence, or italicizing imports from foreign languages, such as ipso facto or ibid from Latin. But those are just typographic conventions; it would be weird if there were a different English word "ibid" that meant something different. You can find counterexamples to what I'm saying, especially back in the 1800s when people were giving their children names like Faith and Charity. You can imagine crafting sentences such as "Yesterday Charity didn't show much charity" in which the two otherwise identically spelled words are semantically distinguished by the initial capital letter, but those are super exceptional. (And I point out that if someone said that to you out loud instead of in writing, you'd have no trouble figuring out which "charity" was which without the aid of the capital C.) And there are plenty of weird homophones in English that don't involve capitalization.

Case-insensitivity matters so that you can easily write sentences about programs, such as "You should really use MAP in there somewhere," or annotated programs, such as "You left out the MAP in (sum (MAP (square()) OVER (x)))" when someone asks why (sum (square (x)) didn't work.

And lots more; they invented a module system -- which is only needed in industrial-strength programming with teams of 500 programmers -- and a bunch more that I forget.

This all happened because the standardization committee was invaded by people who wanted Scheme to be another Common Lisp, basically, although they didn't say it that way. Instead they said things like "All modern programming languages do such-and-such" but that comes down to the same thing, because the languages they call "modern" were invented for teams of 500, not for teaching the central ideas of computer science. And also because Steele and Sussman, the developers of Scheme, were spending their time on other things and didn't attend the R6 meetings. If they had, the world would be a better place. (They are, in public, neutral about the changes to Scheme, I should point out.)

The big point is, we already had a Lisp for teams of 500, namely, Common Lisp. So the invaders should have just learned to love CL instead of mucking up Scheme.

The above does not represent the opinion of the University of California, blah blah.

Yeah that's true. Are you on a Chromebook or something? I think maybe you can find an R5RS library for Racket a/k/a Dr. Scheme.

Nope. Windows 10.

Oh. Well then why does it matter if it's a web server or runs locally?

I wonder if

(define-macro for
(lambda (iterator start end . body)
(let loop ((,iterator ,start))
(if (<= ,iterator ,end)
(loop (+ ,iterator 1) (begin ,@body))))))

(for x 1 3
(for y 1 3
(for z 1 3
(define a (* x y z))
(print x " * " y " * " z " = " a))))

is valid R5RS code. It outputs the expected output:

1 * 1 * 1 = 1
1 * 1 * 2 = 2
1 * 1 * 3 = 3
1 * 2 * 1 = 2
1 * 2 * 2 = 4
1 * 2 * 3 = 6
1 * 3 * 1 = 3
1 * 3 * 2 = 6
1 * 3 * 3 = 9
2 * 1 * 1 = 2
2 * 1 * 2 = 4
2 * 1 * 3 = 6
2 * 2 * 1 = 4
2 * 2 * 2 = 8
2 * 2 * 3 = 12
2 * 3 * 1 = 6
2 * 3 * 2 = 12
2 * 3 * 3 = 18
3 * 1 * 1 = 3
3 * 1 * 2 = 6
3 * 1 * 3 = 9
3 * 2 * 1 = 6
3 * 2 * 2 = 12
3 * 2 * 3 = 18
3 * 3 * 1 = 9
3 * 3 * 2 = 18
3 * 3 * 3 = 27

R5 specifies the hygienic macro language but punts on non-hygienic macros. (It turns out that once in a while you need them.) There were too many competing notations, and at the time, at least, no principled reason to pick one over another.
So if your code works, it's legal.

Ok.

I don't actually know the difference between those.

Ah. You are pulling at the end of a long thread.

Once upon a time, Lisp interpreters were dynamically scoped. That is, if you use a variable in a procedure body, and that variable isn't defined in that same procedure, you look next in the caller of the procedure, and then the caller of that procedure, until finally you get to a toplevel call and you check the global variables.

It turns out that dynamic scope is the easy, obvious thing to implement in an interpreter, but lexical scope (which I'll get to in a moment) is the easy thing to implement in a compiler, and for quite a long time, Lisp systems included both an interpreter (for development and debugging) and a compiler (for fast production runs), and the interpreter used dynamic scope, while the compiler used lexical scope. The fact that this worked at all is a testament to the rareness of a procedure needing to use a local variable defined in an "uplevel" procedure.

So, one of the reasons people have rejected dynamic scope is its "name capture" problem. (Look up "funarg problem" for the classic papers working this out.) Say you do this:

(define pi 3.141592654)
(define (area r)
(* pi r r))

Straightforward, right? Now try this:

(define (big-area r)
(let ((pi 7))
(area r)))

With dynamic scope, the procedure BIG-AREA has captured the value of PI, which AREA needs to be correct.

So the new idea, lexical scope, is that if a procedure uses a variable that it didn't define itself, it looks in the physically surrounding procedure definition. For example, with lexical scope, AREA always uses the global PI, regardless of what BIG-AREA does, because the definition of AREA is at toplevel, not inside another procedure body. But the internal procedure generated by the LET in BIG-AREA (remember, the LET is equivalent to

( (lambda (pi) (area r)) 7)

) is created inside another procedure, namely BIG-AREA, so it has access to that procedure's R.

So, no name capture problem. The idea is that when you're debugging, all procedure definitions that might affect the procedure you're debugging are right there, surrounding that procedure, so you can't miss lexical name captures (which aren't called that, because they're always intentional), unlike the situation with dynamic scope, in which the definitions of AREA and BIG-AREA could be miles apart in the program source.

So, as I said, no name capture problem. Unless you're using macros. So you say

(define-macro (big-area r)
(let ((pi 7))
(* ,pi r r)))

and the macro has snuck a quasi-dynamic reference to its own PI into the calculation. (I know, this isn't a great example, I'm too tired to look one up.)

So, finally, hygienic macros maintain the principle of dynamic scope by rigidly separating symbols that will be evaluated in the macro's own environment from symbols that will be evaluated in the caller's environment. The latter can't overwrite the caller's expectations because, in one standard implementation, all the caller's-environment variables are renamed for each macro call, so the name PI might turn into PI#1 on the first call, PI#2 on the second call, etc. (I'm just making up a notation that wouldn't be a legal symbol, so you can't type in these renamed variables to get a value from a different scope.)

Now you understand what problem hygienic macros are supposed to solve, and you can look up the details of the actual notation.


text:
# Fatou's Lemma Counterexample

Give an example of sequence of Measurable functions defined on some measurable subset $E$ of $\mathbb{R}$ such that $f_{n} \to f$ pointwise almost everywhere on $E$ but $$\int\limits_{E} f \ dm \not\leq \lim_{n} \inf \int\limits_{E} f_{n} \ dm$$

-
I know that this is very much related to Fatou's lemma but i am unable to find an example. – anonymous Aug 10 '10 at 13:28
How is it related to fatou's lemma? What is fatou's lemma? What have you tried? Why do you care? Including such things in your question makes it a pleasure to read (bolstering the site and your reputation) and to answer (since answering, knowing your answer will be useful, makes it all the more worthwhile)... – Tom Boardman Aug 10 '10 at 13:32
@Tom Boardman: Doesn't fatou's lemma deal with this type of integral. The final statement of Fatou's lemma is $$\int\limts_{E} f \ dm \leq \lim_{n} \inf \int\limits_{E} f_{n} \ dm$$ Also, whats wrong in thinking that way. Its my think. I did think something about characteristic function, but didn't work. – anonymous Aug 10 '10 at 15:21
@Chandru1: Maybe you could edit your question and exchange \nleq with \not\leq so that the indented becomes more readable. (As a bounty you'll get an upvote from me.) – Rasmus Aug 10 '10 at 17:10

Take, for instance, $f_n(x)=-1_{n\leq x\leq n+1}$ (just $-1$ times the indicator function on the interval $[n,n+1]$). Then $f=\lim\limits_{n\to\infty}\inf f_n=0$. Hence, $$0=\int f dm \not\leq \lim_{n\to\infty}\inf\int f_n dm = -1.$$
For $E=[0,1]$ set: $f_n(x)=n- n^2x$ for $x\in [0,\frac1n]$ $f_n(x)=0$ else.


text:
# Tricky problem - Find E-field of a sheet of charge

## Homework Statement

Consider a uniformly charged, infinitesimally thin rectangular sheet with total charge Q extending from x = 0 to x = -w and from y = 0 to y = L. Find the electric field at an arbitrary distance x along the positive x-axis.

## Homework Equations

Superposition; E = ∫kdq/r2

## The Attempt at a Solution

[Broken]

The picture shows how I'm approaching this problem. In the integral, 'dR' just means I'm doing a double integral over the rectangular region labeled R. I've pulled the charge density σ out of the integral, since the problem states it is uniform, therefore constant.

The confusion I'm having is that I need a pair of variables to integrate with respect to over the rectangular region. THEN I need to express the distance r in terms of those variables, so that I can actually do the integral. Since the region I'm integrating over is rectangular, I'd like to use typical x and y as variables, and I already have the limits of integration for those variables. BUT I haven't been able to express the distance, r, from source point to my point on the positive x-axis in terms of the variables x and y. I tried to use trig but that just seems to confuse things.

Finally, I don't know if this is important or not, but I haven't been able to find a way to account for that bit of horizontal distance on the left side of the y-axis, i.e. what would be the x-coordinate of the vector from the origin to my (arbitrary) source point. If I could find an expression for that, then maybe I could just use Pythagoras's Theorem to get an expression for r in terms of x and y?

Can anyone offer any pointers?

Last edited by a moderator:

TSny
Homework Helper
Gold Member
You could try breaking the rectangular area into vertical strips of infinitesimal width. So, you might first want to solve the problem of the electric field at a point p on the x-axis a distance z from one of the strips.

#### Attachments

• strip.png
1.1 KB · Views: 414
Simon Bridge
Homework Helper
Define a surface element ##dS## at position ##(y,z)## charge ##\sigma dS##
Then you are integrating over y and z as well as accounting for the out-of-plane displacements.

As TSny suggests, it can be easier to work out the strips first.

So if I understand what you're getting at, I will need to take a 'representative strip' and treat it as a line charge, computing the electric field due to that line charge. Which will be an integral over the y-interval [0, L]. Then I need to take that integral and integrate it wrt z (i.e. from 0 to -w).

Hopefully that's correct?

I'll give it a try and post my further attempts. Thanks, guys!

TSny
Homework Helper
Gold Member
So if I understand what you're getting at, I will need to take a 'representative strip' and treat it as a line charge, computing the electric field due to that line charge. Which will be an integral over the y-interval [0, L]. Then I need to take that integral and integrate it wrt z (i.e. from 0 to -w).

That sounds good except for the range of integration of z.

Simon Bridge
Homework Helper
Oh - and remember that the electric field is a vector.
The examples usually put the x axis through the center so symmetry arguments can come into play more easily.

Alright, here's what I have so far.

For the E-field at p due to a 'representative strip' as you guys advised, I have

Eline = kλ∫(y2+z2)-1/2dy (this is a definite integral, from O to L, and λ is the constant linear charge density).

Then I need to integrate that over the horizontal (z?) axis from -w to 0:

Etotal = ∫[∫(y2+z2)-1/2dy]dz

Where the first (outer) integral has limits -w to 0 and the inner has limits 0 to L.

Am I on the right track here? Thanks for your help!

UPDATE: When I try the above, the limits I put on z (which TSny questioned) require me to take the natural log of 0. So it seems clear to me that my limits of integration on that variable are messed up. But I don't know what else to use? It seems to me I need to integrate over the interval [-w,0] on the horizontal axis.

Last edited:
The integral I end up with is (integrated from -w to 0):

∫(1/z)tan-1(L/z)dz

But the integrand is not defined/continuous at the rightmost limit of integration. So I'm thinking maybe I need to use a method for improper integrals, from basic calculus, such as

limt→0-∫(1/z)tan-1(L/z)dz

where the integration limits are -w to t.

Or am I over-thinking this?

Last edited:
TSny
Homework Helper
Gold Member
Alright, here's what I have so far.

For the E-field at p due to a 'representative strip' as you guys advised, I have

Eline = kλ∫(y2+z2)-1/2dy (this is a definite integral, from O to L, and λ is the constant linear charge density).

Does the electric field of a point charge vary inversely with the distance or inversely with the square of the distance?

As Simon pointed out, the electric field is a vector quantity. So, you will need to work out the x and y components separately.

Then I need to integrate that over the horizontal (z?) axis from -w to 0:

These are not the correct limits for z. Note that z represents the horizontal distance from the vertical strip to the point of observation.
What is the minimum value of z? the maximum value?

Does the electric field of a point charge vary inversely with the distance or inversely with the square of the distance?

Yeah, I should have caught that!

These are not the correct limits for z. Note that z represents the horizontal distance from the vertical strip to the point of observation.

I'm not understanding why I would integrate over z, if the variable is defined as the horizontal distance from the vertical strip to the point of observation. Don't I ultimately want to integrate over the charge distribution, to get the contribution to the field from each infinitesimal bit of charge?

UPDATE: I think I get the integration over z. The integration over the entire charge distribution is already taken care of by the integration of the strips, right?

TSny
Homework Helper
Gold Member
Yes, the integration over z is the integration over the strips.

Sorry to weary you guys with this problem, but I can't get it to work out.

For the electric field due to a representative line charge, I have

Eline = kλ∫dy/(y2+z2) = (1/z) tan-1(L/z)

(λ is the charge density)

To get the total Electric field at a point x on the positive horizontal axis, where z is defined as the horizontal distance from the strip of width dz to the point x, I integrate

Etotal = (kλ)∫(1/z)tan-1(L/z)dz

Now, what interval do I integrate this over? The only one that makes sense to me is from -w to x (where x is the point where the field is being evaluated). However, when I carry out the calculution (using integration by parts and u-substitution), my answer includes a term tan-1(L/z). But this is not defined at z = 0, so I have no idea what to do with that. I don't know how to avoid the division by zero problem.

Simon Bridge
Homework Helper
I don't see how you have accounted for the electric field being a vector...

Note:
The sheet is in the y-z plane.
A single element at point ##\small (0,y,z)## has area ##\small dydz## and charge $$dq=\frac{Q}{wL}dydz$$.
The electric field at point ##\small (x,0,0)## due to that element is ...

$$d\vec{E}=\frac{kdq}{r^3}\vec{r}$$ where ##\small \vec{r}## points from ##\small (0,y,z)## to ##\small (x,0,0)##.

You could brute-force the calculation from there. OR you can finesse it by starting out with the equation for the field at ##\small (x,0,0)##due to a strip of charge, width dz, through the origin ... write it out in vector notation.

Then consider how the geometry changes as the line moves to a location ##\small z\neq 0##. The magnitude and the direction will change right? How?

The fields due to all the strips will add up - this will be a vector sum so be careful.
Use your powers of reason and deduction to figure out how this affects the integral.

Now possibly I just didn't follow how you set up the integral.

Last edited:
1 person
TSny
Homework Helper
Gold Member
Here is how I was interpreting the quantity "z". It's just the distance from a strip to the point of observation. Note z is never 0. What are the minimum and maximum values of z?

You need to set up separate integrals for the x and y components of E.

#### Attachments

• z strip.png
26.6 KB · Views: 446
1 person
I'm actually fairly lost now, but not hopelessly so. Simon Bridge, you're right that I didn't treat the field as a vector. I just mindlessly started using equations without considering what kind of object I'm dealing with.

I'm pretty confused about the coordinates/variables now. I thought at first that this was a purely 2-dimensional problem, all in the plane. TSny defined the variable z (tracked along the horizontal axis, defined as the horizontal distance between charge elements and point of interest, labeled x in the original problem). And now you are talking about points with 3 coordinates, but I don't even know how another axis (aside from those pictured) even comes into play here.

So I'm finding it hard, right off the bat, to talk about vectors here, since I'm not even sure which variables stand for what or where the coordinate axes are directed.

TSny, thanks for clarifying what you meant by the z variable. I let myself get confused, because it's hard for me to think outside the box of the usual, conventionally defined {x,y,z} variables.

And yeah, I really never even thought about the vector nature of the field and how that needs to be reflected in my calculation.

I will give it another go. Thanks to both of you for your patience.

TSny
Homework Helper
Gold Member
I probably should have used a symbol different from z. Feel free to change it to whatever you want.

Simon Bridge
Homework Helper
Since z is used in the problem statement for a coordinate axis, it is not surprising TSny's use confused you.
The trick to doing these things is to go one step at a time and be clear at each stage about what you are dealing with. It helps if you are thinking geometrically rather than in terms of finding equations to put numbers into.

Try using the notation in post #13.
Explore the brute-force approach first, since you are having trouble with the geometry.
Do you understand where the expression for dq came from?

TSny
Homework Helper
Gold Member
Since z is used in the problem statement for a coordinate axis, it is not surprising TSny's use confused you.

I don't see a reference to z in the problem statement. But, I agree that I made a poor choice in using z.

The components thing is really throwing me for a loop. The only way I know how to approach it is in a roundabout, clumsy way using trig (???). Kind of like so:

E = Ecosθ e1 + Esinθ e2

where e1 is i hat and e2 is j hat (sorry I don't know very well how to format the math-speak.)

θ is the angle between the vector r and the horizontal axis.

cosθ = z/r, sinθ = y/r

Then E = Ez/r e1 + Ey/r e2

Since E = kdq/(r3) = kdq/((y2+z2)3/2)

I can write the component form as

kdq/((y2+z2)3/2)[z e1 - y e2]

IF this is useful (highly dubious), it's not clear to me how. I don't even know what I would use as my length element to multiply by the charge density to sub in for dq. Do I still want to use my original strategy of integrating this initial integral over y on [0,L], then integrating that result over z on an interval such as [x, x+w]?

Try using the notation in post #13.
Explore the brute-force approach first, since you are having trouble with the geometry.
Do you understand where the expression for dq came from?

Umm, only in a vague, not-very-useful kind of way. If I rearrange it algebraically I get

wLdq = Qdydz

I interpret this as

(area of charge distribution)*(charge element) = (total charge)*(area element)

which makes perfect sense to me. Two integrals that are equal, just done with respect to different variables, right? But I would never have arrived at that on my own, nor do I immediately see the usefulness.

Simon Bridge
Homework Helper
Rechecks ... hey you're right! The sheet is in the x-y plane.
In that case we have a lot of fun ... the z in #13 should be an x ... what fun!
That will be why you changed the variable name huh?
But at least that makes it easier.

@mindarson - post #13 assumes that the sheet of charge in in the y-z plane.
But your diagram does have it in the x-y plane.

Lets adjust the notation a bit.
See next post.

TSny
Homework Helper
Gold Member
kdq/((y2+z2)3/2)[z e1 - y e2]

IF this is useful (highly dubious), it's not clear to me how. I don't even know what I would use as my length element to multiply by the charge density to sub in for dq. Do I still want to use my original strategy of integrating this initial integral over y on [0,L], then integrating that result over z on an interval such as [x, x+w]?

This looks very good. Write dq in terms of the area of a small piece of a strip.

#### Attachments

• strip 2.png
1.2 KB · Views: 449
Okay, I have pondered the expression for dq in post #13 in light of post #23, and I think I have some understanding of it.

The expression is

dq = (Q/wL)dxdy

so (Q/wL) is just the charge density (per unit area), right?

Simon Bridge
Homework Helper
The reasoning follows the same approach - put the observer at ##\small (x_0,0,0)## to distinguish from the coordinates you are to integrate over.

Then the element at ##\small (x,y,0)## : ##\small 0<x<-w, 0<y<L## has area ##\small dxdy## and charge $$dq=\frac{Q}{wL}dxdy$$
You don't understand why that is?
You are given a surface of area A=wL (width times height) that holds a total charge of Q.
Therefore - what is the charge density?
[edit: you got it! Well done.]

You need this because you need to know the field due to a small element of charge dq that occupies the infinitesimal area dxdy. This replaces the point charge that you first learned to use.

The electric field is given by: $$d\vec{E}=\frac{kdq}{r^3}\vec{r}$$ where ##\small \vec{r}## points from ##\small (x,y,0)## to ##\small (x_0,0,0)##

You'll end up with an equation in terms of ##\small x_0## instead of x. Don't worry about that just yet.
OTOH: if you are following TSny again and it now makes sense - just keep going. ;)

Last edited:
TSny
Homework Helper
Gold Member
Okay, I have pondered the expression for dq in post #13 in light of post #23, and I think I have some understanding of it.

The expression is

dq = (Q/wL)dxdy

so (Q/wL) is just the charge density (per unit area), right?

Right. But since I forced you into writing the width of a strip as dz, you will want to write it as dq = (Q/wL)dydz.

As Simon says, "this is fun".

Using dq = (Q/wL)dzdy, this gives me for my integral (I'm using the z variable as defined by TSny)

E = kQ/(wL)∫1/(y2+z2)3/2(z e1 + y e2)dzdy

(Sorry it's so ugly!)

The integral is clearly a double integral, and I'm thinking the integration limits for dy are 0 and L, while the integration limits for dz are x and x + w, since x ≤ z ≤ x + w.

(x being the horizontal distance from origin to point of interest.)

TSny
Homework Helper
Gold Member
E = kQ/(wL)∫1/(y2+z2)3/2(z e1 + y e2)dzdy

The integral is clearly a double integral, and I'm thinking the integration limits for dy are 0 and L, while the integration limits for dz are x and x + w, since x ≤ z ≤ x + w.

(x being the horizontal distance from origin to point of interest.)

Looks good to me.

Wow, huge thanks to both of you for getting me this far on this problem! 'Kindness of strangers', eh? I've learned some good physics from this discussion.

TSny
Homework Helper
Gold Member
Good. But I just noticed that you now have the e2 component as positive. Is that right?

Good. But I just noticed that you now have the e2 component as positive. Is that right?

No, you're right, it points downwards so should be < 0.


text: JFIF>CREATOR: gd-jpeg v1.0 (using IJ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EQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQE


text:
## Lisp links in org-mode to dynamically generated content

| categories: org-mode | tags: | View Comments

## 1 Converting elisp links to their value on export

Someone asked on the mailing list if it would be possible to replace a lisp expression in org-mode with its value. I thought this should work with the filter system I have been exploring. The idea is to preprocess the org buffer, get all the links, and handle the elisp links specially. Then, we use a filter to replace elisp links with the output we got from preprocessing. We need to have a few different links in this file to make it more obvious what we are doing. For example we do not want this link to be changed. The link to http://orgmode.org should not be changed. But we want a link like elisp:(+ 2 3) to be replaced by 5.

The following text:

This file was exported on [[elisp:(format-time-string "%Y-%m-%d at %H:%m %p")]].

The answer to 2 + 3 is [[elisp:(+ 2 3)]].

Renders like this:

This file was exported on 2013-10-20 at 10:10 AM.

The answer to 2 + 3 is 5.

First, we get the links. If there is an elisp link we set the list value to the value of the link evaluated, otherwise we set it to nil. In the filter, we will replace the output of the link if the value in this list is not nil.

(setq link-list (let ((parsetree (org-element-parse-buffer))
(counter 0))
(content (plist-get plist :content))
(path (plist-get plist :path))
(type (plist-get plist ':type))
(fname (car (last (split-string path "/"))))
)
(if (string-match "elisp" type) (format "%s" (eval (read (plist-get plist :path)))) "nil"))))))

(nil nil 2013-10-20 at 10:10 AM 5 nil)

Now, we have the output of what we want for each link. Now, we will setup the filter, and export this file to a blogpost.

(let ((counter 0))

(setq output text))) ; this was some other kind of link
(setq counter (+ counter 1))
output)

(async nil)
(subtreep nil)
(visible-only nil)
(body-only t)
(ext-plist '()))
(org-html-export-as-html async subtreep visible-only body-only ext-plist))

; now get the output into the org output
(switch-to-buffer "*Org HTML Export*")

(setq HTML (buffer-string))
(setq YAML "---
title: Lisp links in org-mode to dynamically generated content
date: 2013/10/14 22:49:00
updated: 2013/10/20 10:19:00
categories: org-mode
---

")
(with-temp-buffer
(insert YAML)
(insert HTML)

Done.


text:
# Source code for simplestatistics.statistics.bernoulli

from .binomial import binomial

[docs]def bernoulli(p, decimals = 2):
"""
The Bernoulli Distribution_ is, quoting from the Wikipedia page:

The Bernoulli distribution is the probability discrete distribution of a random
variable which takes value 1 with success probability p and value 0 with failure
probability q = 1 - p. It can be used, for example, to represent the toss of a coin,
where "1" is defined to mean "heads" and "0" is defined to mean "tails" (or vice versa).
It is a special case of a Binomial Distribution where n = 1.

.. _ bernoulli distribution: https://en.wikipedia.org/wiki/Bernoulli_distribution

Args:
p: Int or float representing *p* (probability)
decimals: (optional) number of decimal points (default is 2)

Returns:
List of the distribution values for the variable taking values 0, 1.

Examples:
>>> bernoulli(0.5)
[0.5, 0.5]
>>> bernoulli(0.25)
[0.75, 0.25]
>>> bernoulli(0.3)
[0.7, 0.3]
>>> bernoulli(1.1)
Traceback (most recent call last):
...
ValueError: Probability (p) must be between 0 and 1.
"""

if p < 0 or p > 1:
raise ValueError('Probability (p) must be between 0 and 1.')

probabilities = binomial([0, 1], 1, p)
probabilities = [round(x, decimals) for x in probabilities]

return(probabilities)


text:
# dfft¶

## Purpose¶

Computes a discrete Fourier transform.

## Format¶

y = dfft(x)
Parameters: x (Nx1 vector) – Values used to compute the discrete Fourier transform. y (Nx1 vector) – The discrete Fourier transform.

## Examples¶

In this example we will a use a discrete sample of frequencies given by

$f[k] = 5 + 2 * cos(\frac{\pi}{2}k - \frac{\pi}{2}) + 3cos(\pi k)$
// Set k
k = seqa(0, 1, 4);

// Compute discrete frequencies
f_k = 5 + 2 * cos(pi/2*k - 90*pi/180) + 3 * cos(pi*k);

After this f_k is equal to:

8
4
8
0

Now take the discrete Fourier transform of f_k:

// Discrete Fourier transform
print dfft(f_k);

After the code the discrete Fourier transform is printed:

5
0 - 1i
3 + 0i
0 + 1i

## Remarks¶

The transform is divided by $$N$$.

This uses a second-order Goertzel algorithm. It is considerably slower than fft(), but it may have some advantages in some circumstances. For one thing, $$N$$ does not have to be an even power of 2.

dfft.src


text:
# Quantile Regression using Neural Networks (Custom Loss function)

I would like to perform a Quantile Regression within Mathematica's neural network framework.

Since there exist a couple of tutorials for this exact problem in Tensorflow, i.e. Deep Quantile Regression, I know this can be done by defining the right loss function for this particular problem, i.e.

$$\rho_\tau(u)= \max[ u\tau, u(\tau-1)].$$

Then a specific quantile $$\tau$$ can be found by minimizing the expected loss of $$y-f(X)$$ with respect to $$f(X)$$, where $$f(X)$$ is the predicted (quantile) model and $$y$$ is the observed value for the corresponding input $$X$$.

My question then, is it possible to define a custom loss function for NetTrain[], and if so, how can this be done?

An example of the data can be loaded by,

data = Flatten[Uncompress[Import["https://pastebin.com/raw/G2kdCu4i"]]]

Note that in this particular setting the observed values are 3-tuples.

Disclaimer, this is my first time using Mathematica's neural network framework.

• Yes, you can, check the documentation for LossFunction. It can be a little limited however. It might be helpful if you give some example of the output data and the target data. – Carl Lange Oct 12 '18 at 12:41
• @CarlLange I did came across the documentation for LossFunction but it only used built-in layers which threw me off. I also added an example of my data. – user19218 Oct 12 '18 at 13:14
• It looks like your QuantileLossLayer answers your question - you could post it as an answer and close the question! – Carl Lange Oct 12 '18 at 18:08

Going through the documentation of LossFunction it dawned on me that I needed to define a custom Layer via NetGraph, hence

QuantileLossLayer[τ_] := NetGraph[<|

net = NetChain[{8, Tanh, 16, Tanh, 3}];

• What is the net, net? – Anton Antonov Oct 17 '18 at 12:24
• @AntonAntonov net is any neural network you deem fit, but I get your point and added an working example. – user19218 Oct 17 '18 at 18:05