Inspiration

I'm really bad at multiplying matrices. Like, really bad at it. In talking about it with my peers I've come to find that it gives everyone a bit of trouble. Is it rows times columns or the other way around? And I add the two numbers and then multiply everything together, right? In one of my conversations we started asking ourselves why matrices weren't taught to us as younger children. If it was introduced in elementary school matrices would be second nature by now, and it's not like matrix multiplication is some new foreign thing, it's just multiplication and addition in specific orders. As a result of this conversation, I decided to make a tool to help teach and provide practice for matrix multiplication.

What it does

In it's current state, MatrixMasters will generate a matrix multiplication problem, take the user's input, and tell them if the answer they provided was correct or not.

How I built it

I built this app using swiftui and xcode

Challenges I ran into

I worked a lot with swiftui last summer in trying to learn how to make apps. As is such, I was super rusty at first, and I had to work at it for a bit before I got back into the swing of things.

Other than that I had two major challenges throughout working on this project. One, the issue of updating views. I had originally had the user input field visible at all times and wanted for the user to be able to change the number of rows and columns while it was visible. However I was not able to figure out how to get it to update while on screen. This also ended up applying to the generated matrices. To fix this problem and maintain functionality, I added buttons the user could use to reset and then re-render the views, updating their properties to either have the correct number of rows or to have new contents. Second, I struggled a bit to make some of the views into abstractions. This is something that I've struggled with in the past as well. I know that it is good practice to make structs outside of the main body so as to keep things organized, readable, and reusable. However, I've always had trouble linking state variables in to these structs. Then, in trying to troubleshoot my matrixEntry struct, I found out that you can initialize a struct with a _ binding _ to a state variable rather than just the value, fixing the issue.

Accomplishments that I'm proud of

I was actually really really happy to have solved my abstraction issue. With this knowledge, I can go on to make code that's sooo much more organized that what I have written in the past. I'm also pretty proud of my implementation of matrices and their operations. I've always been interested in computational mathematics (at least, on a recreational level), so it was neat to see that I could write the functionality needed to do manipulations with matrices.

What I learned

I learned a lot about the process of connecting and abstracting structs both internally and externally. I also learned that I need to figure out a better way to update views based on changing states (which I have a hunch also has to do with bindings). Finally, I also saw practical examples of unwrapping and optional coalescing.

What's next for MatrixMasters

There is still a lot of functionality to be added to MatrixMasters. It stands now as a proof of concept, but in the future there is so much I would like to add to it.

First, there are a few things I would want to add to the functionality that the app currently has. This includes things like setting a difficulty level, adding an optional timer and score tracker, and a help button that could give a refresher on the steps to take or maybe walk through the steps for a specific problem. Then, outside of what is there now, I would want to make an exhaustive tutorial going over how to do dot products and matrix multiplication so that people could use this as a learning tool as well as something to practice with. To this end I would also want to add other matrix operations such as addition, determinants, and inverses complete with their own tutorials and practice tools. Finally, because I am a true believer in gamification, I would want to wrap all of this up in some sort of single player campaign with levels and achievements, possibly even adding multiplayer for users to really test their skill with matrices.

Built With

Share this project:

Updates