<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Extract the argument of a trig function</title>
    <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Thu, 11 Jun 2026 07:53:06 GMT</lastBuildDate>
    <pubDate>Thu, 11 Jun 2026 07:53:06 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Extract the argument of a trig function</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Extract the argument of a trig function</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function</link>
    </image>
    <item>
      <title>selectfun</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function?ref=Feed:MaplePrimes:Extract the argument of a trig function:Comments#answer75553</link>
      <itunes:summary>If y is your expression:

var:=op(op(selectfun(y,arctan)));</itunes:summary>
      <description>If y is your expression:

var:=op(op(selectfun(y,arctan)));</description>
      <guid>75553</guid>
      <pubDate>Mon, 24 Sep 2007 14:58:26 Z</pubDate>
      <itunes:author>djc</itunes:author>
      <author>djc</author>
    </item>
    <item>
      <title>patmatch</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function?ref=Feed:MaplePrimes:Extract the argument of a trig function:Comments#answer75551</link>
      <itunes:summary>Here's an approach to this problem that does not use any op's.

&lt;pre&gt;
restart;
y := A+B*arctan(x);
                            y := A + B arctan(x)
patmatch( y, a::anything+b::anything*arctan(x), 's' );
                                    true
s;
                               [b = B, a = A]
assign( s );
a,b;
                                    A, B
unassign( 'a', 'b' );
a,b;
                                    a, b
y2 := (x^2+3)+sin(x)*cos(x)*arctan(x);
                          2                              
                    y2 = x  + 3 + sin(x) cos(x) arctan(x)
patmatch( y2, a::anything+b::anything*arctan(x), 's' );
                                    true
s;
                       [                            2]
                       [b = sin(x) cos(x), a = 3 + x ]
assign( s );
a,b;
                                 2               
                            3 + x , sin(x) cos(x)


&lt;/pre&gt;

Note that if you do assign values to the names used in the patmatch command then you will need to unassign them before they can be used in another patmatch.

You can get much fancier with the arguments to patmatch, if you so choose. See the online help for complete details.

Does this fit your needs?

Doug
&lt;pre&gt;
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
&lt;/pre&gt;</itunes:summary>
      <description>Here's an approach to this problem that does not use any op's.

&lt;pre&gt;
restart;
y := A+B*arctan(x);
                            y := A + B arctan(x)
patmatch( y, a::anything+b::anything*arctan(x), 's' );
                                    true
s;
                               [b = B, a = A]
assign( s );
a,b;
                                    A, B
unassign( 'a', 'b' );
a,b;
                                    a, b
y2 := (x^2+3)+sin(x)*cos(x)*arctan(x);
                          2                              
                    y2 = x  + 3 + sin(x) cos(x) arctan(x)
patmatch( y2, a::anything+b::anything*arctan(x), 's' );
                                    true
s;
                       [                            2]
                       [b = sin(x) cos(x), a = 3 + x ]
assign( s );
a,b;
                                 2               
                            3 + x , sin(x) cos(x)


&lt;/pre&gt;

Note that if you do assign values to the names used in the patmatch command then you will need to unassign them before they can be used in another patmatch.

You can get much fancier with the arguments to patmatch, if you so choose. See the online help for complete details.

Does this fit your needs?

Doug
&lt;pre&gt;
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
&lt;/pre&gt;</description>
      <guid>75551</guid>
      <pubDate>Mon, 24 Sep 2007 16:47:40 Z</pubDate>
      <itunes:author>Doug Meade</itunes:author>
      <author>Doug Meade</author>
    </item>
    <item>
      <title>no op</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function?ref=Feed:MaplePrimes:Extract the argument of a trig function:Comments#answer75548</link>
      <itunes:summary>Thank you djc and Doug.

I can not quite see how patmatch extracts x from A+B*arctan(x) where x is any expression.  Am I missing something?

My original interest in this came from a wish to express 
arctan(A/B) as arctan(A,B)

where A and B are any expressions. 

I should have asked that specfically.</itunes:summary>
      <description>Thank you djc and Doug.

I can not quite see how patmatch extracts x from A+B*arctan(x) where x is any expression.  Am I missing something?

My original interest in this came from a wish to express 
arctan(A/B) as arctan(A,B)

where A and B are any expressions. 

I should have asked that specfically.</description>
      <guid>75548</guid>
      <pubDate>Mon, 24 Sep 2007 18:47:32 Z</pubDate>
      <itunes:author>brian abraham</itunes:author>
      <author>brian abraham</author>
    </item>
    <item>
      <title>not well defined</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function?ref=Feed:MaplePrimes:Extract the argument of a trig function:Comments#answer75546</link>
      <itunes:summary>Brian,

First, let me apologize for misreading your original message.

The question as you have refined it does not have a unique solution. What should be returned for arctan( -1 )? Do you want arctan( -1, 1 ) or arctan( 1, -1 )? Even positive arguments cause problems: arctan( 1 ) = arctan( 1, 1 ) and arctan( 1 ) = arctan( -1, -1 ).

What do you know about the arguments to arctan? Are they always numeric? Are they always a fraction?

Depending on your answers to the above, it's still possible to use patmatch to come close to what you are describing.
&lt;pre&gt;
&gt; y := arctan(11,15);
                                         /11\
                              y := arctan|--|
                                         \15/
&gt; patmatch( y, arctan(AB::rational), 's' );
                                    true
&gt; s;
                                  [     11]
                                  [AB = --]
                                  [     15]
&gt; [numer,denom]( eval( AB, s ) )[];
                                   11, 15
&gt; arctan( [numer,denom]( eval( AB, s ) )[] );
                                       /11\
                                 arctan|--|
                                       \15/

&gt; 'arctan'( [numer,denom]( eval( AB, s ) )[] );
                               arctan(11, 15)
&lt;/pre&gt;
Unfortunately, Maple will automatically convert the two argument arctan to a one argument arctan.

The above works only when the argument to arctan is a numerical fraction. This idea could be modified for arguments of a different form. I hope this gives you some (useful) ideas.

Doug
&lt;pre&gt;
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
&lt;/pre&gt;</itunes:summary>
      <description>Brian,

First, let me apologize for misreading your original message.

The question as you have refined it does not have a unique solution. What should be returned for arctan( -1 )? Do you want arctan( -1, 1 ) or arctan( 1, -1 )? Even positive arguments cause problems: arctan( 1 ) = arctan( 1, 1 ) and arctan( 1 ) = arctan( -1, -1 ).

What do you know about the arguments to arctan? Are they always numeric? Are they always a fraction?

Depending on your answers to the above, it's still possible to use patmatch to come close to what you are describing.
&lt;pre&gt;
&gt; y := arctan(11,15);
                                         /11\
                              y := arctan|--|
                                         \15/
&gt; patmatch( y, arctan(AB::rational), 's' );
                                    true
&gt; s;
                                  [     11]
                                  [AB = --]
                                  [     15]
&gt; [numer,denom]( eval( AB, s ) )[];
                                   11, 15
&gt; arctan( [numer,denom]( eval( AB, s ) )[] );
                                       /11\
                                 arctan|--|
                                       \15/

&gt; 'arctan'( [numer,denom]( eval( AB, s ) )[] );
                               arctan(11, 15)
&lt;/pre&gt;
Unfortunately, Maple will automatically convert the two argument arctan to a one argument arctan.

The above works only when the argument to arctan is a numerical fraction. This idea could be modified for arguments of a different form. I hope this gives you some (useful) ideas.

Doug
&lt;pre&gt;
---------------------------------------------------------------------
Douglas B. Meade
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu/~meade/
&lt;/pre&gt;</description>
      <guid>75546</guid>
      <pubDate>Mon, 24 Sep 2007 20:50:48 Z</pubDate>
      <itunes:author>Doug Meade</itunes:author>
      <author>Doug Meade</author>
    </item>
    <item>
      <title>simpler extraction with typematch</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function?ref=Feed:MaplePrimes:Extract the argument of a trig function:Comments#answer75545</link>
      <itunes:summary>patmatch can be quite flaky, indets and typematch are safer.  Just for robustness, I would use
&lt;pre&gt;extract := proc(expr)
    local atans;
    atans := convert(indets(expr, 'arctan(anything)'), list);
    map2(op, 1, atans);
end proc;
&lt;/pre&gt;

This uses op, and that is what most Maplers would do.  Now, without op:
&lt;pre&gt;extract := proc(expr)
    local atans;
    atans := convert(indets(expr, 'arctan(anything)'), list);
    map(proc(aa) local arg; typematch(aa, 'arctan'(arg::anything)); arg; end, atans);
end proc;
&lt;/pre&gt;
</itunes:summary>
      <description>patmatch can be quite flaky, indets and typematch are safer.  Just for robustness, I would use
&lt;pre&gt;extract := proc(expr)
    local atans;
    atans := convert(indets(expr, 'arctan(anything)'), list);
    map2(op, 1, atans);
end proc;
&lt;/pre&gt;

This uses op, and that is what most Maplers would do.  Now, without op:
&lt;pre&gt;extract := proc(expr)
    local atans;
    atans := convert(indets(expr, 'arctan(anything)'), list);
    map(proc(aa) local arg; typematch(aa, 'arctan'(arg::anything)); arg; end, atans);
end proc;
&lt;/pre&gt;
</description>
      <guid>75545</guid>
      <pubDate>Mon, 24 Sep 2007 21:25:58 Z</pubDate>
      <itunes:author>JacquesC</itunes:author>
      <author>JacquesC</author>
    </item>
    <item>
      <title>My actual expression</title>
      <link>http://www.mapleprimes.com/questions/40800-Extract-The-Argument-Of-A-Trig-Function?ref=Feed:MaplePrimes:Extract the argument of a trig function:Comments#answer75539</link>
      <itunes:summary>Thank you as always, most informative.

My actual expression was of the form A arctan(B/C)

where A = -1 or 1, and B and C are variables and not functions. 

I am glad I did not make that clear at the start; I might have missed some of the discussion!</itunes:summary>
      <description>Thank you as always, most informative.

My actual expression was of the form A arctan(B/C)

where A = -1 or 1, and B and C are variables and not functions. 

I am glad I did not make that clear at the start; I might have missed some of the discussion!</description>
      <guid>75539</guid>
      <pubDate>Tue, 25 Sep 2007 23:35:14 Z</pubDate>
      <itunes:author>brian abraham</itunes:author>
      <author>brian abraham</author>
    </item>
  </channel>
</rss>