1
$\begingroup$

Running the code:

Series[Sinc[x], {x, 0, val}] /. val -> 10

Gives the error

Series::serlim: Series order specification val is not a machine-sized integer. >>

The help file says that instead of val, I shouldn't be using a symbol but an integer. But I want val because I need to apply two values.

Series[Sinc[x], {x, 0, val}] /. val -> {10, 20}

Which I can't.

I did try to use Refine and thus tell Mathematica that its an integer but it didn't work.

Refine[Series[Sinc[x], {x, 0, val}], Element[val, Integers]] /. val -> 10

Any suggestions about how I can do it without running it twice?

$\endgroup$
  • 3
    $\begingroup$ Series[Sinc[x], {x, 0, 20}] // {# + O[x]^11, #} & $\endgroup$ – ciao Aug 24 '16 at 6:34
  • 1
    $\begingroup$ Try Quiet[Series[Sinc[x], {x, 0, val}]] /. Map[{val -> #} &, {10, 20}] $\endgroup$ – Daniel Lichtblau Aug 24 '16 at 15:24
2
$\begingroup$

What you want is the following

Unevaluated[Series[Sinc[x], {x, 0, val}]] /. val -> 10

But still it does not work for a list of values as Series does not thread over list. So in order to be able to use it for multiple arguments you need something like

Series[Sinc[x], {x, 0, #}]& /@ {10,20}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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