MATLAB: Log(log(1+a*x))

taylor expansion error

syms x a;
f=log(log(1+a*x));
y=taylor(f,x)
error
Error using symengine
Cannot compute a Taylor expansion of the input.
Error in sym/taylor (line 128)
tSym = mupadmex('symobj::taylor',f.s,x.s,a.s,options);

Best Answer

You do not specify an expansion point so it assumes you want to expand around x = 0. It needs to calculate f(x_initial) as the first term of the taylor expansion. f(0) is log(log(1+a*0)) which is log(log(1)) which is log(0) which is -inf .
The next term involves diff(f) evaluated at 0, which is a/(log(a*x + 1)*(a*x + 1)) a/(log(a*0+1)*(a*0+1) which is a/(log(1)*1) which is a/0 which is sign(a)*inf . If taylor assumes sign(a) is positive, then the first two terms would involve -inf + inf which is indeterminate.
You need to expand around non-negative point.
Related Question