Skip to main content
1-Visitor
May 2, 2025
Question

Calling Matrices as input variables to another function

  • May 2, 2025
  • 2 replies
  • 907 views

Software used: Mathcad Prime 10

There are 2 Matrices defined as below:

VN_13282660_0-1746188026159.png 

VN_13282660_1-1746188055148.png


I want to create a function with these 2 matrices as input, to compare the values of 1 matrix to the other.
How can i do this?

I tried doing it like below, But it seems that a function depending on another variable (pnumber or row in this case) cannot be given as an input to another function.
IsParamMatch(RBoM_fixed_params_list(pnumber),RParameter_fixed_params_list(row))

 

2 replies

23-Emerald IV
May 2, 2025

Indeed, you cannot define a function where the parameters to the function are function calls.

But you can define a function where the parameters to the function are function names. So simply define:

IsParam( f1 , f2 ):=if (f1=f2 , <whatever> , <orelse> )

Then you define values for pnumber and row, and you call that function with:

IsParamMatch( RBoM_fixed_params_list(pnumber) , RParameter_fixed_params_list(row) )=

and it will produce <whatever> in case RBoM_fixed_params_list(pnumber) equals RParameter_fixed_params_list(row), and it will produce <orelse> in the other case.

 

For more flexibility you could define:

IsParam( f1 , f2 , p , r ):=if ( f1(p) = f2(r) , <whatever> , <orelse> )

and call it with:

IsParamMatch( RBoM_fixed_params_list , RParameter_fixed_params_list , pnumber , row )=

 

Here's a small example:

LucMeekes_0-1746208168426.png

 

 

Success!
Luc
P.S. You should attach your worksheet...

15-Moonstone
May 4, 2025

Hello!

 

What is "IsEqual"?

 

Best regards,

Sergey

23-Emerald IV
May 4, 2025

The name of the function I defined just below the definition of Fun1 and Fun2.

 

Success!
Luc

Community Moderator
May 9, 2025

Hi @VN_13282660,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag