0

I am trying to call the Math.matrix() function, and I am quite certain I am not importing the file correctly into my javascript code. I have read through the StackOverflow question "how to include and use math.js": and given that advice, I have the following :

<HTML >
  <!DOCTYPE html>

  <head>
    <script src=https://cdnjs.cloudflare.com/ajax/libs/mathjs/5.1.1/math.js>
    </script>
    <script  type="text/javascript" >
       function rotate_clockwise(){
          /* code skipped */
          matrix = Math.matrix(matrix, rotationmatrix);
      }
     </script>
   </head>
   <body>
   </body>
</HTML>

where the cdns reference I have taken from this link

But on run when rotate_clockwise is called via slider the chrome 68 debugger states Uncaught type error : Math.matrix is not a function, so I do believe I am not including this file correctly.

My base assumption is that including a file once, in one set of script tags, is enough for any javascript function to use this library, which resides within a different set of script tags.

Thanks so much for any assistance you can provide.

Mayur
  • 2,583
  • 16
  • 28
Jax
  • 23
  • 6

1 Answers1

2

I think you need math.matrix(...)--lower case math since Math is a standard JS library.

johnheroy
  • 416
  • 2
  • 7