Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to use "Solve" to get only real number solutions?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55151] Re: How to use "Solve" to get only real number solutions?
  • From: Peter Pein <petsie at arcor.de>
  • Date: Mon, 14 Mar 2005 03:43:56 -0500 (EST)
  • References: <d114lb$e18$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

PengYu.UT at gmail.com wrote:
> Hi All
> 
> For example I have the following function and I want to find the
> solution of the quation shown below. But Mathematica showns not only
> real number solutions. Do you know how to restrict the solutions to
> only real numbers. Thanks!
> 
> Best wishes,
> Peng
> 
> intensity[x_, δ_, p_, λ_] := 1/4 + (2*Cos[(Pi*x)/100])/Pi +
> (4*Cos[(Pi*x)/100]^2)/Pi^2 - (2*Cos[(3*Pi*x)/100])/(3*Pi) -
>  (8*Cos[(Pi*x)/100]*Cos[(3*Pi*x)/100])/(3*Pi^2) +
> (4*Cos[(3*Pi*x)/100]^2)/(9*Pi^2)
> 
> Solve[intensity[x, 0, 200, 50] == 0.3*(1/4 + 32/(9*Pi^2) +
> (4*Sqrt[2])/(3*Pi)), x]
> 
Hi Peng,

you can either select the reals after computation of all solutions:

Select[x /. Solve[intensity[x, 0, 200, 50] ==
    3/10*(1/4 + 32/(9*Pi^2) + (4*Sqrt[2])/(3*Pi)), x],
 Im[Chop[N[#]]] == 0 &]

or use Reduce:

Reduce[intensity[x, 0, 200, 50] == 3/10*(1/4 + 32/(9*Pi^2) +
   (4*Sqrt[2])/(3*Pi)), x, Reals]

-- 
Peter Pein
Berlin


  • Prev by Date: Re: How to use "Solve" to get only real number solutions?
  • Next by Date: Copy As menu command
  • Previous by thread: Re: How to use "Solve" to get only real number solutions?
  • Next by thread: Re: How to use "Solve" to get only real number solutions?