# Mathy stuff!

**URL:** <https://forum.snap.berkeley.edu/t/mathy-stuff/1252>\
**Category:** Share your Projects\
**Created:** [December 16, 2019, 1:39am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252 "2019-12-16T01:39:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wunder\_wulfe](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/wunder_wulfe/32/1384_2.png) [@wunder\_wulfe](https://forum.snap.berkeley.edu/u/wunder_wulfe)\
**Post date:** [December 16, 2019, 1:39am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/1 "2019-12-16T01:39:07Z")

</div>

Because why not?

 ![](https://cdn.forum.snap.berkeley.edu/original/2X/5/582b6e1e14e48a0c8234cd0e1aafdd445db589f3.png)  
 ![](https://cdn.forum.snap.berkeley.edu/original/2X/0/065d63797a9f589dff82a41a270c8b74f7471fc8.png)  
Will most likely pack a few of these in libraries. CFrames use matrix operations in the background so those would need to include the others.  
Just to invert a matrix, I use over 10 custom blocks multiples times...  
 ![](https://cdn.forum.snap.berkeley.edu/original/2X/7/7644c653986c8b75b8913d7ff720125b537b66b2.png)  
I should probably try and make it a bit more compact.  
Thoughts and suggestions from the mathy people on here accepted. I'm working on adding calculus approximation functions in the near future.

---

<div class="post-metadata">

**Author:** ![legoman3.14](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/legoman3.14/32/2210_2.png) [@legoman3.14](https://forum.snap.berkeley.edu/u/legoman3.14)\
**Post date:** [December 16, 2019, 2:54am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/2 "2019-12-16T02:54:12Z")

</div>

Would you mind sharing the project? It looks really cool so far!

---

<div class="post-metadata">

**Author:** ![wunder\_wulfe](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/wunder_wulfe/32/1384_2.png) [@wunder\_wulfe](https://forum.snap.berkeley.edu/u/wunder_wulfe)\
**Post date:** [December 16, 2019, 3:05am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/3 "2019-12-16T03:05:13Z")

</div>

will add a couple of comments here and there, full of a bunch of unused blocks though.

---

<div class="post-metadata">

**Author:** ![bh](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/bh/32/31580_2.png) [@bh](https://forum.snap.berkeley.edu/u/bh)\
**Post date:** [December 16, 2019, 3:37am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/4 "2019-12-16T03:37:18Z")

</div>

> [@wunder\_wulfe](#):
>
> full of a bunch of unused blocks though.

The "unused blocks" item in the file menu will give you a list from which you can check which ones to delete.

Nice collection. I'd be inclined to make general getters and setters for N-dimensional arrays rather than special casing vectors and matrices. And handle arbitrary length vectors, not just length=3.

You're making tools for a particular set of mathematical problems, which is fine, but I'd prefer fewer blocks in a library that can do all of linear algebra, planning ahead for when you study 12-dimensional string theory. :~)

---

<div class="post-metadata">

**Author:** ![wunder\_wulfe](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/wunder_wulfe/32/1384_2.png) [@wunder\_wulfe](https://forum.snap.berkeley.edu/u/wunder_wulfe)\
**Post date:** [December 16, 2019, 4:08am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/5 "2019-12-16T04:08:11Z")

</div>

Yea I just made it because the most important and useful tools seem to be matrices and vectors. Most things I wanted to do included them, such as machine learning, rendering, and some other computations. I haven't needed to use anything higher than 2D arrays for math so I don't know how to compute any of that.

---

<div class="post-metadata">

**Author:** ![wunder\_wulfe](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/wunder_wulfe/32/1384_2.png) [@wunder\_wulfe](https://forum.snap.berkeley.edu/u/wunder_wulfe)\
**Post date:** [December 16, 2019, 6:00am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/6 "2019-12-16T06:00:36Z")

</div>

Heres the link

> **[Misc Math Components by wunder\_wulfe | Snap! Build Your Own Blocks](https://snap.berkeley.edu/project?username=wunder_wulfe&projectname=Misc%20Math%20Components)**
>
> The Snap! Community. Snap! is a blocks-based programming language built by UC Berkeley and used by hundreds of thousands of programmers around the world.

---

<div class="post-metadata">

**Author:** ![snapenilk](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/snapenilk/32/1947_2.png) [@snapenilk](https://forum.snap.berkeley.edu/u/snapenilk)\
**Post date:** [March 23, 2020, 1:45am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/7 "2020-03-23T01:45:25Z")

</div>

![image](https://cdn.forum.snap.berkeley.edu/original/2X/6/6f1a835763ba38473f086557e67fd2d7b6162c28.png)

---

<div class="post-metadata">

**Author:** ![wunder\_wulfe](https://forum.snap.berkeley.edu/user_avatar/forum.snap.berkeley.edu/wunder_wulfe/32/1384_2.png) [@wunder\_wulfe](https://forum.snap.berkeley.edu/u/wunder_wulfe)\
**Post date:** [March 23, 2020, 1:52am UTC](https://forum.snap.berkeley.edu/t/mathy-stuff/1252/8 "2020-03-23T01:52:35Z")

</div>

Yee, some of the functions have a bit of issues with variable naming bc i copied them over and forgot to make changes. I will eventually come around to fixing these bugs but in the future most of these functions will be rewritten in JavaScript to increase performace in Snap _!_.  
Also to add on to the comment made a while ago, I try to optimize things for specific cases sometimes because it reduces complexity and improves efficiency as well. However, you can still do complex linear algebra with the matrix and vector library I added there. I have not added anything to get determinants though.
