# Define the output of PadeApproximant as a function

I am trying to do

pad[t_] := PadeApproximant[t Log[t], {t, 1, {2, 1}}]
pad[t] // Simplify //Factor
pad
Plot[pad[t], {t, 0, 1}]


The last two lines do not work. Why? How to fix them?

• Try = instead of := or use Evaluate in pad[t_] := Evaluate[PadeApproximant[..]]. – Michael E2 Mar 19 at 1:50
• If you're wondering why that suggestion of @MichaelE2 works, it's because := does not evaluate its right hand side before substituting. So it substitutes 1 verbatim into PadeApproximant[t Log[t], {t, 1, {2, 1}}] , to get PadeApproximant[1 Log, {1, 1, {2, 1}}], which doesn't make any sense to Mathematica. By using =, you evaluate the rhs first, and then 1 gets substituted into the output of PadeApproximant[t Log[t], {t, 1, {2, 1}}]. – thorimur Mar 19 at 4:07
• @thorimur: I did. Thank you for the explanation. – Hans Mar 19 at 6:25

## 1 Answer

Conversion of comments to a community wiki answer:

Michael E2:

Try = instead of := or use Evaluate in pad[t_] := Evaluate[PadeApproximant[..]].

thorimur:

If you're wondering why that suggestion of @MichaelE2 works, it's because := does not evaluate its right hand side before substituting. So pad substitutes 1 verbatim into PadeApproximant[t Log[t], {t, 1, {2, 1}}], to get PadeApproximant[1 Log, {1, 1, {2, 1}}], which doesn't make any sense to Mathematica. By using =, you evaluate the rhs first, and then 1 gets substituted into the output of PadeApproximant[t Log[t], {t, 1, {2, 1}}].