Re: Wrestling with Mathematica on Trig Simplification
- To: mathgroup at smc.vnet.net
- Subject: [mg32317] Re: Wrestling with Mathematica on Trig Simplification
- From: "Dana" <ng_only at hotmail.com>
- Date: Sat, 12 Jan 2002 21:32:36 -0500 (EST)
- References: <a1bllp$bcb$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I am really new at this, so I am probably way off. Taking your excellent idea, perhaps you could rewrite it as the following rule?? myrule = a_ Sin[t_] + b_ Cos[t_] -> Abs[a + b I]Cos[t - Arg[b + I a]] As an example: In[5]:= 3Sin[1/2]+4Cos[1/2]/.myrule Out[5]= 5*Cos(1/2 - ArcTan(3/4)) On could include this following in Mathematica 4 to set a & b to Reals. Element[{a, b}, Reals] - - - - - - - - - - - - - - - - - - - - - - HTH. Dana DeLouis -- "David Park" <djmp at earthlink.net> wrote in message news:a1bllp$bcb$1 at smc.vnet.net... > 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! > > > >