[Date Index]
[Thread Index]
[Author Index]
Re: How to solve a simple Trig cofunction?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg50536] Re: [mg50500] How to solve a simple Trig cofunction?
*From*: "David Park" <djmp at earthlink.net>
*Date*: Thu, 9 Sep 2004 05:18:34 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
Brian,
It should be just as accurate whether you work in degrees or radians. You
can convert to radians by multiplying by Degree, and convert back to degrees
by dividing by Degree.
180 Degree
% // N
%/Degree
180 °
3.14159
180.
But you lose the degree sign. If you try to add it with a real value, you
run into a problem because it just converts back to radians.
180. °
3.14159
You run into the same problem if you try to use the Units standard package
on real values.
Needs["Miscellaneous`Units`"]
With exact numbers we can convert back and forth.
Convert[180 Degree, Radian]
Convert[%, Degree]
Pi*Radian
180 °
But with approximate numbers the reverse conversion fails because Degree is
both a unit and a numeric constant. This was an oversight in the design of
Mathematica, which could be fixed, for example by using Degree and Degrees.
But it is probably too late now.
Convert[180.0 Degree, Radian]
Convert[%, Degree]
3.14159 Radian
3.14159
The V4ExtendUnits package at my web site solves the problem but at the cost
of putting ° in a HoldForm.
Needs["Miscellaneous`V4ExtendUnits`"]
180.° // ToUnit[Radian]
% // ToUnit[°]
3.14159 Radian
180. °
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Brian Feeny [mailto:bfeeny at mac.com]
To: mathgroup at smc.vnet.net
David,
Thanks, I am learning alot from the multiple ways people here have
helped me with this problem.
I am confused however, why DrBob and Andrzej came up with ~26 degrees,
but you came up with 21
(which is what I came up with). I mean, even with a conversion from
radians (more accurate) to degrees
(probably less accurate), I would think Mathematica would not show such
a large difference in the ways
this was solved.
Brian
On Sep 8, 2004, at 10:57 AM, David Park wrote:
> Brian,
>
> It's often best to work with radians, but since your input is simply
> stated
> in degrees we'll stick with degrees. You can click in the Degree
> symbol from
> the Input Palette to save some typing.
>
> With a problem like this, it's often useful to make a plot first to
> see what
> is going on.
>
> Plot[{Cos[x ° + 4°], Sin[3x ° + 2°]}, {x, -180, 180},
> Frame -> True,
> ImageSize -> 450];
>
> Then NSolve gets the solutions right off. (But you have to use "=="
> not "="
> in the equation.)
>
> NSolve[Cos[x ° + 4°] == Sin[3x ° + 2°], x]
> {{x -> -159.}, {x -> -134.}, {x -> -69.}, {x -> 21.}, {x -> 46.}, {x ->
> 111.}}
>
> You can ignore the error message in this case since the solutions
> correspond
> to the plot.
>
> If you use Ted Ersek's RootSearch package from MathSource you can
> easily
> obtain the roots over a wider range.
>
> Needs["Enhancements`RootSearch`"]
>
> RootSearch[Cos[x ° + 4°] == Sin[3x ° + 2°], {x, -360, 360}]
> {{x -> -339.}, {x -> -314.}, {x -> -249.}, {x -> -159.}, {x -> -134.},
> {x -> -69.}, {x -> 21.}, {x -> 46.}, {x -> 111.},
> {x -> 201.}, {x -> 226.}, {x -> 291.}}
>
> David Park
> djmp at earthlink.net
> http://home.earthlink.net/~djmp/
>
> From: Brian Feeny [mailto:bfeeny at mac.com]
To: mathgroup at smc.vnet.net
>
> Lets say I have:
>
> cos[X+4] = sin[3X+2]
>
> What would be the proper way to solve the above, for X, in
> Mathematica, with the answer in degrees?
>
> I did this, but something tells me their has to be a better way:
>
> NSolve[Cos[X Degree +4 Degree] = Sin[3 X Degree+2 Degree], X]
>
> I mean, I wish i didn't have to enter "Degree"so many times, perhaps
> their is a simple way to just tell it the whole thing is in Degree.
>
> Additionally, is their a way to constrain the above to 90 > X > 0? I
> tried doing like:
>
> NSolve[Cos[X Degree +4 Degree] = Sin[3 X Degree+2 Degree], X /; 90
>> X>0]
>
> but that obviously is not the right way since that doesn't work.
> Appreciate all the help.
>
> Brian
>
>
>
>
------------------------------------------------------------------------
------
Brian Feeny, CCIE #8036, CISSP e: signal at shreve.net
Network Engineer p: 318.213.4709
ShreveNet Inc. f: 318.221.6612
Prev by Date:
**Re: Random replacement**
Next by Date:
**Histograms do not concur; why?**
Previous by thread:
**Re: How to solve a simple Trig cofunction?**
Next by thread:
**Re: How to solve a simple Trig cofunction?**
| |