## 7 Badges

12 years, 299 days
Phd.
Paris, France

## Hi   I read  the topic,...

Hi

I read  the topic, but as long as I've understood this kind of ordering problem should be present when {} sets are used. I'm using only ordered set [a,b,..], Arrays and Matrix, which should have an ordering. So I still don't understand  where the random beahaviur could come from.

Does it come from the add ? And what shoud I do ?!

thanks

S.

edit: addictionally, I'm not talking about some percent difference in the aswers, but in doubled answers, or negative ones

## Hi   I read  the topic,...

Hi

I read  the topic, but as long as I've understood this kind of ordering problem should be present when {} sets are used. I'm using only ordered set [a,b,..], Arrays and Matrix, which should have an ordering. So I still don't understand  where the random beahaviur could come from.

Does it come from the add ? And what shoud I do ?!

thanks

S.

edit: addictionally, I'm not talking about some percent difference in the aswers, but in doubled answers, or negative ones

## doesn't work...

I acer

In your exemple you started from a maple input form:

```> (1.3*10^(-5)*Enn+0.4*10^(-2))/z;
```
```
```
```and obtained a form like

0.00001300000000 Enn + 0.004000000000
-------------------------------------
z
```

I want the contrary: start from

```>                -152                 69     2                  56       2
> 0.1291711820 10     (0.1949398271 10   Enn~  - 0.1454151532 10   I Enn~ )
>   -------------------------------------------------------------------------
>                                            6
>                                        Enn~```

(if I use lprint on this I get an error: Error, unexpected number)    and obtain

``` 0.1291711820*10^(-152)*( etc ...

Maybe I haven't understood your suggestion....

S.
```

## doesn't work...

I acer

In your exemple you started from a maple input form:

```> (1.3*10^(-5)*Enn+0.4*10^(-2))/z;
```
```
```
```and obtained a form like

0.00001300000000 Enn + 0.004000000000
-------------------------------------
z
```

I want the contrary: start from

```>                -152                 69     2                  56       2
> 0.1291711820 10     (0.1949398271 10   Enn~  - 0.1454151532 10   I Enn~ )
>   -------------------------------------------------------------------------
>                                            6
>                                        Enn~```

(if I use lprint on this I get an error: Error, unexpected number)    and obtain

``` 0.1291711820*10^(-152)*( etc ...

Maybe I haven't understood your suggestion....

S.
```

## Hi Patrick thanks for your...

Hi Patrick

thanks for your advice. I was aware of the Realdomain package. However I think I can't use it, because all along the calculations in my program must be complex (I work a lot in fourier frequency space) and it is only the result that should be real, due to the particular form of the scalar product I consider ( A B* + A*B which must be real)

Thanks anyway. I ruled out nearly all the complex noise by using simplify(A B* +A*B) before passing it as an integrand

S.

## Hi Patrick thanks for your...

Hi Patrick

thanks for your advice. I was aware of the Realdomain package. However I think I can't use it, because all along the calculations in my program must be complex (I work a lot in fourier frequency space) and it is only the result that should be real, due to the particular form of the scalar product I consider ( A B* + A*B which must be real)

Thanks anyway. I ruled out nearly all the complex noise by using simplify(A B* +A*B) before passing it as an integrand

S.

## Hi   using the command line...

Hi

using the command line tips Acer and Doug suggested I get output files on the form of text files, and so many expressions in there, lixe for ex:

-83

0.2197029755 10

- ------------------ +

4

Enn~

-166                              82     2                                     67         2

0.7039115316 10     (0.1348155815 10   Enn~  + 0.4926052755 10   I Enn~ )

-------------------------------------------------------------------------

6

Enn~

cannot be used in a worksheet directly (copy-paste) but I've to rewrite them by hands, and it's  a long and boring (and errors creating) operation. Is there a way to produce an output on the form of 1D valid maple output? Or a way to convert this stuff up there to valid maple input?

Thanks

S.

## Hi   using the command line...

Hi

using the command line tips Acer and Doug suggested I get output files on the form of text files, and so many expressions in there, lixe for ex:

-83

0.2197029755 10

- ------------------ +

4

Enn~

-166                              82     2                                     67         2

0.7039115316 10     (0.1348155815 10   Enn~  + 0.4926052755 10   I Enn~ )

-------------------------------------------------------------------------

6

Enn~

cannot be used in a worksheet directly (copy-paste) but I've to rewrite them by hands, and it's  a long and boring (and errors creating) operation. Is there a way to produce an output on the form of 1D valid maple output? Or a way to convert this stuff up there to valid maple input?

Thanks

S.

## Hi Acer   thanks very much,...

Hi Acer

thanks very much, with your suggestion I can go further this weekend with my work.

I think I should extend your idea in order to allow Enn to have different powers in the integrand (luckily Enn can have only few possible powers so it shouldn't be too long)

S.

## Hi Acer   thanks very much,...

Hi Acer

thanks very much, with your suggestion I can go further this weekend with my work.

I think I should extend your idea in order to allow Enn to have different powers in the integrand (luckily Enn can have only few possible powers so it shouldn't be too long)

S.

## Hi I've a problem using the...

Hi

I've a problem using the method acer proposed, dealing with integral of piecewise functions.

the procedure which perform the integration is:

scalar_pr:= proc(A,B)
global variables, parameters,f_low, f_high,S_h,M_tot,eta_eff;
local num;

num:=simplify(A*conjugate(B)+conjugate(A)*B) assuming f::positive ;
evalf( 2*IntegrationTools:-Expand( Int(num/S_h(f), f=f_low..f_high) ) );
end proc:

where S_h is real, and so are f_low and f_high (both float and positive).

A and B are piecewise functions (on f)
The procedure return

0.1250000000e67*(Int(piecewise(f < 1854.940034, 0., f < 2505.554090, 25.06256602*Enn/f^(4/3), f < 2987.078913, -0.1650825435e35*Enn*f^2/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3-0.5347322412e37*Enn*f/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3+0.1548151373e41*Enn/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3, 2987.078913 <= f, 0.)*f^(207/50)/(0.2832534716e27+0.3063855833e22*f^2-0.1444531250e23*f^(107/50)+0.6781250000e19*f^(207/50)-0.1500811250e15*f^(307/50)+1623376149.*f^(407/50)), f = 10.0 .. 2987.078913))+0.1352082208e62*(Int(piecewise(f < 1854.940034, 0., f < 2505.554090, 25.06256602*Enn/f^(4/3), f < 2987.078913, -0.1650825435e35*Enn*f^2/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3-0.5347322412e37*Enn*f/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3+0.1548151373e41*Enn/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3, 2987.078913 <= f, 0.)*f^(307/50)/(0.2832534716e27+0.3063855833e22*f^2-0.1444531250e23*f^(107/50)+0.6781250000e19*f^(207/50)-0.1500811250e15*f^(307/50)+1623376149.*f^(407/50)), f = 10.0 .. 2987.078913))

So I think the problem is still the same, that maple doesn't put Enn out from the integrals, even in I used the IntegrationTools:-Expand procedure

any hints?

Thanks

S.

## Hi I've a problem using the...

Hi

I've a problem using the method acer proposed, dealing with integral of piecewise functions.

the procedure which perform the integration is:

scalar_pr:= proc(A,B)
global variables, parameters,f_low, f_high,S_h,M_tot,eta_eff;
local num;

num:=simplify(A*conjugate(B)+conjugate(A)*B) assuming f::positive ;
evalf( 2*IntegrationTools:-Expand( Int(num/S_h(f), f=f_low..f_high) ) );
end proc:

where S_h is real, and so are f_low and f_high (both float and positive).

A and B are piecewise functions (on f)
The procedure return

0.1250000000e67*(Int(piecewise(f < 1854.940034, 0., f < 2505.554090, 25.06256602*Enn/f^(4/3), f < 2987.078913, -0.1650825435e35*Enn*f^2/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3-0.5347322412e37*Enn*f/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3+0.1548151373e41*Enn/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3, 2987.078913 <= f, 0.)*f^(207/50)/(0.2832534716e27+0.3063855833e22*f^2-0.1444531250e23*f^(107/50)+0.6781250000e19*f^(207/50)-0.1500811250e15*f^(307/50)+1623376149.*f^(407/50)), f = 10.0 .. 2987.078913))+0.1352082208e62*(Int(piecewise(f < 1854.940034, 0., f < 2505.554090, 25.06256602*Enn/f^(4/3), f < 2987.078913, -0.1650825435e35*Enn*f^2/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3-0.5347322412e37*Enn*f/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3+0.1548151373e41*Enn/(2467401101.*f^2-0.3996179422e13*f+0.1652814029e16)^3, 2987.078913 <= f, 0.)*f^(307/50)/(0.2832534716e27+0.3063855833e22*f^2-0.1444531250e23*f^(107/50)+0.6781250000e19*f^(207/50)-0.1500811250e15*f^(307/50)+1623376149.*f^(407/50)), f = 10.0 .. 2987.078913))

So I think the problem is still the same, that maple doesn't put Enn out from the integrals, even in I used the IntegrationTools:-Expand procedure

any hints?

Thanks

S.

## Hi Patrick   the imaginary...

Hi Patrick

the imaginary part is indeed much smaller that the real one, and, additionally, I found out that the real part is a good solution ( ie: the real part is the same I'd obtain if I tell to Maple from the beginning that the solution must be real).
However my preoccupation is that, in what follow, these complex parts could been multiplied together and give a REAL noise in the result (even if small ).

I would to use few commands in my procedures, as they must be execuded hundred of times, and a little command as Re() would take some non zero time at the end.

## Hi Patrick   the imaginary...

Hi Patrick

the imaginary part is indeed much smaller that the real one, and, additionally, I found out that the real part is a good solution ( ie: the real part is the same I'd obtain if I tell to Maple from the beginning that the solution must be real).
However my preoccupation is that, in what follow, these complex parts could been multiplied together and give a REAL noise in the result (even if small ).

I would to use few commands in my procedures, as they must be execuded hundred of times, and a little command as Re() would take some non zero time at the end.

## Hi I discovered that it work...

Hi

I discovered that it works well if I break the command in two parts:

storage:= simplify( A B* +  A* B) assuming f::positive:
evalf(IntegrationTools:-Expand(2*Int( storage, f=f_low..f_high))) :

only I really can't understand why Maple doesn't simplify automatically that expression, if it knows that f is positive (as the two extreme are real positive float numbers)!!!
And, if I remember well, an expression like A B* + A* B should be real whitout regards on what the scalars functions A and B are (reals or complex)
I feel there is something important I don't understand about this Maple's behaviour.

Thank for any remarks.

S.V.

 First 6 7 8 9 10 Page 8 of 10
﻿