0
$\begingroup$

So I have factorized a transfer function and stored the terms in a variable. I want to print the product of terms without Mathematica joining them and without a break line. I have managed the first, but I am having the trouble with the second. Here is a small workable example, if someone can help me please.

TFilterListFactorized={{(1.05925 s)/(100324. + 1. s), (1.05925 s^2)/(
  1.00649*10^10 + 100324. s + 1. s^2)}}
    
For[i = 1, i <= Length[TFilterListFactorized], i++,
     For[j = 1, j <= Length[TFilterListFactorized[[i]]] - 1, j++,
      Print[TFilterListFactorized[[i]][[j]], "\[Times]"]
      ];
     Print[TFilterListFactorized[[i]][[-1]]]
     ]

Thank you!

$\endgroup$

2 Answers 2

1
$\begingroup$

If I understand you correctly, you have a list of expressions that are all the factors of a larger expression. And you want to print the product without evaluating it.

One way of doing this is to use "HoldForm":

list={(1.05925 s)/(100324. + 1. s), (1.05925 s^2)/(1.00649*10^10 + 
    100324. s + 1. s^2)};

Times@@(HoldForm/@list)

enter image description here

If you want additionally an "x" between terms:

Row[HoldForm /@ Riffle[list, "x"]]

enter image description here

$\endgroup$
0
$\begingroup$

If you just want a display, something like this might work:

Row[TFilterListFactorized[[1]], "\[Times]"]

Or more generally when the list is longer:

Row[#, "\[Times]"] & /@ TFilterListFactorized

And you could introduce other things like Column or TableForm.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.