Skip to content

Commit

Permalink
add thermodynamic-potentials-venn-diagram.typ
Browse files Browse the repository at this point in the history
add generative-adversarial-network.typ converted from TikZ
  • Loading branch information
janosh committed Jan 29, 2025
1 parent f027092 commit ad4ffc7
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#import "@preview/cetz:0.3.2": canvas, draw

#set page(width: auto, height: auto, margin: 8pt)

#canvas({
import draw: line, content, circle, group, hobby, on-layer

// Style definitions
let node-style = (
stroke: none,
fill: rgb("#66B2B2"), // teal!60 equivalent
radius: 0.53,
)
let arrow-style = (
stroke: black + 0.8pt,
mark: (end: "stealth", scale: 0.4, fill: black),
)
let (y-real, y-fake) = (2, 0)
// Draw nodes
// z_in node
circle((0, y-fake), name: "zin", ..node-style)
content("zin", $arrow(z)_"in"$)
// x_fake node
circle((3, y-fake), name: "fake", ..node-style)
content("fake", $arrow(x)_"fake"$)
// x_real node
circle((3, y-real), name: "real", ..node-style)
content("real", $arrow(x)_"real"$)
// x node (discriminator input)
circle((6, y-real / 2), name: "D", ..node-style, radius: 0.4)
content("D", $arrow(x)$)
// Output node
content((9, y-real / 2), text(size: 0.9em, baseline: -1pt)[real?], name: "out", padding: 2pt)
// Draw arrows and their labels
// Generator input arrow
line((-2.5, y-fake), "zin", ..arrow-style, name: "zin-line")
content("zin-line.mid", $p_theta (arrow(z))$, anchor: "south", padding: 0.1)
content("zin-line.mid", text(size: 0.8em)[latent noise], anchor: "north", padding: 0.1)
// Generator arrow
line("zin", "fake", ..arrow-style, name: "fake-line")
content("fake-line.mid", $G(arrow(x))$, anchor: "south", padding: 0.1)
content("fake-line.mid", text(size: 0.8em)[generator], anchor: "north", padding: 0.1)
// Real data arrow
line((-2, y-real), "real", ..arrow-style, name: "real-line")
content("real-line.mid", $p_"data" (arrow(x))$, anchor: "south", padding: 0.1)
// Connection points with names
circle((4.5, y-fake), radius: 0.06, fill: black, name: "dot1")
circle((4.5, y-real), radius: 0.06, fill: black, name: "dot2")
on-layer(
1,
circle((4.25, 2 * y-real / 3), radius: 0.12, fill: orange, stroke: none, name: "dot3"),
)
// Draw connecting lines with names
line("fake", "dot1", ..arrow-style, name: "conn1")
line("real", "dot2", ..arrow-style, name: "conn2")
line("dot3", "D", ..arrow-style, name: "conn3")
// Draw dashed curve using named points
hobby(
"dot1",
(4.2, (y-real - y-fake) / 2),
"dot2",
stroke: (dash: "dashed"),
omega: 2,
name: "dashed-curve",
)
// Discriminator arrow and labels
line("D", "out", ..arrow-style, name: "disc-line")
content("disc-line.mid", $D(arrow(x))$, anchor: "south", padding: 0.1)
content("disc-line.mid", text(size: 0.8em)[discriminator], anchor: "north", padding: 0.15)
})
8 changes: 4 additions & 4 deletions assets/otto-cycle/otto-cycle.typ
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
}

// Add point labels
content((a.at(0), a.at(1) + 0.3), [1])
content((b.at(0) + 0.3, b.at(1)), [2])
content((c.at(0) + 0.3, c.at(1)), [3])
content((d.at(0) - 0.3, d.at(1)), [4])
content(a, [1], anchor: "south", padding: (bottom: 5pt))
content(b, [2], anchor: "west", padding: (left: 5pt))
content(c, [3], anchor: "north-west", padding: (left: 5pt))
content(d, [4], anchor: "east", padding: (right: 5pt))

// Draw cycle paths with arrows and labels
// a -> b (adiabatic expansion)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#import "@preview/cetz:0.3.2"
#import "@preview/cetz-venn:0.1.3": venn3

#set page(width: auto, height: auto, margin: 8pt)

#cetz.canvas({
import cetz.draw: content, circle, scale

// Scale up the diagram
scale(2.5)

// Create Venn diagram with three overlapping circles
venn3(
name: "venn",
a-fill: blue.transparentize(40%), // Mechanical (blue)
b-fill: red.transparentize(40%), // Thermal (red)
c-fill: green.transparentize(40%), // Chemical (green)
ab-fill: purple.transparentize(40%), // Overlap
bc-fill: yellow.transparentize(40%), // Overlap
ac-fill: teal.transparentize(40%), // Overlap
abc-fill: gray.transparentize(70%), // Center
)

// Add outer labels for main potentials
content("venn.a", [Mechanical\ $F_[mu] = -P V$], anchor: "center", name: "mechanical")
content("mechanical.south", text(.8em)[(Grand\ potential)], anchor: "north", padding: (top: 4pt))

content("venn.b", [Thermal\ $H_[mu] = T S$], anchor: "center")

content("venn.c", [Chemical\ $G = mu N$], anchor: "center")

// Add labels for overlapping regions
content(
"venn.ab",
text(.8em, align(center, $U_[mu] =\ T S - P V$)),
anchor: "center",
offset: (0, 0.3),
)

content(
"venn.abc",
text(.8em, align(center, $U = T S -\ P V + mu N$)),
)

content(
"venn.ac",
align(center, $F =\ -P V + mu N$),
anchor: "center",
offset: (-0.3, -0.3),
)

content(
"venn.bc",
align(center, $H =\ T S + mu N$),
anchor: "center",
offset: (0.3, -0.3),
)

// Add outer circle label
content((0, 1.6), $G_[mu]$)
content((0, 1.4), text(.8em)[(Gibbs-Duhem)])
circle(
(0, 0),
radius: 1.75,
fill: rgb(70%, 70%, 90%, 20%),
stroke: rgb(0%, 0%, 0%),
)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
title: Thermodynamic Potentials Venn Diagram
description: |
A Venn diagram illustrating the relationships between thermodynamic potentials, forces, and flows. The diagram shows three main regions (Mechanical, Thermal, Chemical) and their intersections, representing different thermodynamic potentials. The subscript μ denotes an N-to-μ Legendre transform of the indicated potential (U, H, F, or G). The diagram helps visualize how different thermodynamic quantities are related through Legendre transforms.
citation: |
R. K. P. Zia, Edward F. Redish, and Susan R. McKay, "Thermodynamic Venn diagrams: Sorting out forces, fluxes, and Legendre transforms," American Journal of Physics 79, 950 (2011). DOI: 10.1119/1.3599177
tags:
- thermodynamics
- statistical mechanics
- physics
- venn diagram
- legendre transform
- potentials
- forces
- fluxes

authors:
- R. K. P. Zia
- Edward F. Redish
- Susan R. McKay
Loading

0 comments on commit ad4ffc7

Please sign in to comment.