MathGroup Archive 2010

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

Search the Archive

Re: Re: Write an expression in a specific form

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108111] Re: [mg108025] Re: Write an expression in a specific form
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Mon, 8 Mar 2010 06:16:46 -0500 (EST)
  • References: <hmo293$qbh$1@smc.vnet.net> <201003050935.EAA29559@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

Why shouldn't I integrate the product, if it gives me the unknown  
multiplier?

Also see my other post, where Integrate gives us c, m, AND s with no  
(visible) algebra.

Bobby

On Sun, 07 Mar 2010 23:50:09 -0600, dh <dh at metrohm.com> wrote:

> Hi Bob,
> you were not supposed to integrate the product of two Gaussian. But the  
> product of two Gaussian is another Gaussian whose parameters are asked.
> Daniel
>
> On 05.03.2010 13:14, DrMajorBob wrote:
>> I missed where c4 is defined in that... but starting out, we know it has
>> to be equal to
>>
>> G[m_,s_,x_]:=(1/(s*Sqrt[2*Pi]))*Exp[-(x-m)^2/(2*s^2)];
>> Integrate[G[m1,s1,x]
>> G[m2,s2,x],{x,-Infinity,Infinity},Assumptions->{s1>0,s2>0}]
>>
>> E^(-((m1-m2)^2/(2 (s1^2+s2^2))))/(Sqrt[2 \[Pi]] Sqrt[s1^2+s2^2])
>>
>> No?
>>
>> I think c4 was supposed to be c3, and sure enough, retrieving the RHS of
>> the rule for c3, I have:
>>
>> (E^(-((m1-m2)^2/(2 (s1^2+s2^2)))) Sqrt[(s1^2 s2^2)/(s1^2+s2^2)])/(Sqrt[2
>> \[Pi]] s1 s2)//PowerExpand
>>
>> E^(-((m1-m2)^2/(2 (s1^2+s2^2))))/(Sqrt[2 \[Pi]] Sqrt[s1^2+s2^2])
>>
>> Bobby
>>
>> On Fri, 05 Mar 2010 03:35:13 -0600, dh <dh at metrohm.com> wrote:
>>
>>> Hi Ares,
>>> Mathematica really seems to have difficulties (that is I do not have
>>> the nerves
>>> to wait so long) with a calculation that can done by hand. It look like
>>> it needs some human help.
>>> We may get an equation for the exponents with only 2 unknowns.
>>> We denot by m1,s1 and m2,s2 the parameters of the given Gaussian. m3,s3
>>> and c3 denote the searched Gaussian: c4 G[m3,s3]. tmp is an  
>>> intermediate
>>> result we are not interested in:
>>> sol1 = Reduce[{ForAll[
>>> x, (x - m1)^2/(2 s1^2) + (x - m2)^2/(2 s2^2) ==
>>> tmp + (x - m3)^2/(2 s3^2)], s1 > 0, s2 > 0, s3 > 0}, {m3, s3, tmp},
>>> Reals]
>>> this gives us m3,s3 and an intermediate result tmp. With this we may
>>> solve the equation for the pre factor. Toward this aim we change sol1  
>>> to
>>> rules and use it in the equation:
>>> G[m1, s1, x] G[m2, s2, x] == c3 G[m3, s3, x] /. sol1 /. sol1
>>> Note that in sol1 tmp is given in term of m3,s3. We must therefore  
>>> apply
>>> /.sol1 twice.
>>> I also delete some superfluous info from the result. Here is the whole
>>> code:
>>> ================
>>> G[m_, s_, x_] := (1/(s*Sqrt[2*Pi]))*Exp[-(x - m)^2/(2*s^2)];
>>> sol1 = Reduce[{ForAll[
>>> x, -((x - m1)^2/(2 s1^2)) - (x - m2)^2/(2 s2^2) ==
>>> tmp - (x - m3)^2/(2 s3^2)], s1 > 0, s2 > 0, s3 > 0}, {m3, s3,
>>> tmp}, Reals];
>>> sol1 = Drop[sol1, 2] // ToRules
>>> sol2 = Reduce[{G[m1, s1, x] G[m2, s2, x] == c3 G[m3, s3, x] /.
>>> sol1 /. sol1, s1 > 0, s2 > 0, s3 > 0, c3 > 0}, {c3},
>>> Reals][[4]] // ToRules
>>> ===============
>>>
>>> Finally we may test if the calculation is correct:
>>> G[m1, s1, x] G[m2, s2, x] == c4 G[m3, s3, x] /. sol2 /. sol1 /.
>>> sol1 // Simplify
>>>
>>> Daniel
>>>
>>> On 04.03.2010 11:33, Ares Lagae wrote:
>>>> Hi all,
>>>>
>>>> I am a beginner in Mathematica, and I have the following "problem":
>>>> How can
>>>> I write an expression in a specific form?
>>>>
>>>> For example:
>>>>
>>>> - Define a Gaussian:
>>>>
>>>> G[m_, s_, x_] := (1/(s*Sqrt[2*Pi]))*Exp[-(x - m)^2/(2*s^2)];
>>>>
>>>> - Product of two Gaussians:
>>>>
>>>> G[m1, s1, x] * G[m2, s2, x]
>>>>
>>>> - How can I get Mathematica to write the result in terms of c * G[m_,
>>>> s_,
>>>> x_]? I.e., get the values for c, m and s.
>>>>
>>>> Thanks,
>>>>
>>>> Ares Lagae
>>>>
>>>>
>>>
>>>
>>
>>
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Conjugate of symbolic expressions
  • Next by Date: Re: Putting a Plot inside a Graphics function with other
  • Previous by thread: Re: Re: Write an expression in a specific form
  • Next by thread: Re: Write an expression in a specific form