RE: Wrestling with Mathematica on Trig Simplification

*To*: mathgroup at smc.vnet.net*Subject*: [mg32219] RE: [mg32212] Wrestling with Mathematica on Trig Simplification*From*: "David Park" <djmp at earthlink.net>*Date*: Mon, 7 Jan 2002 03:16:47 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Steven, I think this may be a good example of what often happens with Mathematica. Users, especially new users, expect and hope that there will be off the shelf Mathematica commands to directly solve their problem. But mathematics is too vast a subject for that without having millions of commands (which would present a problem in itself). Often, very often, you are going to have to write definitions, rules and small routines to use as tools in your specific application. One should view Mathematica more as a kit to build tools than as a ready-to-use problem solver. For you problem I would write the initial definition this way: m[a_, b_][t_] := a Sin[t] + b Cos[t] Then, checking with my favorite Mathematics Handbook, I would write the amplitude-phase angle conversion as: AmplitudePhaseSimplify[expr_] := expr /. (a_.)*Sin[t_] + (b_.)*Cos[t_] -> Sqrt[a^2 + b^2]*Cos[t - ArcTan[a/b] - If[a < 0, Pi, 0]] Since it has an If statement in it, it doesn't look too great with symbolic expressions. But with number expressions it works nicely. m[3, 2][t] % // AmplitudePhaseSimplify 2 Cos[t] + 3 Sin[t] Sqrt[13]*Cos[t - ArcTan[3/2]] Of course, sometimes one later finds that Mathematica does have a direct way to do it, and you might even get such a reply from MathGroup. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Steven Warwick [mailto:warwick at jps.net] To: mathgroup at smc.vnet.net > > So, A typical scenario for me is the combining of sinusoids like: > > m[t_] = A Sin[t] + B Cos[t] > > ( A and B Real, although I don't know how to communicate this to > Mathematica > in an effective way) > > with the desired "simplified" output being of the form: > > C Cos[t+th] > > > Trigreduce will not do this, as I've tried. Yes, C and th are more > algebraically complicated, but the overall expression is actually more > meaningful for me.. > > I can solve for C and th using Solve, with creating 2 simultaneous > equations with t picked at 0, PI/2 to get the correct form, but that's > not the same as having a "reduce" capability. Am I missing > something? is there a way to create preference for this form in > simplify? > > Thanks! >