Converting Trig equation in Maple $$\frac{\sin^4(3x)}{18\cos^6(3x)} + \frac{\sin^4(3x)}{36\cos^4(3x)} = \frac{\tan^6(3x)}{18} + \frac{\tan^4(3x)}{12}$$
The answer on the left is what I got when I punched in the problem in Maple: $\operatorname{int}(\tan^3(3x)\cdot\sec(3x)^4, x)$
The answer on the right is my own using u-sub and a trig identity. I need to convert the Maple answer into the same form as the answer I came up with. Whether someone can show me how to do that in Maple somehow or manually would be greatly appreciated :). I tried to convert it manually and got to:
$$\frac{\tan^4(3x)\cdot(2+\cos^2(3x)))}{36\cos^2(3x)}$$
I'm not sure how to proceed past this point or even if this equation is correct so far.
 A: Since you tagged this with maple.
There's nothing special about the 3*x, so let's replace it with u temporarily, if only to make it easier to read.
restart;

expr := sin(3*x)^4/(18*cos(3*x)^6)
    + sin(3*x)^4/(36*cos(3*x)^4);

                       4              4  
               sin(3 x)       sin(3 x)   
     expr := ------------ + ------------
                        6              4
             18 cos(3 x)    36 cos(3 x) 

new := subs(3*x=u,expr);

                    4            4  
              sin(u)       sin(u)   
     new := ---------- + ----------
                     6            4
            18 cos(u)    36 cos(u) 

With a common denominator,
new := normal(new);

                 4 /      2    \
           sin(u)  \cos(u)  + 2/
    new := ---------------------
                         6      
                36 cos(u)   

Let's substitute for the cos(u)^2 + 2, using a well known identity. I'll build an equation, and the use it with the subs command.
1 = sin(u)^2 + cos(u)^2:

ident := cos(u)^2 + 2*%;

                       2               2           2
        ident := cos(u)  + 2 = 2 sin(u)  + 3 cos(u) 

Now, substituting,
subs(ident, new);

                4 /        2           2\
          sin(u)  \2 sin(u)  + 3 cos(u) /
         -------------------------------
                            6           
                   36 cos(u)            

expand(%);

                     6            4  
               sin(u)       sin(u)   
             ---------- + ----------
                      6            4
             18 cos(u)    12 cos(u) 

convert(%,tan);

             1        6   1        4
             -- tan(u)  + -- tan(u) 
             18           12      

And if you want to re-substitute for u,
subs(u=3*x, %);

           1          6   1          4
           -- tan(3 x)  + -- tan(3 x) 
           18             12    

We could treat the original similarly, without the u = 3*x step.
1 = sin(3*x)^2 + cos(3*x)^2:

ident := cos(3*x)^2 + 2*%;

                          2             2             2
     ident := 2 + cos(3 x)  = 2 sin(3 x)  + 3 cos(3 x) 

subs(ident, normal(expr));

              4 /          2             2\
      sin(3 x)  \2 sin(3 x)  + 3 cos(3 x) /
      -------------------------------------
                             6             
                  36 cos(3 x)              

Expand that (without expanding the trig functions of 3*x),
frontend(expand, [%]);

                    6              4  
            sin(3 x)       sin(3 x)   
           ------------ + ------------
                      6              4
           18 cos(3 x)    12 cos(3 x) 

ans := convert(%,tan);

              1          6   1          4
       ans := -- tan(3 x)  + -- tan(3 x) 
              18             12          

You mentioned that you are not sure whether the alternate answer is equivalent.  With can check that in a few ways.
simplify( expr - ans );

                        0

is( expr = ans );

                      true

A: Let's do this manually, since it's actually not that bad! I'll write in a condensed notation with $s=\sin(3x)$ and $c=\cos(3x)$ so I can type this more easily.
\begin{align*}
\frac{s^4}{18c^6} + \frac{s^4}{36c^4} &=\frac{s^4}{18c^6}-\frac{s^4}{18c^4} + \frac{s^4}{18c^4} + \frac{s^4}{36c^4} \\
&=\frac{s^4(c^2+s^2)}{18c^6} -\frac{s^4c^2}{18c^6}+\frac{s^4}{12c^4} \\
&= \frac{s^6}{18c^6} +\frac{s^4}{12c^4}
\end{align*}
Which is your answer!
