The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math.symbolic

Topic: sin^2 simplification in Maple
Replies: 1   Last Post: Dec 3, 1996 1:31 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Douglas B. Meade

Posts: 27
Registered: 12/8/04
Re: sin^2 simplification in Maple
Posted: Dec 3, 1996 1:31 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

The recent posting by Thomas Koenig about simplification provides a
good example to illustrate several under-utilized Maple features.
Since the expression is so long, all output has been deleted from
my response. But, you should be able to copy these commands into a
Release 4 worksheet and see the results for yourself.

While I think my improvements are significant, I have to question
if it wouldn't be appropriate to direct some attention to the steps
leading to this expression. Not knowing the origins of this problem,
it's difficult to say too much, but I've seen many cases where a
little thought can greatly simplify the final expressions that have
to be manipulated.

I hope these comments provide enough ideas to extract the desired

Douglas B. Meade Phone: (803) 777-6183 FAX: (803) 777-6527
Department of Mathematics E-mail:
USC, Columbia, SC 29208 URL:

>>>>> BEGIN MAPLE CODE <<<<<
# Here's the original expression, assigned to a name for future
# reference.
> EXPR :=
> ((-1/6/(-1+cos(theta)^2)*c+1/6/(-1+cos(theta)^2)*c*cos(theta)^2)*g(t)^
> 2-1/(-1+cos(theta)^2)*a+1/(-1+cos(theta)^2)*cos(theta)^2*a)*diff(diff(
> f(t),t),t)+(((-1/3/(-1+cos(theta)^2)*c+1/3/(-1+cos(theta)^2)*c*cos(the
> ta)^2)*g(t)+(-28/(-1+cos(theta)^2)*b-25/(-1+cos(theta)^2)*a+25/(-1+cos
> (theta)^2)*cos(theta)^2*a+28/(-1+cos(theta)^2)*cos(theta)^2*b)/g(t))*d
> iff(g(t),t)-2/(-1+cos(theta)^2)*cos(theta)^2*d+2/(-1+cos(theta)^2)*d)*
> diff(f(t),t)+(1/4/sin(phi)/(-1+cos(theta)^2)*c*f(t)*cos(phi)*cos(theta
> )^2*phi+1/2/(-1+cos(theta)^2)*c*f(t)-1/4/(-1+cos(theta)^2)*c*f(t)*cos(
> theta)^2+(-7/3/(-1+cos(theta)^2)*a*f(t)-4/3/(-1+cos(theta)^2)*b*f(t)-7
> /6/sin(phi)/(-1+cos(theta)^2)*a*f(t)*cos(phi)*cos(theta)^2*phi+7/6/(-1
> +cos(theta)^2)*a*f(t)*cos(theta)^2+2/3/(-1+cos(theta)^2)*b*f(t)*cos(th
> eta)^2-2/3/sin(phi)/(-1+cos(theta)^2)*b*f(t)*cos(phi)*cos(theta)^2*phi
> )/g(t)^2+(10/(-1+cos(theta)^2)*a*int(diff(f(t),t)*g(t),t)-8/(-1+cos(th
> eta)^2)*b*cos(theta)^2*int(diff(f(t),t)*g(t),t)+8/(-1+cos(theta)^2)*b*
> int(diff(f(t),t)*g(t),t)-10/(-1+cos(theta)^2)*a*cos(theta)^2*int(diff(
> f(t),t)*g(t),t))/g(t)^3)*diff(g(t),t)^2+((2/3/sin(phi)/(-1+cos(theta)^
> 2)*d*f(t)*cos(phi)*cos(theta)^2*phi+4/3/(-1+cos(theta)^2)*d*f(t)-2/3/(
> -1+cos(theta)^2)*d*f(t)*cos(theta)^2)/g(t)+(-4/(-1+cos(theta)^2)*d*int
> (diff(f(t),t)*g(t),t)+4/(-1+cos(theta)^2)*d*cos(theta)^2*int(diff(f(t)
> ,t)*g(t),t))/g(t)^2)*diff(g(t),t)+(1/6/sin(phi)/(-1+cos(theta)^2)*c*di
> ff(diff(g(t),t),t)*f(t)*cos(phi)*cos(theta)^2*phi+1/3/(-1+cos(theta)^2
> )*c*diff(diff(g(t),t),t)*f(t)-1/6/(-1+cos(theta)^2)*c*diff(diff(g(t),t
> ),t)*f(t)*cos(theta)^2)*g(t)-1/3/(-1+cos(theta)^2)*c*diff(diff(g(t),t)
> ,t)*int(diff(f(t),t)*g(t),t)+1/3/(-1+cos(theta)^2)*c*diff(diff(g(t),t)
> ,t)*int(diff(f(t),t)*g(t),t)*cos(theta)^2+(-2/3/(-1+cos(theta)^2)*a*di
> ff(diff(g(t),t),t)*f(t)-1/3/sin(phi)/(-1+cos(theta)^2)*a*diff(diff(g(t
> ),t),t)*f(t)*cos(phi)*cos(theta)^2*phi+1/3/(-1+cos(theta)^2)*a*diff(di
> ff(g(t),t),t)*f(t)*cos(theta)^2)/g(t)+(2/(-1+cos(theta)^2)*a*diff(diff
> (g(t),t),t)*int(diff(f(t),t)*g(t),t)-2/(-1+cos(theta)^2)*a*diff(diff(g
> (t),t),t)*cos(theta)^2*int(diff(f(t),t)*g(t),t))/g(t)^2;

# While the -1+cos(theta)^2; this can be eliminated as suggested in
# other responses (e.g., using subs), the use of a "side relation"
# provides more flexibility. Here, we specify any identities in the
# second argument; the third argument provides an ordering of the terms
# for elimination. In this case, we want to replace the cosine terms, so
# we use:
> EXPRs := simplify( EXPR, { sin(theta)^2 + cos(theta)^2 = 1 }, [
> cos(theta), sin(theta) ] );

# Already, this expression fits into a single screen. The next
# simplification that I want to make is to replace all of the functions
# with simpler names. To be sure none of the meaning is lost, aliases
# are a good choice:
> alias(F=f(t), G=g(t), dF = diff(f(t),t), dG = diff(g(t),t), dF2 =
> diff(f(t),t,t), dG2 = diff(g(t),t,t) );
> EXPRs;

# The resulting expression is somewhat simpler. Note that this is now a
# rational function with a fairly simple denominator. Let's consider the
# numerator and denominator separately:
> DENOM := denom( EXPRs );
> EXPR2 := numer( EXPRs );

# Since I don't know what you want to do with this expression, I don't
# know the form that will be most beneficial. Here are two different
# ways in which the terms can be grouped.
> EXPRc := collect( EXPR2, [ F, G, dF, dG, dF2, dG2 ], distributed );
> EXPRc2 := collect( EXPR2, [ sin(phi), cos(theta), cos(phi) ],
> distributed );

# Note that while the original expression filled several screens, each
# of the above expressions fits into a single screen.
# To conclude, let's look at some different forms in which the
# denominator can be written:
> combine( DENOM );
> simplify( DENOM );

# I'll leave it to the original poster to decide which, if any of these
# are relevant.
>>>>> END MAPLE CODE <<<<<
Douglas B. Meade Phone: (803) 777-6183 FAX: (803) 777-6527
Department of Mathematics E-mail:
USC, Columbia, SC 29208 URL:

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.