4
$\begingroup$

I have

y[x_] := 1/Sqrt[2] (5 - x - Sqrt[8 - (x + 1)^2])
{x0, x1} = {-1 - Sqrt[8], -1 + Sqrt[8]};

and I want to calculate

{y'[x0], y'[1], y'[x1]}

but Mathematica cannot evaluate the left and right values, nor can Limit.

What is the proper syntax/method to get the answer {-Infty, 0, Infty}?

$\endgroup$
5
  • $\begingroup$ Limit[y'[z], z -> #] & /@ {x0, 1, x1} gives {-\[Infinity],0,(-I) \[Infinity]} $\endgroup$
    – kglr
    Aug 1, 2019 at 22:52
  • $\begingroup$ I get {Indeterminate, 0, Indeterminate} for the above command. I use version 11.2.0.0. $\endgroup$
    – mf67
    Aug 1, 2019 at 23:06
  • $\begingroup$ mf67, it works in v9. In v12 I also get {Indeterminate, 0, Indeterminate} $\endgroup$
    – kglr
    Aug 1, 2019 at 23:09
  • $\begingroup$ So I might have to wait for next major update to get a v9-result? Using {y'[x0 + 10.^-5], y'[1], y'[x0 - 10.^-5]} to try to "go around" the problem I get {-266.621, 0, -0.707107 + 265.915 I}. Is there some way to have only real values returned? $\endgroup$
    – mf67
    Aug 1, 2019 at 23:16
  • $\begingroup$ mf67, i posted an answer that works in v12. $\endgroup$
    – kglr
    Aug 1, 2019 at 23:21

1 Answer 1

10
$\begingroup$

You can use Limit with the option Direction:

MapThread[ Limit[y'[z], z -> #, Direction -> #2] &, 
 {{x0, 1, x1}, {"FromAbove", "TwoSided", "FromBelow"}}]

{-∞, 0, ∞}

Much simpler form (from mf67's comment below):

Limit[y'[z], z -> {x0, 1, x1}, Direction -> {"FromAbove", "TwoSided", "FromBelow"}]

same result

$VersionNumber

12.

$\endgroup$
3
  • 1
    $\begingroup$ The older syntax (for people using older versions) goes like MapThread[Limit[y'[z], z -> #, Direction -> #2] &, {{x0, 1, x1}, {-1, 0, 1}}] $\endgroup$ Aug 2, 2019 at 7:58
  • 1
    $\begingroup$ I'm trying to understand the command. I got the same result with Limit[y'[z], z -> {x0, 1, x1}, Direction -> {"FromAbove", "TwoSided", "FromBelow"}]. What are the differences compared to the original MapThreadcommand? $\endgroup$
    – mf67
    Aug 2, 2019 at 9:46
  • $\begingroup$ @mf67, the difference is my ignorance of the fact that Limit is Listable:) $\endgroup$
    – kglr
    Aug 2, 2019 at 9:49

Your Answer

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

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