Group Abstract Group Abstract

Message Boards Message Boards

5
|
182 Views
|
24 Replies
|
17 Total Likes
View groups...
Share
Share this post:
GROUPS:

[WSG26] Daily Study Group: Creative Computation

Posted 11 days ago

A Wolfram U Daily Study Group on Creative Computation begins on May 18th 2026.

Join me, Eryn Gillam, and a group of fellow learners to learn how to use Wolfram Language in creative ways. Our topics for the study group include creating computational art, computational poetry, audio visualization, and building two types of video games. Along the way, we'll learn how to code effectively in Wolfram Language.

No prior Wolfram Language experience is required.

Please feel free to use this thread to collaborate and share ideas, materials, and links to other resources with fellow learners.

Dates

May 18th-22nd

11am-12:30pm CT (4-5:30pm GMT)

Register Here

enter image description here

POSTED BY: Rory Foulger
24 Replies

I recalled this morning that there is a series of beautiful GIFs by a mathematician-artist making artistic representations of mathematics with Mathematica (usually with Manipulate[] and posted with a GIF). Check out the "Staff Picks" of Clayton Shonkwiler:

https://community.wolfram.com/web/claytonshonkwiler

POSTED BY: Michael Rogers
Posted 2 days ago

Yikes! Spent quite a few hours yesterday wrestling with a DynamicModule problem (or at least I thought it was) before writing it up to ask the experts at mathematica.stackexchange.com. Whereupon I was almost immediately informed that a particular ; should have been a , and that was my entire problem.

Syntax counts! Even just a single dot! Code carefully!

(And of course this error has a lot to do with years of programming in languages that use ; as a separator or statement terminator, which is not the Wolfram Language way ...)

(BTW Evaluation > Analyze Notebook seems useful but didn't catch this error.)

POSTED BY: David Bakin

Part of the problem with finding syntax errors is that many combinations of symbols in WL are syntactically correct. Further, {a; b, c} produces {b, c}, and it's hard to tell whether that was or was not intentional. I've sometimes done it on purpose, when a calculates something needed for b. Sometimes a; {b, c} is equivalent. However, in the case x = {a; b, c}, then x = a; {b, c} is not equivalent; one needs parentheses: x = (a; {b, c}) or a different order a; x = {b, c}.

It's hard to know on a syntax level which of these is an error. One needs to understand the semantics of a, b, etc. and how they relate to the whole code. I'm not sure how deeply "Analyze Notebook" goes into the code. It gives me a green check on many usage problems highlighted in red by the syntax highlighter. Maybe adding a rule that an element of a List[] that has the head CompoundExpression is a potential bug would be a good idea. I wouldn't be surprised if more often it's a bug than intentional. AI might do a better job, since it has gotten pretty good at semantics.

POSTED BY: Updating Name

That "Updating Name" = me. :)

POSTED BY: Michael Rogers

There was no reason to trouble the StackExchange folks. Claude caught that error instantly. You can see Claude's response here. I think that's the takeaway here. It's useful to be stuck for a while, but I'd put a limit of about 15 minutes before asking an AI.

Syntax counts! Even just a single dot! Code carefully!

The semicolon is the short form of CompoundExpression, which specifies a particular sequentiality for a bunch of expressions. If you were using the full form of the function, it think it have stuck out like a sore thumb. Note Claude's advice on where to use a ";" in the Wolfram Language here.

POSTED BY: Phil Earnhardt

An EventHandler[] toy: 25 particles (circles) interact with each other. They eventually settle down into some sort of flow, with the occasional random circle deciding they like someone else. Click and drag to move one and upset the status quo.

DynamicModule[{
  n = 25, (* number of pts (constant) *)
  pts,
  drag = {} (* index of pt being dragged *)
  },
 pts = RandomReal[{-1, 1} 25/Sqrt[3 n], {n, 2}];
 EventHandler[
  Deploy@Graphics[ (* Deploy[] turns off the usual Graphics interactions *)
    Dynamic@GraphicsComplex[ (* efficient way to manage a figure that is a function of points *)
      pts = (* move[] the points, except the one being dragged *)
       ReplacePart[pts + move[pts], # :> MousePosition["Graphics"] & /@ drag],
      {Hue[#/n], Sphere[#, 0.7/Sqrt[n]]} & /@ Range[n]],
    PlotRange -> 25/Sqrt[n]
    ],
  (* mouse up/down: de/register which point is to be dragged *)
  {"MouseDown" :> (drag = Nearest[pts -> Automatic, MousePosition["Graphics"]]),
   "MouseUp" :> (drag = {})}
  ],
 Initialization :> ( (* define how the points move *)
   ClearAll[move];
   (* it returns changes in position for each point in the list p *)
   move[p_List] := Module[{$n, interaction},
     $n = Length[p];
     interaction = Array[
         Function[{row, col},
          Exp[-Abs[(row - col)/4] + 0.5 UnitStep[row - col] - 0.25]]
         , {$n, $n}
         ]/(IdentityMatrix[n] + DistanceMatrix[p])^2 // Function[mat,
        DiagonalMatrix[Total[mat] - 0.01 $n] - mat];
     0.2*(interaction . p)
     ];)
 ]

I would have posted a cloud notebook, but it didn't render. Maybe Dynamic[] doesn't work so well there?

POSTED BY: Michael Rogers
Posted 2 days ago

Nice! Reminds me of this youtube channel: Alexander Gustafsson - these would be reasonable to set up in Mathematica (though I wonder how well it would scale interactively, you could certainly generate high quality videos)

POSTED BY: David Bakin

Rory said carte blanche today that his Pacman-like video game will not run off of the cloud. If you looked at my cloud code showing Rope Flow under a monolith, the animation is quite squirrelly. The 3D cursor won't change the perspective of the frame until you PAUSE the moving ball.

I am looking at using CDF (Computable Document Format) for deploying some code. It runs against the Wolfram Player, which is basically a read-only version of the Wolfram Language. Wolfram has de-emphasized this approach over the last few years, but it's still viable. Apparently, users balked at downloading the multi-GB Wolfram Player.

Claude has some suggestions on how to make Dynamic viable. You can just put your whole block of code in and have Claude stick in its suggestions. Their code generation is much improved from 6 months ago.

This is a super little interactive example.

POSTED BY: Phil Earnhardt
Posted 3 days ago

Quiz 5 Problem 1 seems incorrect - my guess is the 4th choice ("D") is backwards from what was intended. No?

POSTED BY: David Bakin

I don't think the staff want to talk about particular quiz answers. For what it's worth, I also tend to think there's something wonky about that question. OTOH, there is value in deeply understanding the difference between == and ===; that's the real point of the question.

You reminded me of one nice feature of the Wolfram Documentation. You can enter any function shortcut into the search panel at the top of the documentation (e.g., ===, @@@, @, etc.) and the documentation will give you the Full Form of that function shortcut and go to the appropriate documentation page.

If you have Wolfram Language installed in your local machine, it's incredibly useful to have the documentation also installed. Each page in the documentation is a full live Wolfram Language Notebook, and you're more than welcome to start actively evaluating expressions in the middle of any documentation page. There's something deeply Stephen Wolfram about that; I could imagine him doing that when he's typing in Notebooks for hours every day. It almost feels like cheating.

POSTED BY: Phil Earnhardt
Posted 3 days ago

Absolutely, the local doc option - with live notebook pages! - is great. One improvement would be if the doc notebook window was tabbed so you could quickly flip between multiple ones. Or maybe it is and I just don't know how to do it. (I do know about the tiny "history" downarrow.)

POSTED BY: David Bakin

I've never seen tabbed notebooks, but Documentation`HelpLookup[""] or Documentation`HelpLookup["SameQ"] will bring up a new, additional help notebook.

I've sometimes opened two help browsers by accident, too, just doing ordinary cmd-F or menu actions. I don't why it sometimes does that. It doesn't happen often. It may have been a bug in a particular version.

POSTED BY: Michael Rogers
POSTED BY: Phil Earnhardt
POSTED BY: Michael Rogers
Posted 3 days ago
POSTED BY: Updating Name
Posted 3 days ago

Post on "The King's Speech" was mine - for some reason the forum didn't attribute it to me.

POSTED BY: David Bakin

The "updating name" bug is a long-standing one in the Wolfram Community software. It's some sort of race condition in the code. It's been around for many years; you'll find numerous entries with that handle in discussions that have lots of postings (like the WSG discussions). It should be fixable, but the bug appears to be tolerated. There was a discussion about bugs and desired features in the community.wolfram.com software in another discussion here Thanks to Wolfram U student @Tingting Zhao for that discussion.

A legitimate question is why Wolfram Research doesn't just transition over to licensing and using Discourse. I don't know the answer to that; I've never seen any staff address the question. I tried to ask in a couple of live Q&A sessions, but my questions were ignored. This discussion software does have some magic so that embedded Notebooks are available as Wolfram Cloud objects, but (AFAIK) that should be eminently doable as a Discourse plugin. My main guess: it simply isn't a priority. Long-standing users here learn to cope with the community.wolfram.com limitations. IMHO, the main casualty is newbies in Wolfram U courses, who have to learn a non-Discourse messaging system on top of learning the Wolfram Language from scratch. I hope the community software is refreshed, but I really don't expect anything to change. I have empathy for anyone who is confused by this idiosyncratic messaging software.

In the mean time, newbies will occasionally encounter the "updating name" bug and will get a confusing error message if they dare try to enter an emoji into the discussion. I fondly hope they ignore the "updating name" glitch and adapt to avoiding emojis -- or use OG ASCII Art for their emojis. It's definitely a First World Problem -- maybe even a Zeroth World Problem. ;-)

POSTED BY: Phil Earnhardt

We hear you. Good things are coming up!

POSTED BY: Ahmed Elbanna
Posted 4 days ago

I did the Computational Poetry project (yesterday) a bit differently - I jumped into assuming you'd want to generate a lot of haikus from that template - 100s or 1000s. I dunno, maybe your actual goal is writing a program to evaluate an haiku to see if it makes sense, give it a score for symbolism. Whatever. Anyway, I compute all possible replacements first and then use those to generate haiku rapidly.

Notebook is here on Wolfram Cloud - download it and evaluate it locally.

Computing (and caching) the set of all valid replacements, in the first cell, takes ~2m elapsed time on my laptop. Then use 2nd cell's Manipulate to generate as many random haiku as you like. (Evaluate locally because it seemed to take forever in the cloud, before I killed it.)


(BTW, is it just me or are the "free response" quiz items useless and frustrating for others too? You can never answer them correctly. They're frustrating because you then go into the next quiz, knowing how useless they are, and answer it anyway, hoping for the best. But no, still impossible to get the correct answer. Even when copying the answer from the Wolfram documentation! I hit this on each and every webinar, and now of course this study group. Geez, Wolfram, just give up on them already.)

POSTED BY: David Bakin

I extended the project a bit and replaced everything. Well, except "the" since the entity type "Determiner" had a random (grammatical) number, and I could not determine the number in WL; and "to", which is an infinitive marker, not a preposition. Another problem is than RandomWord[type] sometimes comes up with words that cannot be of the type, except in the sense that in English most words can be used metaphorically as most parts of speech. And sometimes in the cloud, the random word generation is too slow for the time limits in the cloud. Of course, random words generate nonsense, but sometimes it's fun.

POSTED BY: Michael Rogers
Posted 5 days ago
POSTED BY: David Bakin

Inspired by class today...

A couple of things:

  • The image data has three numbers in a list {r, g, b} that represent a color. RGBColor @@ {r, g, b} yields the color RGBColor[r, g, b].
  • It turns out that the position of a color datum in the data is flipped from the usual graphics coordinates: Horizontal and vertical positions are switched, and the vertical position increase from top to bottom instead of from the bottom up. That's the reason for the odd matrix multiplication ({{0, 1},{-1, 0}}).position.

The code layers dots on top of each other, decreasing in radius from maxRadius pixels down to 1 pixel. The color for each dot corresponds to the color of the pixel in the image at the center of the dot. Layering the smaller dots on top allows the resolution to improve. Lots of things to play with: how the radii change, how large the disks, how many disks — all affect the texture, identifiability. You can play with the color space to get a reddish tiger by replacing Extract[data, position]] with Clip[RotationMatrix[-Pi/3, {1,1,1}].Extract[data, position]].

POSTED BY: Michael Rogers
POSTED BY: Michael Rogers
Posted 10 days ago

I've been doing Rope Flow for about 10 years. It's a means of moving laterally with a jump rope without jumping over the rope. Here is a sample of the Rope Flow "Dragon Roll" from an instruction video on YouTube. I'm marking the middle and endpoints of my rope with distinct bright colors and will make a short slow-motion video of the "Dragon Roll" this weekend. I'll use the Wolfram Language's simple motion-tracking capability and try to plot the rope's motion in 3D. Next, I'll see if the WL can identify the 3D curve of the "Dragon Roll". Based on the figure-eight (i.e., lemniscate) shadow of the path, I've got a pretty good guess what the path might be. That Mathworld entry even mentions my guess. We shall see. :)

This is a marvelous STEM application. Students learn about sine waves in geometry and more advanced HS math classes. The "Dragon Roll" allows them to stand under and make sinusoidal waves -- front-back, left-right, and up-down -- all at the same time.

You can see the component sine waves by orienting this Wolfram 3D graphic to various sides. The monolith is in the center to represent how the rope criss-crosses over the flow-roper. Note: you can only change the 3D orientation if the animation is not playing. I apologize for the janky animation of the red ball. I need to figure out how to make it smoother when running off of a cloud computer. You can download the Notebook or just copy the expression into your local version of Mathematica.

We learn Rope Flow moves by imitating someone else. That starts with awkward movements, but our CNS rapidly smoothes and polishes the movement. You don't have to know diddly about math to do Rope Flow, but it adds a delightful dimension to the game. If my creative computation works, it can be a great launching point for other computational explorations of ropes and sine waves I think that captures the spirit of what Rory and Eryn teach with this course.

If this works, I may reach out to a couple of the Rope Flow schools to show them the idea. I'm looking forward to [reviewing] Rory's Creative Computation class next week.

POSTED BY: Phil Earnhardt
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard