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.
2 Likes
Hi,
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="https://cdnjs.cloudflare.com/ajax/libs/mathjs/10.1.1/math.js" 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">
console.log(math.sqrt(-4).toString())
</script>
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!
Welcome! Here is a sketch on the p5 Editor that includes math.js and KaTeX for rendering.
1 Like