How to add math.js to the p5js editor on browser

I need to use math.js to solve a system of equations but I honestly have no clue on how to add the math.js library to the browser editor for p5js. I have already tried creating a new sketch file and copying over the html stuff from the math.js website but that didn’t end up correct and I still can’t use any of it because math is still undefined. I desperately need help with this.



I’m somewhat new to this but I just tried to do what you described.

So, I added math.js to index.html by doing this in the head:

`   <script src="" integrity="sha512-0MC8WeRWoyA1u5N3ssCsJDSbNfw3bjF65BIQ3UTPs9nwaV0fy+JN3FH9PQmYACZOEkQFhUvEP+jIqwOlBjEM9w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>`

And then I tested it by doing this in the body:

  <script type="text/javascript">

It seemed to work.

1 Like

Hello, @TheSynchronomicon and @hsm, and welcome to the Processing Forum!

Please enjoy the discussions here. It’s great to see that you have both just recently arrived to post for the first time, and have already solved a problem! :slight_smile:

Welcome! :wave:t4: Here is a sketch on the p5 Editor that includes math.js and KaTeX for rendering.

1 Like