MWE- Minimum Working Example steps guide

raman_kumar
Sun, 28 Sep 2025 14:54:26 +0000
Teaching & Outreach

Suggest steps to write Minimum Working Example.

When we post an issue here on Discourse. Often helpers want MWE (minimum working example) that reproduces same error or results. For many of us writing a MWE is usually tough.

DATA- Often our code is using some data. Data can be constant, ascending, descending or random and can be created using Single- and multi-dimensional Arrays · The Julia Language

Constant data

fill(9,(2))     # to create 1d data with 9 at two places
fill(5,(2,3))      # to create 2d matrix having 5 everywhere
fill(8,(2,3,5))
fill("text",(2,3))     # text can also be created

Ascending data

range(start=23, stop=209, length=20)     # data will 20 values  starting from 23 and go up to 209
range(start=23, stop=209, step=5)     # [23, 28, 33, 38, ...] data will start from 23 adding 5 each time and can go up to 209

Descending data

range(start=23, stop=-209, length=20)    # It will output 20 values between 23 and -209
range(start=23, stop=-209, step=-5)    # [23, 18, 13, 8, ....-207]

Random data

rand(Int, 7)
rand(Float32, (2, 3))       # create 2x3 matrix of random Float32
rand(Float16, (3,5,2))       # create 3x5x2 matrix of random Float16

PS: You can copy good content/suggestions of other’s post in your post and i will mark best post as solution.

2 posts - 2 participants