10 ms·
Penrose – Create diagrams by typing notation in plain text
- TibbityFlanders 3y ago[dead]
- jw1224 3y agoHow do I see the notation? The diagrams sure look beautiful, but I must be missing something obvious… Thanks!
- cassianoleal 3y agoOn the header, "Learn Penrose" and "Documentation" seem to link to pages with what you want.
- vanjajaja1 3y agoI just noticed there are 3 tabs for a diagram - substance style domain. This seems too hard to use by person, but I look forward to seeing this plugged into chatgpt
- xigoi 3y agoIt’s sad how artificial “intelligence” is making people immediately give up at just the thought of having to learn something.
- vanjajaja1 3y agoI'm not against learning things, I'm against learning how to fiddle with css to make a diagram. that is not the right tool for the job imo, i want something i can use to knock out diagrams with quickly and easily. canva & excel are already passable
- xigoi 3y agoDifferent use case. The separated model of Penrose is great if you want multiple diagrams with the same style, but different data.
- Gualdrapo 3y agoMy MetaPost-ed head hurts a bit while looking at three different files to generate one drawing - can't help it, MetaPost feels like writing in prose. Can't tell if they share the same syntax, but it's interesting that most of it looks like CSS with superpowers
- sestep 3y agoTrue! Splitting every single diagram into three files feels quite heavy. For Penrose version 4.0, we're planning to combine all our DSLs into one so that they can be mixed together in one file.
- sstanfie 3y agoPenrose looks great. Beautiful diagrams and readable code. What are some other text-driven diagramming languages / tools? I know of: https://mermaid.js.org/ https://mermaid.js.org/ https://graphviz.org/ https://graphviz.org/ https://flowchart.fun/ https://flowchart.fun/
- gmuslera 3y agoAnother approach may be https://google.github.io/typograms/ https://google.github.io/typograms/ Anyway, I think that mermaid.js have an advantage there in a lot of environments as it is supported by a lot of markdown renderers, I would like that ChatGPT one does that too.
- seized 3y agoD2 Lang is a nice one: https://d2lang.com/ https://d2lang.com/
- asah 3y agoI assume the future is an LLM where you specify everything in plain english...
- doubloon 3y agoyup but ... right now things are in a bit of a primitive state. i have tried a lot of stuff with the ChatGPT Wolfram integration and it just fails all kinds of ways. its really cool when it works, but a lot of time it just gets really confused and cannot do basic things like "make that line black instead of red"
- Grimblewald 3y agoit already works really well with gpt4+mermaid.
- abdullahkhalids 3y agoTikz
- adaszko 3y ago
- fatherzine 3y agogreat look, decent code. examples at https://penrose.cs.cmu.edu/try/?examples https://penrose.cs.cmu.edu/try/?examples each example has three tabs: .substance => data .style => low level 2d vector art .domain => data ranges heavy lifting done by .style, random fragment: forall repeatable Element a; Element b; Element c where IsProduct( a, b, c ) { shape productShape = Rectangle { center: ( b.u, c.v ) width: a.width - global.boxPadding height: a.height - global.boxPadding cornerRadius: 2.0 fillColor: a.boxColor } shape productText = Equation { string: a.label center: productShape.center fontSize: "8px" fillColor: a.labelColor } }
- dang 3y agoRelated: CMU’s ‘Penrose’ Turns Complex Math Notations into Illustrative Diagrams (2020) - https://news.ycombinator.com/item?id=31632841 https://news.ycombinator.com/item?id=31632841 - June 2022 (1 comment) Penrose: From mathematical notation to beautiful diagrams - https://news.ycombinator.com/item?id=29674986 https://news.ycombinator.com/item?id=29674986 - Dec 2021 (21 comments) CMU’s ‘Penrose’ Turns Complex Math Notations into Illustrative Diagrams - https://news.ycombinator.com/item?id=23430282 https://news.ycombinator.com/item?id=23430282 - June 2020 (48 comments) Penrose: From mathematical notation to beautiful diagrams - https://news.ycombinator.com/item?id=23387687 https://news.ycombinator.com/item?id=23387687 - June 2020 (19 comments) Penrose: Create diagrams by typing mathematical notation in plain text - https://news.ycombinator.com/item?id=23130646 https://news.ycombinator.com/item?id=23130646 - May 2020 (30 comments) Penrose: Create diagrams by typing mathematical notation in plain text - https://news.ycombinator.com/item?id=20036776 https://news.ycombinator.com/item?id=20036776 - May 2019 (39 comments) Penrose: create diagrams by typing mathematical notation in plain text - https://news.ycombinator.com/item?id=18178230 https://news.ycombinator.com/item?id=18178230 - Oct 2018 (48 comments)
- sestep 3y agoAlso our Penrose 3.0 release post from July 2023: https://news.ycombinator.com/item?id=36746047 https://news.ycombinator.com/item?id=36746047
- podiki 3y agoOh, I thought these would be to create spacetime diagrams. As in Penrose Diagrams: https://en.wikipedia.org/wiki/Penrose_diagram https://en.wikipedia.org/wiki/Penrose_diagram
- westurner 3y agoFor Penrose spacetime diagrams I found xhorizon [1] and einsteinpy [2] 1: https://github.com/xh-diagrams/xhorizon https://github.com/xh-diagrams/xhorizon 2: https://github.com/einsteinpy/einsteinpy/issues/480 https://github.com/einsteinpy/einsteinpy/issues/480 There's a 'spacetime' GH topic: https://github.com/topics/spacetime https://github.com/topics/spacetime /? spacetime diagrams site:github.com : https://www.google.com/search?q=spacetime+diagrams+site%3Agithub.com https://www.google.com/search?q=spacetime+diagrams+site%3Agi...
- westurner 3y agoAlso there there's Penrose graphical notation aka Tensor Diagrams: https://en.wikipedia.org/wiki/Penrose_graphical_notation https://en.wikipedia.org/wiki/Penrose_graphical_notation : > In mathematics and physics, Penrose graphical notation or tensor diagram notation is a (usually handwritten) visual depiction of multilinear functions or tensors proposed by Roger Penrose in 1971.[1] A diagram in the notation consists of several shapes linked together by lines. Penrose graphical notation (tensor diagram notation) of a matrix product state of five particles The notation widely appears in modern quantum theory, particularly in matrix product states and quantum circuits. In particular, Categorical quantum mechanics which includes ZX-calculus is a fully comprehensive reformulation of quantum theory in terms of Penrose diagrams, and is now widely used in quantum industry. > The notation has been studied extensively by Predrag Cvitanović, who used it, along with Feynman's diagrams and other related notations in developing "birdtracks", a group-theoretical diagram to classify the classical Lie groups.[2] Penrose's notation has also been generalized using representation theory to spin networks in physics, and with the presence of matrix groups to trace diagrams in linear algebra. (From a post about Tensor Networks this week: https://news.ycombinator.com/item?id=38922467 https://news.ycombinator.com/item?id=38922467 )
- 3y ago
- BarbaryCoast 3y agoWhat's wrong with Pic? Been around for decades.
- a2800276 3y agoPic is wonderful! I think what's lacking the most is modern tool integration. It more or less requires troff which is itself somewhat deprecated. I've always thought that extracting pic as standalone tool with ~modern output objects would be a nice project for once I quit being lazy :)
- schemescape 3y agoDoes this require a browser (or browser engine) for rendering (like Mermaid.js)? Or can it render (esp. to SVG) without a browser (like Graphviz)? Penrose appears to be written in TypeScript, so my assumption is that it needs a browser.
- blobcode 3y agoIt looks like the CLI tool (@penrose/roger) just depends on a few npm packages with no browser engine and supports SVG export.
- schemescape 3y agoLooks like that depends on the “canvas” package, which appears to use Cairo/Pango for text, similar to Graphviz. This is great! I wanted something I could compile (the native code) to WebAssembly for use in a Deno-based SSG, and this looks promising.
- jayknight 3y ago> roger is a command-line tool for generating diagrams from Penrose trios and serving local files to a local editor. https://penrose.cs.cmu.edu/docs/ref/using https://penrose.cs.cmu.edu/docs/ref/using
- Otternonsenz 3y agoI think they were working on an Obsidian plug-in at some point, and got some primitive functionality up, but don’t know what the state of that is currently. So possible rendering point, though I guess falls under browser engine
- nipperkinfeet 3y agoThats pretty cool. Ran out of memory on my browser though.
- sestep 3y agoYeah, this is unfortunately a big pain point right now. Every time you click "compile" we allocate a new Wasm memory to use for running the optimizer. But garbage collectors in current browsers get confused when there are lots of these large Wasm memories floating around; I'm not entirely sure why, but I think it's because the GC engine doesn't correctly conceptualize how big the Wasm memories actually are, so they don't try to collect them as aggressively as they should. We're currently seeing if we can alleviate this issue by reusing the Wasm memory from compile to compile, but that's a bit tricky in the presence of concurrency (we're also trying to move computation from the main thread into a web worker). In future versions, we might try to sidestep this issue by just using the new Wasm GC that landed in Chrome recently, but for that we'd probably have to wait a bit longer until it's also supported in, e.g., mobile Safari.
- pixelpoet 3y agoCG hipsters have been enjoying Keenan Crane's diagrams long before he made a proper tool for it :)
- pottekkat 3y agoI have always found "diagrams as code" tools to be limiting. There will be that scenario where the generated diagram is not what you expected. The flexibility you get by using code is outweighed by these limiting scenarios. I switched to Mermaid.js but ended up switching back to normal diagramming tools because of these limitations.
- plagiarist 3y agoMermaid.js is pretty great, but I agree you usually get to something that doesn't express nicely. I was hoping to find a graph language I might be able to tweak into a DSL. Mermaid is easy to onboard and get things done with but then it didn't quite cover what I wanted to achieve.
- wodenokoto 3y agoWhat’s a “normal” tool in this case?
- laserbeam 3y agoI also find them limiting if I want to diagram something from my brain. However I found them splendid for drawing logs, the internal state of my software, or other data. Sometimes it's great to just printf() stuff in a format that can be drawn.
- 3y ago
- charlieyu1 3y agoAbsolutely no idea how it works. How do you control the position of points without inputting coordinates? For example, how does one make an image similar to this? https://math.stackexchange.com/questions/1109967/problem-involving-2-right-triangles-trigonometry https://math.stackexchange.com/questions/1109967/problem-inv...
- badgemaker 3y ago[dead]
- sanjeetsuhag 3y agoThis is the type of thing I want to use AI for. Beautiful tool, but this looks daunting.
- greggsy 3y agoI've used ChatGPT to generate chart wireframes in Mermaid. Basically 'create a mermaid chart for the whole year'. Not exactly the same as data viz, but it worked for my use case, and cut out a heap of stuffing around and googling.
- antimora 3y agoYeap there is ChatGPT for this.
- IOT_Apprentice 3y agoIt would be interesting to see someone like Wes Bos build an LLM from end to his graph packages.
- dukeofdoom 3y agoMaybe if AI learns enough graphing, it can figure out why the Amish live longer, Could be huge for humanity.
- TrackerFF 3y agoThese days I just use ChatGPT for my LaTeX documents. Works great.
- sestep 3y agoYeah, definitely a fair critique. Actually, we have been researching the usage of LLMs to generate Penrose diagrams! We presented a poster on this at SPLASH 2023 in October: https://2023.splashcon.org/details/splash-2023-Posters/14/Generating-Domain-Specific-Programs-for-Diagram-Authoring-with-Large-Language-Models https://2023.splashcon.org/details/splash-2023-Posters/14/Ge... I'm not sure if Rijul updated his poster before the conference, but here's a photo of it from a different poster session in August (hopefully this Discord media link works): https://cdn.discordapp.com/attachments/1136758988751503381/1136759803117580349/IMG_2671.jpg https://cdn.discordapp.com/attachments/1136758988751503381/1...
- desireco42 3y agoI feel like a lot of people are not aware of the tools that are available and they keep building the same thing over and over... or, the other amazing thing missing a feature and this thing now has this feature but lacks completeness of other etc, etc... Which means we are doing two things bad: composability and informing us. What do you think?
- xigoi 3y agoWhat tools were already available for this?
- softfalcon 3y agoThis feels like the LaTeX version of Mermaid.js [0]. I can do anything with it, but I gotta learn a lot of new syntax. So, really cool! Gonna have to dig into this. [0] https://mermaid.js.org/ https://mermaid.js.org/
- aljgz 3y agoIs there any tool to make animated diagrams by declaring them in code?
- eigenket 3y agoYou can do animations with PGF/tikz, the problem is you can do everything with PGF/tikz and so the whole thing is a bit of a chaotic mess. The diagrams are beautiful but the code makes me very sad.
- bmitc 3y agoProcessing? https://processing.org/ https://processing.org/ Or do you specifically mean mathematical diagrams and a DSL specifically for that?
- thrdbndndn 3y agoI failed to see how it is "plain text". The code in all three tabs looks like, well, code to me.
- lastdong 3y agoCode is plain text, as opposed to binary for example
- a2800276 3y agoIt's plain text in the generally accepted definition [1] of the term. It's not a binary file that requires special software to author. It's possible to read and write the files in a text editor. "Plain text" does not imply "natural language description", though I can see the term could be confusing. [1] https://en.m.wikipedia.org/wiki/Plain_text https://en.m.wikipedia.org/wiki/Plain_text
- low_tech_punk 3y agoBased on its UI, is there some physics simulation and procedural generation involved? What does that slider represent?
- laserbeam 3y agoI looked at a random example [1], and this needs heavy rework if it needs to work as an example. I'm scared to look at other examples. - The second half of the 900 line style file is commented out code. Ugh. Should I be learning from examples or reviewing code when I read this? - The end if the style file define/replaces coordinates which are not defined in the substance file. Why? Isn't it the point that a substance file has all the data? All coordinates and whatnot? Overall, it does look cool. I like the idea of distinct substance/style/domain files. I probably won't give it a spin until it looks rock solid from a distance. [1]: https://penrose.cs.cmu.edu/try/?examples=walk-on-spheres/SignedAngleOutside https://penrose.cs.cmu.edu/try/?examples=walk-on-spheres/Sig...
- deleted 3y ago[deleted]
- hardmath123 3y agoA lot of replies here are missing the key idea behind Penrose: that the "substance" and "style" of any mathematical diagram are separable. For example, the "substance" of a diagram might be a collection of sets with known subset relationships: Set A, B, C IsSubset(B, A) IsSubset(C, A) That same substance can then be rendered in many different styles, e.g. as a Venn diagram or as a tree diagram (substance vs. style is a lot like HTML vs. CSS). Importantly, Penrose's vision is that experts will author libraries of domains and styles, and end-users need only express the substance of their diagrams (i.e. the three lines of code above). The second beautiful idea in Penrose is that diagram generation is expressed as a constrained optimization problem. This lets you easily experiment with layouts by writing constraints and sampling a variety of potential diagrams via stochastic search. These two ideas set Penrose apart from most other diagram software out there. I really hope it gains wider adoption. Give it a try!
- xigoi 3y ago> substance vs. style is a lot like HTML vs. CSS Given the popularity of frameworks like TailwindCSS, it seems that people here don’t understand the advantage of separating HTML and CSS either, so I’m not sure if this analogy is helpful…
- coldtea 3y agoOr that they understand it just fine, but don't think it has a particular advantage worth the extra complexity tradeoff.
- mewpmewp2 3y agoI think graphs are quite different from HTML. The "substance" in html is far too chaotic compared to the structured data for the graphs.
- frutiger 3y agoThe substance in HTML is literally an annotated rooted tree (a subset of the complexity afforded by a graph).
- jhoechtl 3y agoI did take a look at the gallery. Penrose is no alternative for the majority of diagrams I can do with mermaid or D2, right? It's more about "mathematical" diagrams instead of ER, UML or EPKs right?
- volemo 3y agoYes, I think it’s more of an alternative to MetaPost. That said, I’m intrigued how these two compare?
- shrx 3y agoThe caffeine example is laughable. https://penrose.cs.cmu.edu/try/?examples=structural-formula/molecules/caffeine https://penrose.cs.cmu.edu/try/?examples=structural-formula/...
- xigoi 3y agoWhat is laughable about it?
- jugoetz 3y agoIt's completely, utterly wrong. To point out just one problem, the two central rings should be planar. Good thing they picked this one to show in the landing page carousel. That example was enough for me to close the page again.
- shrx 3y agoThe displayed structure has nothing to do with how it really looks like [0]. It seems they just used a naive algorithm for automatic atom placement with a goal to minimize overlaps between the atoms. [0] https://en.wikipedia.org/wiki/Caffeine https://en.wikipedia.org/wiki/Caffeine
- bmitc 3y agoThat naive algorithm isn't even good since it can clearly be laid out without any edge crossings.
- sestep 3y agoBy the way, just for clarity, note that the comments in this subthread were written before we updated the random seed for that example to result in a much better diagram: https://github.com/penrose/penrose/commit/134533830dab25642a153b60112f6f310622a247 https://github.com/penrose/penrose/commit/134533830dab25642a...
- sestep 3y agoYeah :( To be honest, I think we got a bit overeager about this one, since none of us on the project are chemistry experts. At least for the front page, we should probably replace that with a different diagram from our registry. I think this is actually a fairly deep issue with our approach where we try to express everything in terms of numerical optimization, pairwise energies on shapes, etc. Especially since Style is not a Turing-complete programming language and also doesn't support calling out to existing libraries written in, e.g., JavaScript, there isn't a way to do actually-correct layout of the caffeine molecule, so instead we do the "lazy" thing and just try to make the atoms not overlap. To anyone who actually knows what a caffeine molecule looks like, obviously this looks ridiculous. In the same vein as the other HN comment about separation of substance and style, I think we could do a much better job on chemistry diagrams by actually placing the atoms where they should be in 3D space, then projecting onto a 2D SVG diagram. To illustrate what I mean, consider this other diagram in our registry, showing a methane combustion reaction: https://penrose.cs.cmu.edu/try/?examples=structural-formula/reactions/methane-combustion https://penrose.cs.cmu.edu/try/?examples=structural-formula/... As you can see on that example, the methane molecule looks weird because all the bonds are drawn "below" the carbon atom, and the carbon dioxide molecule is all bent out of shape. In contrast, by just writing a bit of Python code, you can make the diagram both easier to specify https://github.com/samestep/diagrams/blob/3d7fe855b3a9634d17b2ddb54819c192f8f23454/combustion.py#L382-L387 https://github.com/samestep/diagrams/blob/3d7fe855b3a9634d17... (compared to the 70-line Penrose Substance file) and also more correct: https://raw.githubusercontent.com/samestep/diagrams/2c8fb3345cf34331abe87b8010b04352c0bdf7d9/combustion.svg https://raw.githubusercontent.com/samestep/diagrams/2c8fb334... I think that a general-purpose text-based diagramming tool needs to support a variety of different layout engines.
- b800h 3y agoIs this actually affiliated with Roger Penrose? Seems extraordinarily rude to use his name otherwise. Was his permission sought? In fact, this may be seen as "passing off" in English law.
- lifthrasiir 3y agoYou can say the same thing to Haskell, Curry, Ada or (more or less) Python as well.
- b800h 3y agoNeither Ada Lovelace nor Haskell Curry is still alive. And Python is in a different category. It's one thing to use the name of a historical figure, quite another to use the recognisable mark of a living person. Of course, it could all be being done with endorsement, in which case, my comment is invalid, but otherwise it's incredibly rude and a borderline civil tort.
- lifthrasiir 3y agoI also believe that passing off requires a demonstration of a substantial amount of probable damage in the future. The mere existence of a graphical software named Penrose can't do much harm. (If you name a malware after Penrose, that may be the case though.)
- b800h 3y agoWhat about if the software is faulty?
- TeMPOraL 3y agohttps://en.wikipedia.org/wiki/Penrose_(surname) https://en.wikipedia.org/wiki/Penrose_(surname) https://en.wikipedia.org/wiki/Penrose https://en.wikipedia.org/wiki/Penrose There's enough other Penroses to choose from; sir Roger doesn't own the (sur)name.
- yihengx 3y ago[dead]
- kuon 3y agoNice. I often use pgf tikz but the syntax is very convoluted. I like how Penrose separate substance from the rest.
- deleted 3y ago[deleted]
- syngrog66 3y agohow does Penrose compare to GraphViz and its "dot" syntax?