From: Nasser M. Abbasi on
On 7/12/2010 1:37 AM, Mate wrote:
> On Jul 12, 10:43 am, Vladimir Bondarenko<v...(a)cybertester.com> wrote:
>> Hello,
>>
>> erfc(3/2*(-1)^(3/4))
>> +erfc((1-I)*(1+sqrt(2)/4))
>> +(1+I)*(I*FresnelC(3/sqrt(2*Pi))
>> -I*FresnelC(2/sqrt(Pi)+1/sqrt(2*Pi))
>> -FresnelS(3/sqrt(2*Pi))
>> +FresnelS(2/sqrt(Pi)+1/sqrt(2*Pi))
>> );
>>
>> ?
>
> evalc(simplify(value(convert(%,compose,erf,Int,exp))));
>
> 2
>
>
> Mate

Very nice.

I tried to repeat your steps in Mathematica.

Matchematica does not have the neat convert facility present in Maple,
but one can use pattern transformation to do the conversion.

(Mathematica has only TrigToExp and ExpToTrig for explicit conversion)

Even though I translated this maple code

convert(%,compose,erf,Int,exp)

to Mathematica, the problem is that I needed to use Hold in the process
to prevent Mathematica from putting the expression back to its original
form.

Hold[] is Mathematica function to tell it to not Evaluate the expression.

For example, consider this:

FresnelC[3/Sqrt[2*Pi]]

In Maple, one writes convert(%,Int) to get

Int(cos((1/2)*Pi*_k1^2), _k1 = 0 .. (3/2)*sqrt(2)/sqrt(Pi))

In Mathematica, if I do the conversion (without Hold) as in:

% /. FresnelC[s_] -> Integrate[Cos[(Pi*t^2)/2], {t, 0, s}]

I get back

FresnelC[3/Sqrt[2*Pi]]

Since it simplified it back to FresnelC[s] again!

So I have to use Hold:

% /. FresnelC[s_] -> Hold[Integrate[Cos[(Pi*t^2)/2], {t, 0, s}]]
Out[189]= Hold[Integrate[Cos[(Pi*t^2)/2], {t, 0, 3/Sqrt[2*Pi]}]]

And this is what I did for the rest of the terms.

The problem is that now my final expression, which match Maple's, but it
has all these Hold's in them.

If I release the Holds, Mathematica snaps the expression back to its
original form.

So, I could not evaluate the last expression as you did using Maple
value() function.

I am sure there is a way to do this in Mathematica. May be a Mathematica
expert can do it. But here is the transformation in Mathematica:


In[199]:= Erfc[(3/2)*(-1)^(3/4)] + Erfc[(1 - I)*(1 + Sqrt[2]/4)] +
(1 + I)*(I*FresnelC[3/Sqrt[2*Pi]] -
I*FresnelC[2/Sqrt[Pi] + 1/Sqrt[2*Pi]] - FresnelS[3/Sqrt[2*Pi]] +
FresnelS[2/Sqrt[Pi] + 1/Sqrt[2*Pi]]);

% /. Erfc[s_] -> 1 - (2/Sqrt[Pi])*Hold[Integrate[Exp[-t^2],{t, 0,s}]];

% /. FresnelS[s_] -> Hold[Integrate[Sin[(Pi*t^2)/2], {t, 0, s}]];

% /. FresnelC[s_] -> Hold[Integrate[Cos[(Pi*t^2)/2], {t, 0, s}]];

% /. Sin[s_] -> (Exp[I*s] - Exp[(-I)*s])/(2*I);

% /. Cos[s_] -> (Exp[I*s] + Exp[(-I)*s])/2


2 + (1 + I)*(-Hold[Integrate[(-(1/2))*I*(-E^((-(1/2))*I*(Pi*t^2)) +
E^((1/2)*I*(Pi*t^2))), {t, 0, 3/Sqrt[2*Pi]}]] +
Hold[Integrate[(-(1/2))*I*(-E^((-(1/2))*I*(Pi*t^2)) +
E^((1/2)*I*(Pi*t^2))), {t, 0, 2/Sqrt[Pi] + 1/Sqrt[2*Pi]}]] +
I*Hold[Integrate[(1/2)*(E^((-(1/2))*I*(Pi*t^2)) +
E^((1/2)*I*(Pi*t^2))), {t, 0, 3/Sqrt[2*Pi]}]] -
I*Hold[Integrate[(1/2)*(E^((-(1/2))*I*(Pi*t^2)) +
E^((1/2)*I*(Pi*t^2))), {t, 0, 2/Sqrt[Pi] + 1/Sqrt[2*Pi]}]]) -
(2*Hold[Integrate[Exp[-t^2], {t, 0, (3/2)*(-1)^(3/4)}]])/Sqrt[Pi] -
(2*Hold[Integrate[Exp[-t^2], {t, 0, (1 - I)*(1 + 1/(2*Sqrt[2]))}]])/
Sqrt[Pi]


--Nasser