Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
I am a new Mathcad user. I have a function defined for a scalar input. I have an input 4x6 matrix of scalars. I want an output of another 4x6 matrix of scalars, evaluating the function at each entry of the input matrix. That is:
Output(i,j) := function( Input(i,j) )
I quickly found that just entering the 4x6 input matrix into the function as an argument did not work. I ended up using two for loops to generate the matrix (i.e. evaluating the above equation at each i & j value).
My question is this - is there a single line command to input a non-symmetric matrix into a function for a scalar & get the output I want? Any other ideas or resources for how to do this?
The problem (not that it's really a problem, it actually is a feature!) is that the square operator notes that Input is a matrix and, therefore expects it to be square. Using Mathcad's vectorize operator. This forces the processor to act on each element. You can either vectorize over the function applied to Input, or modify the function to autovectorize (like many of Mathcad's built-in functions, such as cos).
Stuart