Message Boards Message Boards

0
|
3709 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Replace Indeterminate expression ArcTan[0,0] with a value "a"?

Posted 5 years ago

I just started learning Mathematica Kindly help me with this code. My actual Expression is about 300 lines in which I have many ArcTan[exp1,exp2] forms, a solution to the toy problem which framed bellow might help me to solve my actual code issues.

I have a function

f[x1_, x2_] := 
  Cos[x2*ArcTan[x1, x2]] + 
   Sin[x1*ArcTan[x2, x1] + 
      ArcTan[x1^2, x2]]*
    E^ArcTan[x1 + x2, x1] 

For some values of x1 and x2 I will have ArcTan[0,0] form inside f[x1,x2]. My aim is to replace ArcTan[0,0] with a value "a".

What I did is

f[x1_, x2_] := 
  Cos[x2*ArcTan[x1, x2]] + 
   Sin[x1*ArcTan[x2, x1] + 
      ArcTan[x1^2, x2]]*
    E^ArcTan[x1 + x2, x1]

ReleaseHold[f[0, 0] /. ArcTan[0, 0] -> 0]

This is not working

I even tried this

f[x1_, x2_] := 
  Cos[x2*ArcTan[x1, x2]] + 
    Sin[x1*ArcTan[x2, x1] + 
      ArcTan[x1^2, x2]] /. 
   ArcTan[0, 0] -> 0

f[0, 0]

This is not working.
Kindly suggest me a way.

POSTED BY: Navneeth Gummal
2 Replies

The approach with myArcTan will fail if you feed it symbolic coordinates. If you are daring you can directly redefine ArcTan:

Unprotect[ArcTan];
ArcTan[0, 0] = a;
Protect[ArcTan]
POSTED BY: Gianluca Gorni

One way could be to use a custom version of ArcTan:

myArcTan[0, 0] = a;
myArcTan[pt__] := ArcTan[pt]
POSTED BY: Gianluca Gorni
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