I am completely new to Mathematica and I need some help (sorry if it is trivial, but I haven't found the answer). I have this code

K[Q_, n_Integer] := 
  Module[{z, x},
          ComposeSeries[Series[Q[z], {z, 0, n}], Series[x[i] z, {z, 0, n}]], 
          {i, 1, n}], 
      Table[x[i], {i, 1, n}], 
      Table[Subscript[c, i], {i, 1, n}]][[1]]]

Then I evaluate

K[Sqrt[#]/Tanh[Sqrt[#]]&, 8] /. c -> p

The output is a polynomial in p1, p2 ... p8 (in this case) with coefficients written as fractions (23412/7538293, for example). What should I do in order to output the numerator and denominator of each function in it's prime factorization (preferably factor out the common divisor of the denominator)?

  • $\begingroup$ Together will pull out the lcm of the denominators. I'm not sure if that's quite what you want though. $\endgroup$ Mar 3, 2018 at 15:50
  • $\begingroup$ @DanielLichtblau Thank you for this. Is there a way to write the denominator and numerator of each fraction (after the pulling out of lcm) as product of prime numbers (prime factorization)? $\endgroup$
    – Silviu
    Mar 3, 2018 at 18:25
  • $\begingroup$ The method by @BIll looks viable for this. $\endgroup$ Mar 3, 2018 at 19:52


Your Answer

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

Browse other questions tagged or ask your own question.