# Question in Derivatives and TableForm

Using the TableForm command, I want to find the derivatives up to the fourth order of the function $$f(x)=\cos{x^2}/x$$ and give the results in Matrix form.

• Exactly what Mathematica code did you use? Was it this? TableForm[Table[D[Cos[x]^2/x,{x,n}],{n,1,4}]] Why do you need this in any "Form" Often using "Form" causes more trouble, not less, but I realize that many feel they MUST desktop publish their result. Exactly what did you do and Exactly what is wrong with it and Exactly what do you really have to have?
– Bill
Nov 27, 2022 at 20:13
• My friend alwyas check Wolfram Doc to learn how to use functions reference.wolfram.com/language/ref/Table.html Also the best way ever to learn coding is to try and practice it!!!! Nov 27, 2022 at 20:16

Many ways to do this. One is

f[x_] := Cos[x^2]/x
TraditionalForm[D[f[x], {x, #}]]} & /@ Range[4];
Grid[data, Frame -> All]


You did not say if this is for display only or not. If you want to use the data, then you can remove the Grid part. If it is for display only, you can also use TeXForm and MaTeX to make nice Latex table with caption title and figure numbers to include in your latex document so you can reference the table from other places in the document.

Clear["Global*"]

f[x_] := Cos[x^2]/x


Using MatrixForm (note that the "forms" are not included in the scope of the definition of mat)

(mat = NestList[{#[[1]] + 1, Simplify[D[#[[2]], x]]} &, {0, f[x]},


Using TableForm

TableForm[mat,


Using FoldList while calculating derivs in addition to mostly borrowed formatting techniques:

f[x_] := Cos[x^2]/x
n = 5;
derivs = FoldList[D[#, x] &, f[x], Range[n]];
ops = TraditionalForm@HoldForm[Derivative[#][f][x]] & /@ Range[0, n];
data = Transpose@{TraditionalForm /@ Range[0, n], ops,
`