To be able to edit code and run cells, you need to run the notebook yourself. Where would you like to run the notebook?

This notebook takes about 4 minutes to run.

In the cloud (experimental)

Binder is a free, open source service that runs scientific notebooks in the cloud! It will take a while, usually 2-7 minutes to get a session.

On your computer

(Recommended if you want to store your changes.)

  1. Copy the notebook URL:
  2. Run Pluto

    (Also see: How to install Julia and Pluto)

  3. Paste URL in the Open box

Frontmatter

If you are publishing this notebook on the web, you can set the parameters below to provide HTML metadata. This is useful for search engines and social media.

Author 1
👀 Reading hidden code
using Symbolics: @variables
7.0 s
👀 Reading hidden code
using LaTeXStrings
199 μs
MIME type text/latex
👀 Reading hidden code
m = MIME"text/latex"()
40.9 μs
r (generic function with 1 method)
👀 Reading hidden code
r(x) = repr(m, x) |> Text
426 μs

Don't render $this$ as latex

👀 Reading hidden code
html"""
<p>Don't render $this$ as latex</p>
"""
116 μs

world

👀 Reading hidden code
a = L"world"
30.3 ms

hello$world

👀 Reading hidden code
b = L"hello $world$"
60.0 μs

hello$world$asdf

👀 Reading hidden code
c = L"hello $world$ asdf"
37.1 ms
👀 Reading hidden code
r(a), r(b), r(c)
33.1 μs
👀 Reading hidden code
using JuMP
❔
WARNING: using JuMP.@variables in module workspace#4 conflicts with an existing identifier.
58.6 s
@variables d e f
👀 Reading hidden code
68.4 ms

d

d
👀 Reading hidden code
9.7 μs
$$ \begin{equation}
d
\end{equation}
 $$
r(d)
👀 Reading hidden code
87.6 μs
A JuMP Model
├ solver: none
├ objective_sense: MAX_SENSE
│ └ objective_function_type: AffExpr
├ num_variables: 2
├ num_constraints: 5
│ ├ JuMP.AffExpr in MOI.LessThan{Float64}: 1
│ ├ JuMP.VariableRef in MOI.GreaterThan{Float64}: 2
│ └ JuMP.VariableRef in MOI.LessThan{Float64}: 2
└ Names registered in the model
  └ :con, :x, :y
g = let
g = Model()
@variable(g, 0 <= x <= 2)
@variable(g, 0 <= y <= 30)
@objective(g, Max, 5x + 3 * y)
@constraint(g, con, 1x + 5y <= 3)
g
end
👀 Reading hidden code
5.0 s
Error message

MethodError: no method matching show(::IOBuffer, ::MIME{Symbol("text/latex")}, ::JuMP.Model)

Closest candidates are:

show(::IO, ::AbstractString, ::Any) at /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/base/multimedia.jl:111

show(::IO, ::MIME{Symbol("text/csv")}, ::Any) at /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/DelimitedFiles/src/DelimitedFiles.jl:829

show(::IO, ::MIME{Symbol("text/tab-separated-values")}, ::Any) at /opt/hostedtoolcache/julia/1.7.3/x64/share/julia/stdlib/v1.7/DelimitedFiles/src/DelimitedFiles.jl:830

...

Stack trace

Here is what happened, the most recent locations are first:

  1. __binrepr(m::MIME{Symbol("text/latex")}, x::JuMP.Model, context::Nothing)
  2. _textrepr(m::MIME{Symbol("text/latex")}, x::JuMP.Model, context::Nothing)
  3. repr(m::MIME{Symbol("text/latex")}, x::JuMP.Model; context::Nothing)
  4. repr(m::MIME{Symbol("text/latex")}, x::JuMP.Model)
  5. r(x::JuMP.Model)
    r(x) = repr(m, x) |> Text
  6. Show more...
uhmmmmmm??!
r(g)
👀 Reading hidden code
---

Hello math how are

you?

h = md"""

Hello $math$ how are

```math
you?
```
"""
👀 Reading hidden code
7.9 ms
<div class="markdown"><p>Hello <span class="tex">$math$</span> how are</p>
<p class="tex">$$you?$$</p>
</div>
repr(MIME"text/html"(), h) |> Text
👀 Reading hidden code
45.4 ms