I used ChatGPT to create JavaScript code for linear algebra visualsations and it worked… sometimes.

Julian Harris
TheAIEngineer
Published in
4 min readDec 14, 2023

--

UPDATE 18 Dec: OMG over the weekend ChatGPT was upgraded and was able to do this effortlessly. This article has to have the shortest shelf-life of anything I’ve written 🤦‍♂️ — will post update

Here I walk through my experience creating educational visualisations from autogenerated code. I have source code and videos and some tips to help improve the quality of the results in future.

I’m brushing up on some of the foundations of machine learning — some parts I knew, other parts I learnt literally 35 years ago.

The code that created the javascript for the following visualisations was 100% generated by ChatGPT.

Vector projection

To get an intuition for what a vector projection is, I leaned on the idea that it’s essentially a shadow of another vector. So I thought “Can I get ChatGPT to create code to do this?” My approach was basically:

  • Create the visualisation
  • Follow-up: “Make it interactive by adding draggable control handles”

What I learned

It hit the wall unpredictably: you might make initial good progress generating code from a prompt, but it’s unpredictable when it suddenly completely fails to understand.

The curse of the right angle box: in my case I wanted to add a little square box against…

--

--

Julian Harris
TheAIEngineer

Ex-Google Technical Product guy specialising in generative AI (NLP, chatbots, audio, etc). Passionate about the climate crisis.