Message Boards Message Boards

0
|
6216 Views
|
9 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Change ComplexInfinity in 1/0 to Infinity?

Posted 8 years ago

Good day, everyone I have a problem in Mathematica 9.0 For example, I determine function:

f[x_] = ArcTan[1/Sin[x]]

but result of f[0] is:

Indeterminate

because result of 1/Sin[0] is ComplexInfinity. How I can change it(ComplexInfinity) to Infinity.

POSTED BY: Oskar S
9 Replies
Posted 8 years ago

And what about functions where i don't know in what point i have 1/0. Is it possible to change the Wolfram Mathematica rule. I mean, is it possible to force Wolfram Mathematica to count 1/0=Infinity not 1/0=ComplexInfinity?

POSTED BY: Oskar S

you can use replace after your computation:

expression /. ComplexInfinity[___] :> Infinity
POSTED BY: Sander Huisman
Posted 8 years ago

It's pitty but it does not work, for example: Tan[1/0] /. ComplexInfinity[___] :> Infinity

POSTED BY: Oskar S

Sorry about that:

Tan[(1/0) /. ComplexInfinity :> Infinity]

now it should work.

But this does not make much sense; it's asking basically to compute Exp[1/0], which, to my mind, makes little sense...

For the ArcTan case use the two-argument version to avoid division by zero:

ArcTan[0, 1]
POSTED BY: Sander Huisman
Posted 8 years ago

Thank you very much!

POSTED BY: Oskar S

I would recommend to add a special case:

f[x_] := ArcTan[1/Sin[x]]
f[0] := Limit[ArcTan[1/Sin[x]], x -> 0, Direction -> -1]

so it handles the singularity as it should (you can change the direction to 1 to approach the singularity from the other side.

POSTED BY: Sander Huisman

Mathematica version 11 is supposed to take care of singularities when plotting. For previous versions you can use Exclusions:

Plot[ArcTan[1/Sin[x]], {x, -3 Pi, 3 Pi}, Exclusions -> {Sin[x] == 0}]
POSTED BY: Gianluca Gorni

One way could be with Piecewise:

f[x_] = Piecewise[{{Infinity, Sin[x] == 0}, {ArcTan[1/Sin[x]], True}}]

It depends on what you are going to do with this function. Numerics? Symbolics? Graphics?

POSTED BY: Gianluca Gorni
Posted 8 years ago

Thank you very much. My problem is that i get function f[x] after solving some equations (Solve function). And this function generally f[x]=ArcTan[g[x]/Sin[x]]. Then i need to get some plots and animations of function contain function f[x] and derivatives of f[x]. And i have problems in points Pi*k because of Indeterminate

POSTED BY: Oskar S
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract