Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11539 > unrolled thread

reduction/simplification of hypergeometric-function-related formula

Started byPaul Slater <slater@kitp.ucsb.edu>
First post2012-08-29 05:18 +0000
Last post2012-09-07 09:01 +0000
Articles 11 — 4 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  reduction/simplification of hypergeometric-function-related formula Paul Slater <slater@kitp.ucsb.edu> - 2012-08-29 05:18 +0000
    Re: reduction/simplification of hypergeometric-function-related formula "Dr. Wolfgang Hintze" <weh@snafu.de> - 2012-08-30 08:12 +0000
    DSolve for a real function Andreas Talmon l'Armée - 2012-08-31 08:01 +0000
    Re: DSolve for a real function Bob Hanlon <hanlonr357@gmail.com> - 2012-09-01 06:27 +0000
    Re: DSolve for a real function Andreas Talmon l'Armée - 2012-09-04 09:46 +0000
    Re:  Re: DSolve for a real function Bob Hanlon <hanlonr357@gmail.com> - 2012-09-04 09:47 +0000
    Re:  Re: DSolve for a real function Andreas Talmon l'Armée - 2012-09-04 09:47 +0000
    Re: DSolve for a real function Andreas Talmon l'Armée - 2012-09-04 09:52 +0000
    Re: DSolve for a real function Bob Hanlon <hanlonr357@gmail.com> - 2012-09-04 09:52 +0000
    Re: DSolve for a real function Bob Hanlon <hanlonr357@gmail.com> - 2012-09-07 08:58 +0000
    Re: DSolve for a real function Andreas Talmon l'Armée - 2012-09-07 09:01 +0000

#11539 — reduction/simplification of hypergeometric-function-related formula

FromPaul Slater <slater@kitp.ucsb.edu>
Date2012-08-29 05:18 +0000
Subjectreduction/simplification of hypergeometric-function-related formula
Message-ID<k1k8np$90f$1@smc.vnet.net>
Note: In the previous posting of this query, the variable "alpha" was employed, which led to now-apparent problems in the mailing with the presentation of the formula in plaintext. I've replaced "alpha" by "a", so hopefully now the formula below will be usable as intended.

> I posted a short preprint
>
> http://arxiv.org/pdf/1203.4498v2.pdf
>
> a few months ago.
>
> The central object in it is the formula in Figure 3--given in plain text at the bottom  of this email. (It can be copied-and-pasted into a Mathematica notebook.).
>
> The formula contains a "family" of six 7F6 hypergeometric functions. It seems to have a number of very interesting (quantum-information-theoretic) properties--as indicated in the preprint. (The upper and lower parameters form intriguing sequences, and the argument of all the six functions is (27/64) = (3/4)^3. For non-negative integers and half-integers, it appears to yield rational values.)
>
> It took considerable work to get the formula as "concise" as it is now (LeafCount=530). The original form, generated using the Mathematica FindSequenceFunction command on a sequence of length 32, extended over several pages of output--and also had six (different) hypergeometric functions embedded in it.
>
> I have devoted a considerable amount of  effort, unsuccessfully, to see if it can be made more concise/digestible. In particular, I have never been able to derive an equivalent  form in which fewer than six independent hypergeometric formulas are present.
>
> Any thoughts?
>
> Thanks!
>
> Paul B. Slater
>
>
> Formula in question:
>
(4^(-3 - 2 a)
    Gamma[5/2 + 3 a] Gamma[
    2 + 5 a] ((-54 +
        a (39 +
           5 a (628 + 25 a (161 + 2 a (-581 + 740 a))))) HypergeometricPFQ[{1,
         2/5 + a, 3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a,
        3/2 + a, 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/
       64] + (347274 +
        5 a (-312019 +
           25 a (22255 + 8 a (-2431 + 925 a)))) HypergeometricPFQ[{2, 2/5 + a,
         3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a,
        17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
     10 ((-769797 +
           25 a (66227 + 4 a (-12843 + 3700 a))) HypergeometricPFQ[{3,
           2/5 + a, 3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a,
           3/2 + a, 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
        75 ((44133 + 8 a (-6131 + 1850 a)) HypergeometricPFQ[{4, 2/5 + a,
              3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a,
              3/2 + a, 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
           8 ((-7981 + 3700 a) HypergeometricPFQ[{5, 2/5 + a, 3/5 + a,
                 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a,
                 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
              3700 HypergeometricPFQ[{6, 2/5 + a, 3/5 + a, 4/5 + a, 5/6 + a,
                 7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a, 17/10 + a, 19/10 + a,
                  2 + a, 21/10 + a}, 27/64])))))/(3 Gamma[1 + a] Gamma[
    3 + 2 a] Gamma[13/2 + 5 a])


[toc] | [next] | [standalone]


#11558

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2012-08-30 08:12 +0000
Message-ID<k1n78g$e8u$1@smc.vnet.net>
In reply to#11539
On 29 Aug., 07:19, Paul Slater <sla...@kitp.ucsb.edu> wrote:
> Note: In the previous posting of this query, the variable "alpha" was employed, which led to now-apparent problems in the mailing with the presentation of the formula in plaintext. I've replaced "alpha" by "a", so hopefully now the formula below will be usable as intended.
>
>
>
>
>
> > I posted a short preprint
>
> >http://arxiv.org/pdf/1203.4498v2.pdf
>
> > a few months ago.
>
> > The central object in it is the formula in Figure 3--given in plain text at the bottom  of this email. (It can be copied-and-pasted into a Mathematica notebook.).
>
> > The formula contains a "family" of six 7F6 hypergeometric functions. It seems to have a number of very interesting (quantum-information-theoretic) properties--as indicated in the preprint. (The upper and lower parameters form intriguing sequences, and the argument of all the six functions is (27/64) = (3/4)^3. For non-negative integers and half-integers, it appears to yield rational values.)
>
> > It took considerable work to get the formula as "concise" as it is now (LeafCount=530). The original form, generated using the Mathematica FindSequenceFunction command on a sequence of length 32, extended over several pages of output--and also had six (different) hypergeometric functions embedded in it.
>
> > I have devoted a considerable amount of  effort, unsuccessfully, to see if it can be made more concise/digestible. In particular, I have never been able to derive an equivalent  form in which fewer than six independent hypergeometric formulas are present.
>
> > Any thoughts?
>
> > Thanks!
>
> > Paul B. Slater
>
> > Formula in question:
>
> (4^(-3 - 2 a)
>     Gamma[5/2 + 3 a] Gamma[
>     2 + 5 a] ((-54 +
>         a (39 +
>            5 a (628 + 25 a (161 + 2 a (-581 + 740 a))))) HypergeometricPFQ[{1,
>          2/5 + a, 3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a,
>         3/2 + a, 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/
>        64] + (347274 +
>         5 a (-312019 +
>            25 a (22255 + 8 a (-2431 + 925 a)))) HypergeometricPFQ[{2, 2/5 + a,
>          3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a,
>         17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
>      10 ((-769797 +
>            25 a (66227 + 4 a (-12843 + 3700 a))) HypergeometricPFQ[{3,
>            2/5 + a, 3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a,
>            3/2 + a, 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
>         75 ((44133 + 8 a (-6131 + 1850 a)) HypergeometricPFQ[{4, 2/5 + a,
>               3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a,
>               3/2 + a, 17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
>            8 ((-7981 + 3700 a) HypergeometricPFQ[{5, 2/5 + a,3/5 + a,
>                  4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a,
>                  17/10 + a, 19/10 + a, 2 + a, 21/10 + a}, 27/64] +
>               3700 HypergeometricPFQ[{6, 2/5 + a, 3/5 + a,4/5 + a, 5/6 + a,
>                  7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a, 17/10 + a, 19/10 + a,
>                   2 + a, 21/10 + a}, 27/64])))))/(3 Gamma[1 + a] Gamma[
>     3 + 2 a] Gamma[13/2 + 5 a])

I don't see any easy way to simplify your expression but here are two
suggestions to understand it better.

1) Structure

Let us first look at the structure of your complete expression which I
shall call f[a]:

Decomposing as

f[a] = g[a] h[a]

where

g[a_] := 4^(-3 - 2*a)*Gamma[5/2 + 3*a]*(Gamma[2 + 5*a]/(3*Gamma[1 +
a]*Gamma[3 + 2*a]*Gamma[13/2 + 5*a]))

and

h[a] = Sum[ h1[m,a] p[m,a],{m,1,5}]

h1[ m_,a_] := HypergeometricPFQ[{m, 2/5 + a, 3/5 + a, 4/5 + a, 5/6 +
a, 7/6 + a, 6/5 + a}, {13/10 + a, 3/2 + a, 17/10 + a, 19/10 + a, 2 +
a, 21/10 + a}, 27/64]

where the arguments can be simplified to

t1 = Join[{m},{2/5 + a, 3/5 + a, 4/5 + a, 5/6 + a, 7/6 + a, 6/5 + a}]
t2 = Table[(2k+1)/10 + a,{k,6,10}]

If there was a typo in t1 (is it?) you can even reduce it to

t11 = Join[{m},Table[k + a,{k,2,7}]]

The degree of the polynomials p[m,a] is 6-m.
The coefficients do not seem follow any simple pattern (you might know
better, because you have calculated them).

2) Graphical and numerical study

Mathematica can help you a lot in this aspect of study.

Use

Plot[{1 - f[a], 1 - 1/(1 + Pi*a^2)}, {a, 0, 2}, PlotRange -> {0, 1.1}]

to see that f[a] has a very simple smmooth and bounded behaviour for
a>=0.
Also I have plottet a suggested approximate formula

fa[a] = 1/(1 + Pi*a^2)

You can look at compley a using e.g.

Plot3D[Abs[h1[3, x + I*y]], {x, -3, 0}, {y, -1, 1}]

Next we can let Mathematica calculate some numerical values

f[0]
1

f[1];
N[%, 30]
0.242424242424242424242424242424

i.e.
f[1] = 24/99 = 8/33

No periodicity is seen in the next example

f[2];
N[%,30]
0.0804953560371517027863777089783281733746130030959752321981424148606811145=
5108359133126934984520123839

but again a rational number is abtained at a=1/2

f[1/2];
N[%,30]
0.4531250000000000000000000000000000000000000000000000000000000000000000000=
000000000000000000000000000

Interesting study (at least for me) which makes use of some of
Mathematica's features.

Regards,
Wolfgang

[toc] | [prev] | [next] | [standalone]


#11564 — DSolve for a real function

FromAndreas Talmon l'Armée
Date2012-08-31 08:01 +0000
SubjectDSolve for a real function
Message-ID<k1pr0p$k0h$1@smc.vnet.net>
In reply to#11539
Hi All

Is there a way to tell mathematica to solve only for real solutions. My 
differential equation is of the kind

y''''[x]+a y[x]==0

a= constant coefficient

I know that I get 4 komplex eigenvalues which are complex conjungated. 
But y[x] is a real function.
Solving this equation with DSolve always gets a complex function y[x].

Any Ideas.

Thanks, Andreas

[toc] | [prev] | [next] | [standalone]


#11579 — Re: DSolve for a real function

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-09-01 06:27 +0000
SubjectRe: DSolve for a real function
Message-ID<k1s9sr$og4$1@smc.vnet.net>
In reply to#11539
What are your initial conditions?

Clear[sol]

sol[a_, x_] = y[x] /. DSolve[
     {y''''[x] + a y[x] == 0,
      y[0] == ic0, y'[0] == ic1,
      y''[0] == ic2, y'''[0] == ic3},
     y[x], x][[1]] // FullSimplify

(1/(2*a^(3/4)))*
   (Cosh[(a^(1/4)*x)/Sqrt[2]]*
        (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
                 Sqrt[2]] + Sqrt[2]*
             (Sqrt[a]*ic1 + ic3)*
             Sin[(a^(1/4)*x)/Sqrt[2]]) +
      (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
             Cos[(a^(1/4)*x)/Sqrt[2]] +
           2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
                 Sqrt[2]])*
        Sinh[(a^(1/4)*x)/Sqrt[2]])

Reduce[Element[sol[a, x], Reals], a, Reals]

a > 0


Bob Hanlon


On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon l'Arm=E9e"@smc.vnet.net> wrote:
> Hi All
>
> Is there a way to tell mathematica to solve only for real solutions. My
> differential equation is of the kind
>
> y''''[x]+a y[x]==0
>
> a= constant coefficient
>
> I know that I get 4 komplex eigenvalues which are complex conjungated.
> But y[x] is a real function.
> Solving this equation with DSolve always gets a complex function y[x].
>
> Any Ideas.
>
> Thanks, Andreas
>

[toc] | [prev] | [next] | [standalone]


#11600 — Re: DSolve for a real function

FromAndreas Talmon l'Armée
Date2012-09-04 09:46 +0000
SubjectRe: DSolve for a real function
Message-ID<k24il8$1id$1@smc.vnet.net>
In reply to#11539
Hi,

I think this is not a numerical problem. Because if I look at the 
outcome of the symbolic computations for y3[x] (Simplify) and y4[x] 
(FullSimplify) there is one solution without imaginary part (Simplify) 
and one with imaginary part (FullSimplify) .

http://dl.dropbox.com/u/4920002/DGL_4th_Order_with_own_solution.nb

I am feeling a bit uncomfortable with these outcomes because I think the 
solution y3[x] (Simplify) is the better one even if the real part of 
both solutions is the same. But I think I just have to accept it. Is 
there a way to suppress the calculation with complex numbers.

Thanks for your time and your help

Andreas Talmon





On 09/03/2012 06:54 PM, Bob Hanlon wrote:
> In numerical computations, the specific computations and their order
> of computation determine the accumulation of the numerical noise. You
> generally reduce the accumulation of numerical noise by increasing the
> working precision.
>
> For example in your t2 rather than using machine precision specify
> extended precision (say 55 places)
>
> t2 = Table[
>     y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100, 10}] //N[#, 55] &
>
> Similarly, when plotting y4
>
> pRe2 = Plot[
>     Chop[y4[x]] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100},
>     WorkingPrecision -> 55, PlotStyle -> Red];
>
> pIm2 = Plot[Im[y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}],
>    {x, 0, 100}, WorkingPrecision -> 55,
>    Frame -> True, Axes -> False]
>
>
> Bob Hanlon
>
>
> On Mon, Sep 3, 2012 at 10:22 AM, Andreas Talmon l'Armée
> <talmon@fsm.tu-darmstadt.de> wrote:
>> You are completely right but I think there should be no real part in the
>> solution.
>>
>> I did the solution of the differential equation on paper and got the term
>> for y1[x].
>>
>> Then I determined the constants C[5]...C[8] with the boundary conditions
>> with Solve[] in  Mathematica. There I got an unusual behaviour.
>>
>> When using Simplify on the sol1 could generate a soltuion with only a real
>> part.
>> When using FullSimplify I get the imaginary part which is very small for
>> small x but for greater x also the imaginary part starts to oscillate with a
>> great amplitude.
>>
>> I do not understand how a solution can be Real or Complex depending on the
>> Simplifications scheme I use.
>>
>> Shouldn't there be one solution to a problem with specified boundary
>> conditions.?
>>
>> The notebook where I did all this is on:
>> http://dl.dropbox.com/u/4920002/DGL_4th_Order_with_own_solution.nb
>>
>>
>> Thanks for your great help,
>>
>> Andreas.
>>
>>
>>
>>
>> On 09/03/2012 03:22 PM, Bob Hanlon wrote:
>>> Clear[sol];
>>>
>>> $Assumptions = Element[{a, c, ic0, ic1}, Reals];
>>>
>>> sol[a_, x_] =
>>>    y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic0,
>>>         y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]] // FullSimplify
>>>
>>> ((1 + I)*a^(1/4)*
>>>             (I*E^(I*Sqrt[2]*a^(1/4)*c) -
>>>                I*E^(Sqrt[2]*a^(1/4)*c) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + I*x)) -
>>>                E^(I*Sqrt[2]*a^(1/4)*x) -
>>>                E^(Sqrt[2]*a^(1/4)*x) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + x)) +
>>>                I*E^(Sqrt[2]*a^(1/4)*
>>>                       (I*c + (1 + I)*x)) -
>>>                I*E^(Sqrt[2]*a^(1/4)*
>>>                       (c + (1 + I)*x)))*ic0 +
>>>           Sqrt[2]*(E^(I*Sqrt[2]*a^(1/4)*
>>>                     c) + E^(Sqrt[2]*a^(1/4)*
>>>                     c) + E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + I*x)) +
>>>                E^(I*Sqrt[2]*a^(1/4)*x) +
>>>                E^(Sqrt[2]*a^(1/4)*x) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + x)) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     (I*c + (1 + I)*x)) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     (c + (1 + I)*x)))*ic1)/
>>>        E^((-1)^(1/4)*a^(1/4)*(c + x))/
>>>      (4*a^(3/4)*(Sin[Sqrt[2]*a^(1/4)*
>>>                c] + Sinh[Sqrt[2]*a^(1/4)*
>>>                c]))
>>>
>>> Table[sol[a, x] /. {
>>>      c -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>>      ic0 -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>>      ic1 -> RandomReal[{0, 10}, WorkingPrecision -> 20]},
>>>    {a, 1, 5}, {x, 0, 4}]
>>>
>>> {{0.01540650723811880994 + 0.*10^-21 I, -0.0003703423761496348 +
>>>      0.*10^-20 I, -0.1278269715054133646 + 0.*10^-20 I,
>>>     0.0392723836429585004 + 0.*10^-20 I,
>>>     13.10841701158527505 + 0.*10^-18 I}, {-0.00286328430472954469 +
>>>      0.*10^-21 I, -1.985775360248369253 + 0.*10^-19 I,
>>> -0.311655087881410281 +
>>>      0.*10^-19 I, -0.718055887186593765 + 0.*10^-19 I,
>>>     21.42291506291193811 + 0.*10^-18 I}, {0.419394450195258310 + 0.*10^-19
>>> I,
>>>     0.01666534839706064001 + 0.*10^-21 I,
>>>     0.528881084742103412 + 0.*10^-19 I, -0.060937975960727530 + 0.*10^-19
>>> I,
>>>     0.0086995512380544778 + 0.*10^-20 I}, {0.01847749159520439918 +
>>> 0.*10^-21 I,
>>>      0.00517593237021928535 + 0.*10^-21 I,
>>>     0.0134376958759010127 + 0.*10^-20 I, -0.0679397801010012506 +
>>>      0.*10^-20 I, -5.21491473427110550 +
>>>      0.*10^-18 I}, {-0.00168718272676310080 +
>>>      0.*10^-21 I, -0.00137069152420374693 + 0.*10^-21 I,
>>>     3.051457492528748582 + 0.*10^-19 I,
>>>     0.00026536991493989622 + 0.*10^-21 I, -59.38147365750750826 + 0.*10^-18
>>> I}}
>>>
>>> The imaginary parts cancel out; the residual imaginary parts are just
>>> numerical noise. This can be removed with Chop
>>>
>>> % // Chop
>>>
>>> {{0.01540650723811880994, -0.0003703423761496348, -0.1278269715054133646,
>>>     0.0392723836429585004,
>>>     13.10841701158527505}, {-0.00286328430472954469, -1.985775360248369253,
>>> \
>>> -0.311655087881410281, -0.718055887186593765,
>>>     21.42291506291193811}, {0.419394450195258310, 0.01666534839706064001,
>>>     0.528881084742103412, -0.060937975960727530,
>>>     0.0086995512380544778}, {0.01847749159520439918,
>>> 0.00517593237021928535,
>>>     0.0134376958759010127, -0.0679397801010012506, -5.21491473427110550}, \
>>> {-0.00168718272676310080, -0.00137069152420374693, 3.051457492528748582,
>>>     0.00026536991493989622, -59.38147365750750826}}
>>>
>>> ?Chop
>>>
>>> Chop[expr] replaces approximate real numbers in expr that are close to
>>> zero by the exact integer 0.  >>
>>>
>>>
>>> Bob Hanlon
>>>
>>>
>>> On Mon, Sep 3, 2012 at 3:56 AM, Andreas Talmon l'Armée
>>> <talmon@fsm.tu-darmstadt.de> wrote:
>>>> Hi,
>>>>
>>>> My initial conditions are the following and I am pretty sure that my
>>>> solution consists only of a real part.
>>>> The Solution has four eigenvalues and they are complex conjugated. With
>>>> all
>>>> variables and all parameters real numbers I must be able to retrieve a
>>>> real
>>>> solution. But being a mathematica newbie,  I do not understand how to do
>>>> it
>>>> with mathematca.
>>>>
>>>> y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1
>>>>
>>>> My Notebook is also ready for download at dropbox.com:
>>>> http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb
>>>>
>>>> Clear[sol]
>>>>
>>>> $Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
>>>>      ic1 \[Element] Reals, c \[Element] Reals};
>>>>
>>>> sol[a_, x_] =
>>>>    y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
>>>>         y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1}, y[x],
>>>>        x][[1]] // FullSimplify
>>>>
>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>
>>>>
>>>>
>>>> Thanks for your help,
>>>>
>>>> Andreas
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 09/01/2012 08:27 AM, Bob Hanlon wrote:
>>>>> What are your initial conditions?
>>>>>
>>>>> Clear[sol]
>>>>>
>>>>> sol[a_, x_] = y[x] /. DSolve[
>>>>>         {y''''[x] + a y[x] == 0,
>>>>>          y[0] == ic0, y'[0] == ic1,
>>>>>          y''[0] == ic2, y'''[0] == ic3},
>>>>>         y[x], x][[1]] // FullSimplify
>>>>>
>>>>> (1/(2*a^(3/4)))*
>>>>>       (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>>>>>            (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>>>>>                     Sqrt[2]] + Sqrt[2]*
>>>>>                 (Sqrt[a]*ic1 + ic3)*
>>>>>                 Sin[(a^(1/4)*x)/Sqrt[2]]) +
>>>>>          (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>>>>>                 Cos[(a^(1/4)*x)/Sqrt[2]] +
>>>>>               2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>>>>>                     Sqrt[2]])*
>>>>>            Sinh[(a^(1/4)*x)/Sqrt[2]])
>>>>>
>>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>>
>>>>> a > 0
>>>>>
>>>>>
>>>>> Bob Hanlon
>>>>>
>>>>>
>>>>> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon
>>>>> l'Arm=E9e"@smc.vnet.net> wrote:
>>>>>> Hi All
>>>>>>
>>>>>> Is there a way to tell mathematica to solve only for real solutions. My
>>>>>> differential equation is of the kind
>>>>>>
>>>>>> y''''[x]+a y[x]==0
>>>>>>
>>>>>> a= constant coefficient
>>>>>>
>>>>>> I know that I get 4 komplex eigenvalues which are complex conjungated.
>>>>>> But y[x] is a real function.
>>>>>> Solving this equation with DSolve always gets a complex function y[x].
>>>>>>
>>>>>> Any Ideas.
>>>>>>
>>>>>> Thanks, Andreas
>>>>>>

[toc] | [prev] | [next] | [standalone]


#11603 — Re: Re: DSolve for a real function

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-09-04 09:47 +0000
SubjectRe: Re: DSolve for a real function
Message-ID<k24imr$1iu$1@smc.vnet.net>
In reply to#11539
Clear[sol];

$Assumptions = Element[{a, c, ic0, ic1}, Reals];

sol[a_, x_] =
 y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic0,
      y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]] // FullSimplify

((1 + I)*a^(1/4)*
          (I*E^(I*Sqrt[2]*a^(1/4)*c) -
             I*E^(Sqrt[2]*a^(1/4)*c) +
             E^(Sqrt[2]*a^(1/4)*
                  ((1 + I)*c + I*x)) -
             E^(I*Sqrt[2]*a^(1/4)*x) -
             E^(Sqrt[2]*a^(1/4)*x) +
             E^(Sqrt[2]*a^(1/4)*
                  ((1 + I)*c + x)) +
             I*E^(Sqrt[2]*a^(1/4)*
                    (I*c + (1 + I)*x)) -
             I*E^(Sqrt[2]*a^(1/4)*
                    (c + (1 + I)*x)))*ic0 +
        Sqrt[2]*(E^(I*Sqrt[2]*a^(1/4)*
                  c) + E^(Sqrt[2]*a^(1/4)*
                  c) + E^(Sqrt[2]*a^(1/4)*
                  ((1 + I)*c + I*x)) +
             E^(I*Sqrt[2]*a^(1/4)*x) +
             E^(Sqrt[2]*a^(1/4)*x) +
             E^(Sqrt[2]*a^(1/4)*
                  ((1 + I)*c + x)) +
             E^(Sqrt[2]*a^(1/4)*
                  (I*c + (1 + I)*x)) +
             E^(Sqrt[2]*a^(1/4)*
                  (c + (1 + I)*x)))*ic1)/
     E^((-1)^(1/4)*a^(1/4)*(c + x))/
   (4*a^(3/4)*(Sin[Sqrt[2]*a^(1/4)*
             c] + Sinh[Sqrt[2]*a^(1/4)*
             c]))

Table[sol[a, x] /. {
   c -> RandomReal[{0, 10}, WorkingPrecision -> 20],
   ic0 -> RandomReal[{0, 10}, WorkingPrecision -> 20],
   ic1 -> RandomReal[{0, 10}, WorkingPrecision -> 20]},
 {a, 1, 5}, {x, 0, 4}]

{{0.01540650723811880994 + 0.*10^-21 I, -0.0003703423761496348 +
   0.*10^-20 I, -0.1278269715054133646 + 0.*10^-20 I,
  0.0392723836429585004 + 0.*10^-20 I,
  13.10841701158527505 + 0.*10^-18 I}, {-0.00286328430472954469 +
   0.*10^-21 I, -1.985775360248369253 + 0.*10^-19 I, -0.311655087881410281 +
   0.*10^-19 I, -0.718055887186593765 + 0.*10^-19 I,
  21.42291506291193811 + 0.*10^-18 I}, {0.419394450195258310 + 0.*10^-19 I,
  0.01666534839706064001 + 0.*10^-21 I,
  0.528881084742103412 + 0.*10^-19 I, -0.060937975960727530 + 0.*10^-19 I,
  0.0086995512380544778 + 0.*10^-20 I}, {0.01847749159520439918 + 0.*10^-21I,
   0.00517593237021928535 + 0.*10^-21 I,
  0.0134376958759010127 + 0.*10^-20 I, -0.0679397801010012506 +
   0.*10^-20 I, -5.21491473427110550 +
   0.*10^-18 I}, {-0.00168718272676310080 +
   0.*10^-21 I, -0.00137069152420374693 + 0.*10^-21 I,
  3.051457492528748582 + 0.*10^-19 I,
  0.00026536991493989622 + 0.*10^-21 I, -59.38147365750750826 + 0.*10^-18 I}}

The imaginary parts cancel out; the residual imaginary parts are just
numerical noise. This can be removed with Chop

% // Chop

{{0.01540650723811880994, -0.0003703423761496348, -0.1278269715054133646,
  0.0392723836429585004,
  13.10841701158527505}, {-0.00286328430472954469, -1.985775360248369253, \
-0.311655087881410281, -0.718055887186593765,
  21.42291506291193811}, {0.419394450195258310, 0.01666534839706064001,
  0.528881084742103412, -0.060937975960727530,
  0.0086995512380544778}, {0.01847749159520439918, 0.00517593237021928535,
  0.0134376958759010127, -0.0679397801010012506, -5.21491473427110550}, \
{-0.00168718272676310080, -0.00137069152420374693, 3.051457492528748582,
  0.00026536991493989622, -59.38147365750750826}}

?Chop

Chop[expr] replaces approximate real numbers in expr that are close to
zero by the exact integer 0.  >>


Bob Hanlon


On Mon, Sep 3, 2012 at 3:56 AM, Andreas Talmon l'Arm=E9e
<talmon@fsm.tu-darmstadt.de> wrote:
> Hi,
>
> My initial conditions are the following and I am pretty sure that my
> solution consists only of a real part.
> The Solution has four eigenvalues and they are complex conjugated. With all
> variables and all parameters real numbers I must be able to retrieve a real
> solution. But being a mathematica newbie,  I do not understand how to do it
> with mathematca.
>
> y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] ==
= -ic1
>
> My Notebook is also ready for download at dropbox.com:
> http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb
>
> Clear[sol]
>
> $Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
>    ic1 \[Element] Reals, c \[Element] Reals};
>
> sol[a_, x_] =
>  y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
>       y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1}, y[x],
>      x][[1]] // FullSimplify
>
> Reduce[Element[sol[a, x], Reals], a, Reals]
>
>
>
> Thanks for your help,
>
> Andreas
>
>
>
>
>
>
>
> On 09/01/2012 08:27 AM, Bob Hanlon wrote:
>>
>> What are your initial conditions?
>>
>> Clear[sol]
>>
>> sol[a_, x_] = y[x] /. DSolve[
>>       {y''''[x] + a y[x] == 0,
>>        y[0] == ic0, y'[0] == ic1,
>>        y''[0] == ic2, y'''[0] == ic3},
>>       y[x], x][[1]] // FullSimplify
>>
>> (1/(2*a^(3/4)))*
>>     (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>>          (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>>                   Sqrt[2]] + Sqrt[2]*
>>               (Sqrt[a]*ic1 + ic3)*
>>               Sin[(a^(1/4)*x)/Sqrt[2]]) +
>>        (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>>               Cos[(a^(1/4)*x)/Sqrt[2]] +
>>             2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>>                   Sqrt[2]])*
>>          Sinh[(a^(1/4)*x)/Sqrt[2]])
>>
>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>
>> a > 0
>>
>>
>> Bob Hanlon
>>
>>
>> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon
>> l'Arm=E9e"@smc.vnet.net> wrote:
>>>
>>> Hi All
>>>
>>> Is there a way to tell mathematica to solve only for real solutions. My
>>> differential equation is of the kind
>>>
>>> y''''[x]+a y[x]==0
>>>
>>> a= constant coefficient
>>>
>>> I know that I get 4 komplex eigenvalues which are complex conjungated.
>>> But y[x] is a real function.
>>> Solving this equation with DSolve always gets a complex function y[x].
>>>
>>> Any Ideas.
>>>
>>> Thanks, Andreas
>>>
>

[toc] | [prev] | [next] | [standalone]


#11605 — Re: Re: DSolve for a real function

FromAndreas Talmon l'Armée
Date2012-09-04 09:47 +0000
SubjectRe: Re: DSolve for a real function
Message-ID<k24ing$1j5$1@smc.vnet.net>
In reply to#11539
You are completely right but I think there should be no real part in the 
solution.

I did the solution of the differential equation on paper and got the 
term for y1[x].

Then I determined the constants C[5]...C[8] with the boundary conditions 
with Solve[] in  Mathematica. There I got an unusual behaviour.

When using Simplify on the sol1 could generate a soltuion with only a 
real part.
When using FullSimplify I get the imaginary part which is very small for 
small x but for greater x also the imaginary part starts to oscillate 
with a great amplitude.

I do not understand how a solution can be Real or Complex depending on 
the Simplifications scheme I use.

Shouldn't there be one solution to a problem with specified boundary 
conditions.?

The notebook where I did all this is on:
http://dl.dropbox.com/u/4920002/DGL_4th_Order_with_own_solution.nb


Thanks for your great help,

Andreas.



On 09/03/2012 03:22 PM, Bob Hanlon wrote:
> Clear[sol];
>
> $Assumptions = Element[{a, c, ic0, ic1}, Reals];
>
> sol[a_, x_] =
>   y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic0,
>        y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]] // FullSimplify
>
> ((1 + I)*a^(1/4)*
>            (I*E^(I*Sqrt[2]*a^(1/4)*c) -
>               I*E^(Sqrt[2]*a^(1/4)*c) +
>               E^(Sqrt[2]*a^(1/4)*
>                    ((1 + I)*c + I*x)) -
>               E^(I*Sqrt[2]*a^(1/4)*x) -
>               E^(Sqrt[2]*a^(1/4)*x) +
>               E^(Sqrt[2]*a^(1/4)*
>                    ((1 + I)*c + x)) +
>               I*E^(Sqrt[2]*a^(1/4)*
>                      (I*c + (1 + I)*x)) -
>               I*E^(Sqrt[2]*a^(1/4)*
>                      (c + (1 + I)*x)))*ic0 +
>          Sqrt[2]*(E^(I*Sqrt[2]*a^(1/4)*
>                    c) + E^(Sqrt[2]*a^(1/4)*
>                    c) + E^(Sqrt[2]*a^(1/4)*
>                    ((1 + I)*c + I*x)) +
>               E^(I*Sqrt[2]*a^(1/4)*x) +
>               E^(Sqrt[2]*a^(1/4)*x) +
>               E^(Sqrt[2]*a^(1/4)*
>                    ((1 + I)*c + x)) +
>               E^(Sqrt[2]*a^(1/4)*
>                    (I*c + (1 + I)*x)) +
>               E^(Sqrt[2]*a^(1/4)*
>                    (c + (1 + I)*x)))*ic1)/
>       E^((-1)^(1/4)*a^(1/4)*(c + x))/
>     (4*a^(3/4)*(Sin[Sqrt[2]*a^(1/4)*
>               c] + Sinh[Sqrt[2]*a^(1/4)*
>               c]))
>
> Table[sol[a, x] /. {
>     c -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>     ic0 -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>     ic1 -> RandomReal[{0, 10}, WorkingPrecision -> 20]},
>   {a, 1, 5}, {x, 0, 4}]
>
> {{0.01540650723811880994 + 0.*10^-21 I, -0.0003703423761496348 +
>     0.*10^-20 I, -0.1278269715054133646 + 0.*10^-20 I,
>    0.0392723836429585004 + 0.*10^-20 I,
>    13.10841701158527505 + 0.*10^-18 I}, {-0.00286328430472954469 +
>     0.*10^-21 I, -1.985775360248369253 + 0.*10^-19 I, -0.311655087881410281 +
>     0.*10^-19 I, -0.718055887186593765 + 0.*10^-19 I,
>    21.42291506291193811 + 0.*10^-18 I}, {0.419394450195258310 + 0.*10^-19 I,
>    0.01666534839706064001 + 0.*10^-21 I,
>    0.528881084742103412 + 0.*10^-19 I, -0.060937975960727530 + 0.*10^-19 I,
>    0.0086995512380544778 + 0.*10^-20 I}, {0.01847749159520439918 + 0.*10^-21 I,
>     0.00517593237021928535 + 0.*10^-21 I,
>    0.0134376958759010127 + 0.*10^-20 I, -0.0679397801010012506 +
>     0.*10^-20 I, -5.21491473427110550 +
>     0.*10^-18 I}, {-0.00168718272676310080 +
>     0.*10^-21 I, -0.00137069152420374693 + 0.*10^-21 I,
>    3.051457492528748582 + 0.*10^-19 I,
>    0.00026536991493989622 + 0.*10^-21 I, -59.38147365750750826 + 0.*10^-18 I}}
>
> The imaginary parts cancel out; the residual imaginary parts are just
> numerical noise. This can be removed with Chop
>
> % // Chop
>
> {{0.01540650723811880994, -0.0003703423761496348, -0.1278269715054133646,
>    0.0392723836429585004,
>    13.10841701158527505}, {-0.00286328430472954469, -1.985775360248369253, \
> -0.311655087881410281, -0.718055887186593765,
>    21.42291506291193811}, {0.419394450195258310, 0.01666534839706064001,
>    0.528881084742103412, -0.060937975960727530,
>    0.0086995512380544778}, {0.01847749159520439918, 0.00517593237021928535,
>    0.0134376958759010127, -0.0679397801010012506, -5.21491473427110550}, \
> {-0.00168718272676310080, -0.00137069152420374693, 3.051457492528748582,
>    0.00026536991493989622, -59.38147365750750826}}
>
> ?Chop
>
> Chop[expr] replaces approximate real numbers in expr that are close to
> zero by the exact integer 0.  >>
>
>
> Bob Hanlon
>
>
> On Mon, Sep 3, 2012 at 3:56 AM, Andreas Talmon l'Armée
> <talmon@fsm.tu-darmstadt.de> wrote:
>> Hi,
>>
>> My initial conditions are the following and I am pretty sure that my
>> solution consists only of a real part.
>> The Solution has four eigenvalues and they are complex conjugated. With all
>> variables and all parameters real numbers I must be able to retrieve a real
>> solution. But being a mathematica newbie,  I do not understand how to do it
>> with mathematca.
>>
>> y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1
>>
>> My Notebook is also ready for download at dropbox.com:
>> http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb
>>
>> Clear[sol]
>>
>> $Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
>>     ic1 \[Element] Reals, c \[Element] Reals};
>>
>> sol[a_, x_] =
>>   y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
>>        y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1}, y[x],
>>       x][[1]] // FullSimplify
>>
>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>
>>
>>
>> Thanks for your help,
>>
>> Andreas
>>
>>
>>
>>
>>
>>
>>
>> On 09/01/2012 08:27 AM, Bob Hanlon wrote:
>>> What are your initial conditions?
>>>
>>> Clear[sol]
>>>
>>> sol[a_, x_] = y[x] /. DSolve[
>>>        {y''''[x] + a y[x] == 0,
>>>         y[0] == ic0, y'[0] == ic1,
>>>         y''[0] == ic2, y'''[0] == ic3},
>>>        y[x], x][[1]] // FullSimplify
>>>
>>> (1/(2*a^(3/4)))*
>>>      (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>>>           (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>>>                    Sqrt[2]] + Sqrt[2]*
>>>                (Sqrt[a]*ic1 + ic3)*
>>>                Sin[(a^(1/4)*x)/Sqrt[2]]) +
>>>         (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>>>                Cos[(a^(1/4)*x)/Sqrt[2]] +
>>>              2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>>>                    Sqrt[2]])*
>>>           Sinh[(a^(1/4)*x)/Sqrt[2]])
>>>
>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>
>>> a > 0
>>>
>>>
>>> Bob Hanlon
>>>
>>>
>>> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon
>>> l'Arm=E9e"@smc.vnet.net> wrote:
>>>> Hi All
>>>>
>>>> Is there a way to tell mathematica to solve only for real solutions. My
>>>> differential equation is of the kind
>>>>
>>>> y''''[x]+a y[x]==0
>>>>
>>>> a= constant coefficient
>>>>
>>>> I know that I get 4 komplex eigenvalues which are complex conjungated.
>>>> But y[x] is a real function.
>>>> Solving this equation with DSolve always gets a complex function y[x].
>>>>
>>>> Any Ideas.
>>>>
>>>> Thanks, Andreas
>>>>

[toc] | [prev] | [next] | [standalone]


#11610 — Re: DSolve for a real function

FromAndreas Talmon l'Armée
Date2012-09-04 09:52 +0000
SubjectRe: DSolve for a real function
Message-ID<k24j07$1ro$1@smc.vnet.net>
In reply to#11539
Hi,

My initial conditions are the following and I am pretty sure that my 
solution consists only of a real part.
The Solution has four eigenvalues and they are complex conjugated. With 
all variables and all parameters real numbers I must be able to retrieve 
a real solution. But being a mathematica newbie,  I do not understand 
how to do it with mathematca.

y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1

My Notebook is also ready for download at dropbox.com:
http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb

Clear[sol]

$Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
    ic1 \[Element] Reals, c \[Element] Reals};

sol[a_, x_] =
  y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
       y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1}, y[x],
      x][[1]] // FullSimplify

Reduce[Element[sol[a, x], Reals], a, Reals]



Thanks for your help,

Andreas






On 09/01/2012 08:27 AM, Bob Hanlon wrote:
> What are your initial conditions?
>
> Clear[sol]
>
> sol[a_, x_] = y[x] /. DSolve[
>       {y''''[x] + a y[x] == 0,
>        y[0] == ic0, y'[0] == ic1,
>        y''[0] == ic2, y'''[0] == ic3},
>       y[x], x][[1]] // FullSimplify
>
> (1/(2*a^(3/4)))*
>     (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>          (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>                   Sqrt[2]] + Sqrt[2]*
>               (Sqrt[a]*ic1 + ic3)*
>               Sin[(a^(1/4)*x)/Sqrt[2]]) +
>        (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>               Cos[(a^(1/4)*x)/Sqrt[2]] +
>             2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>                   Sqrt[2]])*
>          Sinh[(a^(1/4)*x)/Sqrt[2]])
>
> Reduce[Element[sol[a, x], Reals], a, Reals]
>
> a > 0
>
>
> Bob Hanlon
>
>
> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon l'Arm=E9e"@smc.vnet.net> wrote:
>> Hi All
>>
>> Is there a way to tell mathematica to solve only for real solutions. My
>> differential equation is of the kind
>>
>> y''''[x]+a y[x]==0
>>
>> a= constant coefficient
>>
>> I know that I get 4 komplex eigenvalues which are complex conjungated.
>> But y[x] is a real function.
>> Solving this equation with DSolve always gets a complex function y[x].
>>
>> Any Ideas.
>>
>> Thanks, Andreas
>>

[toc] | [prev] | [next] | [standalone]


#11613 — Re: DSolve for a real function

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-09-04 09:52 +0000
SubjectRe: DSolve for a real function
Message-ID<k24j17$1ru$1@smc.vnet.net>
In reply to#11539
In numerical computations, the specific computations and their order
of computation determine the accumulation of the numerical noise. You
generally reduce the accumulation of numerical noise by increasing the
working precision.

For example in your t2 rather than using machine precision specify
extended precision (say 55 places)

t2 = Table[
   y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100, 10}] //N[#, 55] &

Similarly, when plotting y4

pRe2 = Plot[
   Chop[y4[x]] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100},
   WorkingPrecision -> 55, PlotStyle -> Red];

pIm2 = Plot[Im[y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}],
  {x, 0, 100}, WorkingPrecision -> 55,
  Frame -> True, Axes -> False]


Bob Hanlon


On Mon, Sep 3, 2012 at 10:22 AM, Andreas Talmon l'Arm=E9e
<talmon@fsm.tu-darmstadt.de> wrote:
> You are completely right but I think there should be no real part in the
> solution.
>
> I did the solution of the differential equation on paper and got the term
> for y1[x].
>
> Then I determined the constants C[5]...C[8] with the boundary conditions
> with Solve[] in  Mathematica. There I got an unusual behaviour.
>
> When using Simplify on the sol1 could generate a soltuion with only a real
> part.
> When using FullSimplify I get the imaginary part which is very small for
> small x but for greater x also the imaginary part starts to oscillate with a
> great amplitude.
>
> I do not understand how a solution can be Real or Complex depending on the
> Simplifications scheme I use.
>
> Shouldn't there be one solution to a problem with specified boundary
> conditions.?
>
> The notebook where I did all this is on:
> http://dl.dropbox.com/u/4920002/DGL_4th_Order_with_own_solution.nb
>
>
> Thanks for your great help,
>
> Andreas.
>
>
>
>
> On 09/03/2012 03:22 PM, Bob Hanlon wrote:
>>
>> Clear[sol];
>>
>> $Assumptions = Element[{a, c, ic0, ic1}, Reals];
>>
>> sol[a_, x_] =
>>   y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic0,
>>        y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]] // FullSimplify
>>
>> ((1 + I)*a^(1/4)*
>>            (I*E^(I*Sqrt[2]*a^(1/4)*c) -
>>               I*E^(Sqrt[2]*a^(1/4)*c) +
>>               E^(Sqrt[2]*a^(1/4)*
>>                    ((1 + I)*c + I*x)) -
>>               E^(I*Sqrt[2]*a^(1/4)*x) -
>>               E^(Sqrt[2]*a^(1/4)*x) +
>>               E^(Sqrt[2]*a^(1/4)*
>>                    ((1 + I)*c + x)) +
>>               I*E^(Sqrt[2]*a^(1/4)*
>>                      (I*c + (1 + I)*x)) -
>>               I*E^(Sqrt[2]*a^(1/4)*
>>                      (c + (1 + I)*x)))*ic0 +
>>          Sqrt[2]*(E^(I*Sqrt[2]*a^(1/4)*
>>                    c) + E^(Sqrt[2]*a^(1/4)*
>>                    c) + E^(Sqrt[2]*a^(1/4)*
>>                    ((1 + I)*c + I*x)) +
>>               E^(I*Sqrt[2]*a^(1/4)*x) +
>>               E^(Sqrt[2]*a^(1/4)*x) +
>>               E^(Sqrt[2]*a^(1/4)*
>>                    ((1 + I)*c + x)) +
>>               E^(Sqrt[2]*a^(1/4)*
>>                    (I*c + (1 + I)*x)) +
>>               E^(Sqrt[2]*a^(1/4)*
>>                    (c + (1 + I)*x)))*ic1)/
>>       E^((-1)^(1/4)*a^(1/4)*(c + x))/
>>     (4*a^(3/4)*(Sin[Sqrt[2]*a^(1/4)*
>>               c] + Sinh[Sqrt[2]*a^(1/4)*
>>               c]))
>>
>> Table[sol[a, x] /. {
>>     c -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>     ic0 -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>     ic1 -> RandomReal[{0, 10}, WorkingPrecision -> 20]},
>>   {a, 1, 5}, {x, 0, 4}]
>>
>> {{0.01540650723811880994 + 0.*10^-21 I, -0.0003703423761496348 +
>>     0.*10^-20 I, -0.1278269715054133646 + 0.*10^-20 I,
>>    0.0392723836429585004 + 0.*10^-20 I,
>>    13.10841701158527505 + 0.*10^-18 I}, {-0.00286328430472954469 +
>>     0.*10^-21 I, -1.985775360248369253 + 0.*10^-19 I,
>> -0.311655087881410281 +
>>     0.*10^-19 I, -0.718055887186593765 + 0.*10^-19 I,
>>    21.42291506291193811 + 0.*10^-18 I}, {0.419394450195258310 + 0.*10^-19
>> I,
>>    0.01666534839706064001 + 0.*10^-21 I,
>>    0.528881084742103412 + 0.*10^-19 I, -0.060937975960727530 + 0.*10^-19
>> I,
>>    0.0086995512380544778 + 0.*10^-20 I}, {0.01847749159520439918 +
>> 0.*10^-21 I,
>>     0.00517593237021928535 + 0.*10^-21 I,
>>    0.0134376958759010127 + 0.*10^-20 I, -0.0679397801010012506 +
>>     0.*10^-20 I, -5.21491473427110550 +
>>     0.*10^-18 I}, {-0.00168718272676310080 +
>>     0.*10^-21 I, -0.00137069152420374693 + 0.*10^-21 I,
>>    3.051457492528748582 + 0.*10^-19 I,
>>    0.00026536991493989622 + 0.*10^-21 I, -59.38147365750750826 + 0.*10^-18
>> I}}
>>
>> The imaginary parts cancel out; the residual imaginary parts are just
>> numerical noise. This can be removed with Chop
>>
>> % // Chop
>>
>> {{0.01540650723811880994, -0.0003703423761496348, -0.1278269715054133646,
>>    0.0392723836429585004,
>>    13.10841701158527505}, {-0.00286328430472954469, -1.985775360248369253,
>> \
>> -0.311655087881410281, -0.718055887186593765,
>>    21.42291506291193811}, {0.419394450195258310, 0.01666534839706064001,
>>    0.528881084742103412, -0.060937975960727530,
>>    0.0086995512380544778}, {0.01847749159520439918,
>> 0.00517593237021928535,
>>    0.0134376958759010127, -0.0679397801010012506, -5.21491473427110550},\
>> {-0.00168718272676310080, -0.00137069152420374693, 3.051457492528748582,
>>    0.00026536991493989622, -59.38147365750750826}}
>>
>> ?Chop
>>
>> Chop[expr] replaces approximate real numbers in expr that are close to
>> zero by the exact integer 0.  >>
>>
>>
>> Bob Hanlon
>>
>>
>> On Mon, Sep 3, 2012 at 3:56 AM, Andreas Talmon l'Arm=E9e
>> <talmon@fsm.tu-darmstadt.de> wrote:
>>>
>>> Hi,
>>>
>>> My initial conditions are the following and I am pretty sure that my
>>> solution consists only of a real part.
>>> The Solution has four eigenvalues and they are complex conjugated. With
>>> all
>>> variables and all parameters real numbers I must be able to retrieve a
>>> real
>>> solution. But being a mathematica newbie,  I do not understand how to do
>>> it
>>> with mathematca.
>>>
>>> y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] ==
= -ic1
>>>
>>> My Notebook is also ready for download at dropbox.com:
>>> http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb
>>>
>>> Clear[sol]
>>>
>>> $Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
>>>     ic1 \[Element] Reals, c \[Element] Reals};
>>>
>>> sol[a_, x_] =
>>>   y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
>>>        y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1}, y[=
x],
>>>       x][[1]] // FullSimplify
>>>
>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>
>>>
>>>
>>> Thanks for your help,
>>>
>>> Andreas
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 09/01/2012 08:27 AM, Bob Hanlon wrote:
>>>>
>>>> What are your initial conditions?
>>>>
>>>> Clear[sol]
>>>>
>>>> sol[a_, x_] = y[x] /. DSolve[
>>>>        {y''''[x] + a y[x] == 0,
>>>>         y[0] == ic0, y'[0] == ic1,
>>>>         y''[0] == ic2, y'''[0] == ic3},
>>>>        y[x], x][[1]] // FullSimplify
>>>>
>>>> (1/(2*a^(3/4)))*
>>>>      (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>>>>           (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>>>>                    Sqrt[2]] + Sqrt[2]*
>>>>                (Sqrt[a]*ic1 + ic3)*
>>>>                Sin[(a^(1/4)*x)/Sqrt[2]]) +
>>>>         (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>>>>                Cos[(a^(1/4)*x)/Sqrt[2]] +
>>>>              2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>>>>                    Sqrt[2]])*
>>>>           Sinh[(a^(1/4)*x)/Sqrt[2]])
>>>>
>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>
>>>> a > 0
>>>>
>>>>
>>>> Bob Hanlon
>>>>
>>>>
>>>> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon
>>>> l'Arm=E9e"@smc.vnet.net> wrote:
>>>>>
>>>>> Hi All
>>>>>
>>>>> Is there a way to tell mathematica to solve only for real solutions. =
My
>>>>> differential equation is of the kind
>>>>>
>>>>> y''''[x]+a y[x]==0
>>>>>
>>>>> a= constant coefficient
>>>>>
>>>>> I know that I get 4 komplex eigenvalues which are complex conjungated=
.
>>>>> But y[x] is a real function.
>>>>> Solving this equation with DSolve always gets a complex function y[x]=
.
>>>>>
>>>>> Any Ideas.
>>>>>
>>>>> Thanks, Andreas
>>>>>
>

[toc] | [prev] | [next] | [standalone]


#11649 — Re: DSolve for a real function

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-09-07 08:58 +0000
SubjectRe: DSolve for a real function
Message-ID<k2ccv2$f3e$1@smc.vnet.net>
In reply to#11539
The solutions are real in the region of interest, i.e., all of the
complex components cancel out even if these cancellations are not
explicit in the representation. A trivial example of a real expression
that on the surface may look complex is  ((a+b*I) + (a-b*I)). In this
case the cancellation of the imaginaary parts can be easily done. Your
expression is sufficiently intricate that it is exceedingly difficult
if not impossible to find a representation that explicitly cancels out
all of the complex parts in a symbolic form.

sol1 = y[x] /.
   DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic=
0,
      y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]];

sol2 = Simplify[sol1, {a > 0, Element[{ic0, ic1, c, x}, Reals]}];

sol3 = ComplexExpand[sol2];

sol4 = Simplify[sol3, {a > 0, Element[{ic0, ic1, c, x}, Reals]},
   TimeConstraint -> 1000];

For at least some exact values of the constants, the cancellations can
be done for some of these representations resulting in explicitly real
representations

sol3x = FullSimplify[sol3 /.
   {ic0 -> 2, ic1 -> 2, c -> 1, a -> 1}]

((-1 + Sqrt[2] + (1 + Sqrt[2])*
               E^(Sqrt[2]*(1 + x)))*
          Cos[(-1 + x)/Sqrt[2]] +
        ((1 + Sqrt[2])*E^Sqrt[2] +
             (-1 + Sqrt[2])*
               E^(Sqrt[2]*x))*
          Cos[(1 + x)/Sqrt[2]] +
        (1 + E^(Sqrt[2]*(1 + x)))*
          Sin[(-1 + x)/Sqrt[2]] -
        (E^Sqrt[2] + E^(Sqrt[2]*x))*
          Sin[(1 + x)/Sqrt[2]])/
     E^((1 + x)/Sqrt[2])/
   (Sin[Sqrt[2]] + Sinh[Sqrt[2]])

Plot[sol3x, {x, 0, 9}]

For specific numerical evaluations of the expressions--particularly
for large values of x, using machine precision numbers can result in
very large numerical noise which precludes the proper calculation of
the imaginary components.

{sol1, sol2, sol3, sol4} /. {
  ic0 -> RandomReal[{1, 10}],
  ic1 -> RandomReal[{1, 10}],
  c -> RandomReal[{1, 10}],
  a -> RandomReal[{1, 10}],
  x -> 100}

{1.2276490765332772*^39 +
     2.8031967442314214*^25*I,
   1.2276490765333458*^39 +
     2.0702854660900525*^25*I,
   1.2276490765333507*^39 +
     1.8728905471061013*^25*I,
   1.2276490765333449*^39 +
     1.735742182536485*^25*I}

Using much higher precision can cause the cancellation of the
imaginary components to work effectively resulting in negligible
imaginary components

{sol1, sol2, sol3,
  sol4} /. {ic0 -> RandomReal[{1, 10}, WorkingPrecision -> 75],
  ic1 -> RandomReal[{1, 10}, WorkingPrecision -> 75],
  c -> RandomReal[{1, 10}, WorkingPrecision -> 75],
  a -> RandomReal[{1, 10}, WorkingPrecision -> 75],
  x -> 100}

{3.5466406369437226924022894337705\
   5420786716057206415883532647413844\
   97269532445274677294054176313`72.0\
   723740502742*^36 +
     0``35.52384127280971*I,
   3.546640636943722692402289433770\
   5542078671605720641588353264741384\
    4972695324452746772940541761`72.62\
   40529160406*^36 +
     0``36.11439423733123*I,
   3.546640636943722692402289433770\
   5542078671605720641588353264741384\
    497269532445274677294054176096`72.\
   52533544339316*^36 +
     0``35.98812103665155*I,
   3.546640636943722692402289433770\
   5542078671605720641588353264741384\
    497269532445274677294054176072`72.\
   79515994843076*^36 +
     0``36.3762727216666*I}

The residual imaginary artifacts are removed with Chop

% // Chop

{3.5466406369437226924022894337705\
  5420786716057206415883532647413844\
  97269532445274677294054176313`72.0\
  723740502742*^36,
 3.54664063694372\
  2692402289433770554207867160572064\
  1588353264741384497269532445274677\
  2940541761`72.6240529160406*^36,
 3\
  .546640636943722692402289433770554\
  2078671605720641588353264741384497\
  269532445274677294054176096`72.525\
  33544339316*^36,
 3.546640636943722\
  6924022894337705542078671605720641\
  5883532647413844972695324452746772\
  94054176072`72.79515994843076*^36}


Bob Hanlon


On Thu, Sep 6, 2012 at 4:26 AM, Andreas Talmon l'Arm=E9e
<talmon@fsm.tu-darmstadt.de> wrote:
> I also posted  my problem at
>
> http://mathematica.stackexchange.com/questions/10253/dsolve-gives-complex=
-function-although-the-solution-is-a-real-one
>
> and got the answer to do something like:
>
> sol1 = DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] =
== ic0 ,
>
>      y'''[-c] == ic1 , y'''[c] == - ic1
>     }, y[x], x];
>
> sol2 = Simplify[
>   sol1, {a > 0, ic0 \[Element] Reals, ic1 \[Element] Reals,
>    c \[Element] Reals, x \[Element] Reals}]
>
> sol3 = ComplexExpand[y[x] /. sol2[[1, 1]]]
>
>
> sol4 = Simplify[
>   sol3, {a > 0, ic0 \[Element] Reals, ic1 \[Element] Reals,
>    c \[Element] Reals, x \[Element] Reals}, TimeConstraint -> 1000]
>
> But the solution is still complex.
> In sol3 I have the solution decomposed in an Real and Imaginary part. Any
> ideas how to extract only the Real part of the solution?
>
> Re[sol3] does not work
> Simplify[Re[sol3]] also does not work
>
> Andreas Talmon l'Arm=E9e
>
>
>
>
> On 09/03/2012 06:54 PM, Bob Hanlon wrote:
>>
>> In numerical computations, the specific computations and their order
>> of computation determine the accumulation of the numerical noise. You
>> generally reduce the accumulation of numerical noise by increasing the
>> working precision.
>>
>> For example in your t2 rather than using machine precision specify
>> extended precision (say 55 places)
>>
>> t2 = Table[
>>     y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100, 10}] //N[=
#,
>> 55] &
>>
>> Similarly, when plotting y4
>>
>> pRe2 = Plot[
>>     Chop[y4[x]] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100},
>>     WorkingPrecision -> 55, PlotStyle -> Red];
>>
>> pIm2 = Plot[Im[y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}],
>>    {x, 0, 100}, WorkingPrecision -> 55,
>>    Frame -> True, Axes -> False]
>>
>>
>> Bob Hanlon
>>
>>
>> On Mon, Sep 3, 2012 at 10:22 AM, Andreas Talmon l'Arm=E9e
>> <talmon@fsm.tu-darmstadt.de> wrote:
>>>
>>> You are completely right but I think there should be no real part in th=
e
>>> solution.
>>>
>>> I did the solution of the differential equation on paper and got the te=
rm
>>> for y1[x].
>>>
>>> Then I determined the constants C[5]...C[8] with the boundary condition=
s
>>> with Solve[] in  Mathematica. There I got an unusual behaviour.
>>>
>>> When using Simplify on the sol1 could generate a soltuion with only a
>>> real
>>> part.
>>> When using FullSimplify I get the imaginary part which is very small fo=
r
>>> small x but for greater x also the imaginary part starts to oscillate
>>> with a
>>> great amplitude.
>>>
>>> I do not understand how a solution can be Real or Complex depending on
>>> the
>>> Simplifications scheme I use.
>>>
>>> Shouldn't there be one solution to a problem with specified boundary
>>> conditions.?
>>>
>>> The notebook where I did all this is on:
>>> http://dl.dropbox.com/u/4920002/DGL_4th_Order_with_own_solution.nb
>>>
>>>
>>> Thanks for your great help,
>>>
>>> Andreas.
>>>
>>>
>>>
>>>
>>> On 09/03/2012 03:22 PM, Bob Hanlon wrote:
>>>>
>>>> Clear[sol];
>>>>
>>>> $Assumptions = Element[{a, c, ic0, ic1}, Reals];
>>>>
>>>> sol[a_, x_] =
>>>>    y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''=
[c] ==
>>>> ic0,
>>>>         y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]] // Fu=
llSimplify
>>>>
>>>> ((1 + I)*a^(1/4)*
>>>>             (I*E^(I*Sqrt[2]*a^(1/4)*c) -
>>>>                I*E^(Sqrt[2]*a^(1/4)*c) +
>>>>                E^(Sqrt[2]*a^(1/4)*
>>>>                     ((1 + I)*c + I*x)) -
>>>>                E^(I*Sqrt[2]*a^(1/4)*x) -
>>>>                E^(Sqrt[2]*a^(1/4)*x) +
>>>>                E^(Sqrt[2]*a^(1/4)*
>>>>                     ((1 + I)*c + x)) +
>>>>                I*E^(Sqrt[2]*a^(1/4)*
>>>>                       (I*c + (1 + I)*x)) -
>>>>                I*E^(Sqrt[2]*a^(1/4)*
>>>>                       (c + (1 + I)*x)))*ic0 +
>>>>           Sqrt[2]*(E^(I*Sqrt[2]*a^(1/4)*
>>>>                     c) + E^(Sqrt[2]*a^(1/4)*
>>>>                     c) + E^(Sqrt[2]*a^(1/4)*
>>>>                     ((1 + I)*c + I*x)) +
>>>>                E^(I*Sqrt[2]*a^(1/4)*x) +
>>>>                E^(Sqrt[2]*a^(1/4)*x) +
>>>>                E^(Sqrt[2]*a^(1/4)*
>>>>                     ((1 + I)*c + x)) +
>>>>                E^(Sqrt[2]*a^(1/4)*
>>>>                     (I*c + (1 + I)*x)) +
>>>>                E^(Sqrt[2]*a^(1/4)*
>>>>                     (c + (1 + I)*x)))*ic1)/
>>>>        E^((-1)^(1/4)*a^(1/4)*(c + x))/
>>>>      (4*a^(3/4)*(Sin[Sqrt[2]*a^(1/4)*
>>>>                c] + Sinh[Sqrt[2]*a^(1/4)*
>>>>                c]))
>>>>
>>>> Table[sol[a, x] /. {
>>>>      c -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>>>      ic0 -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>>>      ic1 -> RandomReal[{0, 10}, WorkingPrecision -> 20]},
>>>>    {a, 1, 5}, {x, 0, 4}]
>>>>
>>>> {{0.01540650723811880994 + 0.*10^-21 I, -0.0003703423761496348 +
>>>>      0.*10^-20 I, -0.1278269715054133646 + 0.*10^-20 I,
>>>>     0.0392723836429585004 + 0.*10^-20 I,
>>>>     13.10841701158527505 + 0.*10^-18 I}, {-0.00286328430472954469 +
>>>>      0.*10^-21 I, -1.985775360248369253 + 0.*10^-19 I,
>>>> -0.311655087881410281 +
>>>>      0.*10^-19 I, -0.718055887186593765 + 0.*10^-19 I,
>>>>     21.42291506291193811 + 0.*10^-18 I}, {0.419394450195258310 +
>>>> 0.*10^-19
>>>> I,
>>>>     0.01666534839706064001 + 0.*10^-21 I,
>>>>     0.528881084742103412 + 0.*10^-19 I, -0.060937975960727530 +
>>>> 0.*10^-19
>>>> I,
>>>>     0.0086995512380544778 + 0.*10^-20 I}, {0.01847749159520439918 +
>>>> 0.*10^-21 I,
>>>>      0.00517593237021928535 + 0.*10^-21 I,
>>>>     0.0134376958759010127 + 0.*10^-20 I, -0.0679397801010012506 +
>>>>      0.*10^-20 I, -5.21491473427110550 +
>>>>      0.*10^-18 I}, {-0.00168718272676310080 +
>>>>      0.*10^-21 I, -0.00137069152420374693 + 0.*10^-21 I,
>>>>     3.051457492528748582 + 0.*10^-19 I,
>>>>     0.00026536991493989622 + 0.*10^-21 I, -59.38147365750750826 +
>>>> 0.*10^-18
>>>> I}}
>>>>
>>>> The imaginary parts cancel out; the residual imaginary parts are just
>>>> numerical noise. This can be removed with Chop
>>>>
>>>> % // Chop
>>>>
>>>> {{0.01540650723811880994, -0.0003703423761496348,
>>>> -0.1278269715054133646,
>>>>     0.0392723836429585004,
>>>>     13.10841701158527505}, {-0.00286328430472954469,
>>>> -1.985775360248369253,
>>>> \
>>>> -0.311655087881410281, -0.718055887186593765,
>>>>     21.42291506291193811}, {0.419394450195258310,
>>>> 0.01666534839706064001,
>>>>     0.528881084742103412, -0.060937975960727530,
>>>>     0.0086995512380544778}, {0.01847749159520439918,
>>>> 0.00517593237021928535,
>>>>     0.0134376958759010127, -0.0679397801010012506,
>>>> -5.21491473427110550}, \
>>>> {-0.00168718272676310080, -0.00137069152420374693, 3.05145749252874858=
2,
>>>>     0.00026536991493989622, -59.38147365750750826}}
>>>>
>>>> ?Chop
>>>>
>>>> Chop[expr] replaces approximate real numbers in expr that are close to
>>>> zero by the exact integer 0.  >>
>>>>
>>>>
>>>> Bob Hanlon
>>>>
>>>>
>>>> On Mon, Sep 3, 2012 at 3:56 AM, Andreas Talmon l'Arm=E9e
>>>> <talmon@fsm.tu-darmstadt.de> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> My initial conditions are the following and I am pretty sure that my
>>>>> solution consists only of a real part.
>>>>> The Solution has four eigenvalues and they are complex conjugated. Wi=
th
>>>>> all
>>>>> variables and all parameters real numbers I must be able to retrieve =
a
>>>>> real
>>>>> solution. But being a mathematica newbie,  I do not understand how to
>>>>> do
>>>>> it
>>>>> with mathematca.
>>>>>
>>>>> y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] =
== -ic1
>>>>>
>>>>> My Notebook is also ready for download at dropbox.com:
>>>>> http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb
>>>>>
>>>>> Clear[sol]
>>>>>
>>>>> $Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
>>>>>      ic1 \[Element] Reals, c \[Element] Reals};
>>>>>
>>>>> sol[a_, x_] =
>>>>>    y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
>>>>>         y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1},=
 y[x],
>>>>>        x][[1]] // FullSimplify
>>>>>
>>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>>
>>>>>
>>>>>
>>>>> Thanks for your help,
>>>>>
>>>>> Andreas
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 09/01/2012 08:27 AM, Bob Hanlon wrote:
>>>>>>
>>>>>> What are your initial conditions?
>>>>>>
>>>>>> Clear[sol]
>>>>>>
>>>>>> sol[a_, x_] = y[x] /. DSolve[
>>>>>>         {y''''[x] + a y[x] == 0,
>>>>>>          y[0] == ic0, y'[0] == ic1,
>>>>>>          y''[0] == ic2, y'''[0] == ic3},
>>>>>>         y[x], x][[1]] // FullSimplify
>>>>>>
>>>>>> (1/(2*a^(3/4)))*
>>>>>>       (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>>>>>>            (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>>>>>>                     Sqrt[2]] + Sqrt[2]*
>>>>>>                 (Sqrt[a]*ic1 + ic3)*
>>>>>>                 Sin[(a^(1/4)*x)/Sqrt[2]]) +
>>>>>>          (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>>>>>>                 Cos[(a^(1/4)*x)/Sqrt[2]] +
>>>>>>               2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>>>>>>                     Sqrt[2]])*
>>>>>>            Sinh[(a^(1/4)*x)/Sqrt[2]])
>>>>>>
>>>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>>>
>>>>>> a > 0
>>>>>>
>>>>>>
>>>>>> Bob Hanlon
>>>>>>
>>>>>>
>>>>>> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon
>>>>>> l'Arm=E9e"@smc.vnet.net> wrote:
>>>>>>>
>>>>>>> Hi All
>>>>>>>
>>>>>>> Is there a way to tell mathematica to solve only for real solutions=
.
>>>>>>> My
>>>>>>> differential equation is of the kind
>>>>>>>
>>>>>>> y''''[x]+a y[x]==0
>>>>>>>
>>>>>>> a= constant coefficient
>>>>>>>
>>>>>>> I know that I get 4 komplex eigenvalues which are complex
>>>>>>> conjungated.
>>>>>>> But y[x] is a real function.
>>>>>>> Solving this equation with DSolve always gets a complex function
>>>>>>> y[x].
>>>>>>>
>>>>>>> Any Ideas.
>>>>>>>
>>>>>>> Thanks, Andreas
>>>>>>>
>

[toc] | [prev] | [next] | [standalone]


#11652 — Re: DSolve for a real function

FromAndreas Talmon l'Armée
Date2012-09-07 09:01 +0000
SubjectRe: DSolve for a real function
Message-ID<k2cd4q$f5h$1@smc.vnet.net>
In reply to#11539
I also posted  my problem at

http://mathematica.stackexchange.com/questions/10253/dsolve-gives-complex-function-although-the-solution-is-a-real-one

and got the answer to do something like:

sol1 = DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic0 ,
      y'''[-c] == ic1 , y'''[c] == - ic1
     }, y[x], x];

sol2 = Simplify[
   sol1, {a > 0, ic0 \[Element] Reals, ic1 \[Element] Reals,
    c \[Element] Reals, x \[Element] Reals}]

sol3 = ComplexExpand[y[x] /. sol2[[1, 1]]]


sol4 = Simplify[
   sol3, {a > 0, ic0 \[Element] Reals, ic1 \[Element] Reals,
    c \[Element] Reals, x \[Element] Reals}, TimeConstraint -> 1000]

But the solution is still complex.
In sol3 I have the solution decomposed in an Real and Imaginary part. 
Any ideas how to extract only the Real part of the solution?

Re[sol3] does not work
Simplify[Re[sol3]] also does not work

Andreas Talmon l'Armée



On 09/03/2012 06:54 PM, Bob Hanlon wrote:
> In numerical computations, the specific computations and their order
> of computation determine the accumulation of the numerical noise. You
> generally reduce the accumulation of numerical noise by increasing the
> working precision.
>
> For example in your t2 rather than using machine precision specify
> extended precision (say 55 places)
>
> t2 = Table[
>     y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100, 10}] //N[#, 55] &
>
> Similarly, when plotting y4
>
> pRe2 = Plot[
>     Chop[y4[x]] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}, {x, 0, 100},
>     WorkingPrecision -> 55, PlotStyle -> Red];
>
> pIm2 = Plot[Im[y4[x] /. {c -> 1, ic0 -> 2, ic1 -> 3, a -> 4}],
>    {x, 0, 100}, WorkingPrecision -> 55,
>    Frame -> True, Axes -> False]
>
>
> Bob Hanlon
>
>
> On Mon, Sep 3, 2012 at 10:22 AM, Andreas Talmon l'Armée
> <talmon@fsm.tu-darmstadt.de> wrote:
>> You are completely right but I think there should be no real part in the
>> solution.
>>
>> I did the solution of the differential equation on paper and got the term
>> for y1[x].
>>
>> Then I determined the constants C[5]...C[8] with the boundary conditions
>> with Solve[] in  Mathematica. There I got an unusual behaviour.
>>
>> When using Simplify on the sol1 could generate a soltuion with only a real
>> part.
>> When using FullSimplify I get the imaginary part which is very small for
>> small x but for greater x also the imaginary part starts to oscillate with a
>> great amplitude.
>>
>> I do not understand how a solution can be Real or Complex depending on the
>> Simplifications scheme I use.
>>
>> Shouldn't there be one solution to a problem with specified boundary
>> conditions.?
>>
>> The notebook where I did all this is on:
>> http://dl.dropbox.com/u/4920002/DGL_4th_Order_with_own_solution.nb
>>
>>
>> Thanks for your great help,
>>
>> Andreas.
>>
>>
>>
>>
>> On 09/03/2012 03:22 PM, Bob Hanlon wrote:
>>> Clear[sol];
>>>
>>> $Assumptions = Element[{a, c, ic0, ic1}, Reals];
>>>
>>> sol[a_, x_] =
>>>    y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0, y''[c] == ic0,
>>>         y'''[-c] == ic1, y'''[c] == -ic1}, y[x], x][[1]] // FullSimplify
>>>
>>> ((1 + I)*a^(1/4)*
>>>             (I*E^(I*Sqrt[2]*a^(1/4)*c) -
>>>                I*E^(Sqrt[2]*a^(1/4)*c) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + I*x)) -
>>>                E^(I*Sqrt[2]*a^(1/4)*x) -
>>>                E^(Sqrt[2]*a^(1/4)*x) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + x)) +
>>>                I*E^(Sqrt[2]*a^(1/4)*
>>>                       (I*c + (1 + I)*x)) -
>>>                I*E^(Sqrt[2]*a^(1/4)*
>>>                       (c + (1 + I)*x)))*ic0 +
>>>           Sqrt[2]*(E^(I*Sqrt[2]*a^(1/4)*
>>>                     c) + E^(Sqrt[2]*a^(1/4)*
>>>                     c) + E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + I*x)) +
>>>                E^(I*Sqrt[2]*a^(1/4)*x) +
>>>                E^(Sqrt[2]*a^(1/4)*x) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     ((1 + I)*c + x)) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     (I*c + (1 + I)*x)) +
>>>                E^(Sqrt[2]*a^(1/4)*
>>>                     (c + (1 + I)*x)))*ic1)/
>>>        E^((-1)^(1/4)*a^(1/4)*(c + x))/
>>>      (4*a^(3/4)*(Sin[Sqrt[2]*a^(1/4)*
>>>                c] + Sinh[Sqrt[2]*a^(1/4)*
>>>                c]))
>>>
>>> Table[sol[a, x] /. {
>>>      c -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>>      ic0 -> RandomReal[{0, 10}, WorkingPrecision -> 20],
>>>      ic1 -> RandomReal[{0, 10}, WorkingPrecision -> 20]},
>>>    {a, 1, 5}, {x, 0, 4}]
>>>
>>> {{0.01540650723811880994 + 0.*10^-21 I, -0.0003703423761496348 +
>>>      0.*10^-20 I, -0.1278269715054133646 + 0.*10^-20 I,
>>>     0.0392723836429585004 + 0.*10^-20 I,
>>>     13.10841701158527505 + 0.*10^-18 I}, {-0.00286328430472954469 +
>>>      0.*10^-21 I, -1.985775360248369253 + 0.*10^-19 I,
>>> -0.311655087881410281 +
>>>      0.*10^-19 I, -0.718055887186593765 + 0.*10^-19 I,
>>>     21.42291506291193811 + 0.*10^-18 I}, {0.419394450195258310 + 0.*10^-19
>>> I,
>>>     0.01666534839706064001 + 0.*10^-21 I,
>>>     0.528881084742103412 + 0.*10^-19 I, -0.060937975960727530 + 0.*10^-19
>>> I,
>>>     0.0086995512380544778 + 0.*10^-20 I}, {0.01847749159520439918 +
>>> 0.*10^-21 I,
>>>      0.00517593237021928535 + 0.*10^-21 I,
>>>     0.0134376958759010127 + 0.*10^-20 I, -0.0679397801010012506 +
>>>      0.*10^-20 I, -5.21491473427110550 +
>>>      0.*10^-18 I}, {-0.00168718272676310080 +
>>>      0.*10^-21 I, -0.00137069152420374693 + 0.*10^-21 I,
>>>     3.051457492528748582 + 0.*10^-19 I,
>>>     0.00026536991493989622 + 0.*10^-21 I, -59.38147365750750826 + 0.*10^-18
>>> I}}
>>>
>>> The imaginary parts cancel out; the residual imaginary parts are just
>>> numerical noise. This can be removed with Chop
>>>
>>> % // Chop
>>>
>>> {{0.01540650723811880994, -0.0003703423761496348, -0.1278269715054133646,
>>>     0.0392723836429585004,
>>>     13.10841701158527505}, {-0.00286328430472954469, -1.985775360248369253,
>>> \
>>> -0.311655087881410281, -0.718055887186593765,
>>>     21.42291506291193811}, {0.419394450195258310, 0.01666534839706064001,
>>>     0.528881084742103412, -0.060937975960727530,
>>>     0.0086995512380544778}, {0.01847749159520439918,
>>> 0.00517593237021928535,
>>>     0.0134376958759010127, -0.0679397801010012506, -5.21491473427110550}, \
>>> {-0.00168718272676310080, -0.00137069152420374693, 3.051457492528748582,
>>>     0.00026536991493989622, -59.38147365750750826}}
>>>
>>> ?Chop
>>>
>>> Chop[expr] replaces approximate real numbers in expr that are close to
>>> zero by the exact integer 0.  >>
>>>
>>>
>>> Bob Hanlon
>>>
>>>
>>> On Mon, Sep 3, 2012 at 3:56 AM, Andreas Talmon l'Armée
>>> <talmon@fsm.tu-darmstadt.de> wrote:
>>>> Hi,
>>>>
>>>> My initial conditions are the following and I am pretty sure that my
>>>> solution consists only of a real part.
>>>> The Solution has four eigenvalues and they are complex conjugated. With
>>>> all
>>>> variables and all parameters real numbers I must be able to retrieve a
>>>> real
>>>> solution. But being a mathematica newbie,  I do not understand how to do
>>>> it
>>>> with mathematca.
>>>>
>>>> y''[-c] == ic0, y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1
>>>>
>>>> My Notebook is also ready for download at dropbox.com:
>>>> http://dl.dropbox.com/u/4920002/DGL_4th_Order.nb
>>>>
>>>> Clear[sol]
>>>>
>>>> $Assumptions = {a \[Element] Reals, ic0 \[Element] Reals,
>>>>      ic1 \[Element] Reals, c \[Element] Reals};
>>>>
>>>> sol[a_, x_] =
>>>>    y[x] /. DSolve[{y''''[x] + a y[x] == 0, y''[-c] == ic0,
>>>>         y''[c] == ic0, y'''[-c] == ic1, y'''[c] == -ic1}, y[x],
>>>>        x][[1]] // FullSimplify
>>>>
>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>
>>>>
>>>>
>>>> Thanks for your help,
>>>>
>>>> Andreas
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 09/01/2012 08:27 AM, Bob Hanlon wrote:
>>>>> What are your initial conditions?
>>>>>
>>>>> Clear[sol]
>>>>>
>>>>> sol[a_, x_] = y[x] /. DSolve[
>>>>>         {y''''[x] + a y[x] == 0,
>>>>>          y[0] == ic0, y'[0] == ic1,
>>>>>          y''[0] == ic2, y'''[0] == ic3},
>>>>>         y[x], x][[1]] // FullSimplify
>>>>>
>>>>> (1/(2*a^(3/4)))*
>>>>>       (Cosh[(a^(1/4)*x)/Sqrt[2]]*
>>>>>            (2*a^(3/4)*ic0*Cos[(a^(1/4)*x)/
>>>>>                     Sqrt[2]] + Sqrt[2]*
>>>>>                 (Sqrt[a]*ic1 + ic3)*
>>>>>                 Sin[(a^(1/4)*x)/Sqrt[2]]) +
>>>>>          (Sqrt[2]*(Sqrt[a]*ic1 - ic3)*
>>>>>                 Cos[(a^(1/4)*x)/Sqrt[2]] +
>>>>>               2*a^(1/4)*ic2*Sin[(a^(1/4)*x)/
>>>>>                     Sqrt[2]])*
>>>>>            Sinh[(a^(1/4)*x)/Sqrt[2]])
>>>>>
>>>>> Reduce[Element[sol[a, x], Reals], a, Reals]
>>>>>
>>>>> a > 0
>>>>>
>>>>>
>>>>> Bob Hanlon
>>>>>
>>>>>
>>>>> On Fri, Aug 31, 2012 at 3:59 AM,  <"Andreas Talmon
>>>>> l'Arm=E9e"@smc.vnet.net> wrote:
>>>>>> Hi All
>>>>>>
>>>>>> Is there a way to tell mathematica to solve only for real solutions. My
>>>>>> differential equation is of the kind
>>>>>>
>>>>>> y''''[x]+a y[x]==0
>>>>>>
>>>>>> a= constant coefficient
>>>>>>
>>>>>> I know that I get 4 komplex eigenvalues which are complex conjungated.
>>>>>> But y[x] is a real function.
>>>>>> Solving this equation with DSolve always gets a complex function y[x].
>>>>>>
>>>>>> Any Ideas.
>>>>>>
>>>>>> Thanks, Andreas
>>>>>>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web