Making bound variables from loop in Pluto

Hello.
I am attempting to create a Pluto notebook that performs Gaussian elimination on a matrix. I would like the user to insert whatever matrix he desires. What I have done so far is asking the user what are the dimensions of the matrix, and with such information, I intend to create a number of new bound variables that take the elements of the matrix. I have tried creating a for loop that would create the new variables. However, I am having some trouble making it work.
I am thankful for all suggestions on how to do this.
Thank you.

Hey!
I’m not sure what you mean by “the user inserting a matrix”. Can’t they just put it in a code cell? I feel like a slider for each entry is more complicated than necessary?

Hello!
I guess that is an option, but I think it would be more elegant to offer something like in this website: Gauss-Jordan Elimination Calculator
And I wanted to use a text input, not a slider.

Maybe Scrubbable could be good for this?

using PlutoUI

A = rand(3, 4)

@bind m Scrubbable(A; format=".3f")

image

For more fine control, PlutoUI.combine is also great (example modified from the doc example)

using MarkdownLiteral: @mdx

function wind_speeds(directions)
    PlutoUI.combine() do Child
        @mdx """
        <h6>Wind speeds</h6>
        <ul>
        $([
            @mdx "<li>$(name): $(Child(name, Slider(1:100)))</li>"
            for name in directions
        ])
        </ul>
        """
    end
end

image

The inputs can be replaced with TextFields, have extra html styling added, etc. I like this notebook as a showcase of what other UI elements can do: https://featured.plutojl.org/basic/plutoui.jl

4 Likes