I define a function (using f[x_]:=) as the definite integral (from 0
to x) of sin(t^2). When I differentiate using Mathematica I get the
correct answer of sin(x^2).
But when I define a function (using g[x_]:=) as the definite integral
(from 0 to x) of e^(-t^2) and differentiate, I get the incorrect
answer of 0. (The correct answer is e^(-x^2).)
Why the inconsistency?
Oddly, if I define the function g above using "=" instead of ":=", all
works well.
Can someone explain the odd behavior?
Thanks,
Len
Running both 6.0.3 and 7.0.1, I don't seem to get that problem:
In[1]:= f[x_]:=Integrate[Sin[t^2],{t,0,x}]
In[2]:= D[f[x],x]
Out[2]= Sin[x^2]
In[3]:= g[x_]:=Integrate[Exp[-t^2],{t,0,x}]
In[4]:= D[g[x],x]
Out[4]= E^-x^2
Simon
f'[x]
Sin[x^2]
g'[x]
0
I believe that's the discrepancy to which the original poster refers.
And this originates from what you'll see if you use the FullForm, the
FullForm of h'[x] being Derivative[1][h][x]:
Derivative[1][f]
(FresnelS^\[Prime])[Sqrt[2/\[Pi]] #1]&
Derivative[1][g]
0&
The latter arises from:
g[x]
1/2 Sqrt[\[Pi]] Erf[x]
So I don't understand why the derivative of g is the constantly 0
function. After all, Mathematica DOES know:
Derivative[1][Erf]
(2 E^-#1^2)/Sqrt[\[Pi]]&
And that surely is not the zero function!
--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
??g
If you get a strange result, it is often useful to kill the kernel so
that you start with a clean slate.
David Bailey
http://www.dbaileyconsultancy.co.uk
In[4]:= f[x_] := Integrate[Sin[t^2], {t, 0, x}]
In[5]:= D[f[x], x]
Out[5]= Sin[x^2]
In[6]:= g[x_] := Integrate[Exp[-t^2], {t, 0, x}]
In[7]:= D[g[x], x]
Out[7]= E^-x^2
On Thursday 11 June 2009 07:44:34 pm Len wrote:
> Greetings:
>
> I define a function (using f[x_]:=) as the definite integral (from 0
> to x) of sin(t^2). When I differentiate using Mathematica I get the
> correct answer of sin(x^2).
>
> But when I define a function (using g[x_]:=) as the definite integral
> (from 0 to x) of e^(-t^2) and differentiate, I get the incorrect
> answer of 0. (The correct answer is e^(-x^2).)
>
> Why the inconsistency?
>
> Oddly, if I define the function g above using "=" instead of ":=", all
> works well.
>
> Can someone explain the odd behavior?
>
> Thanks,
>
> Len
>
>
--
==================================
Curtis Osterhoudt
cfo@remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
==================================
I define a function (using f[x_]:=) as the definite integral (from 0
to x) of sin(t^2). When I differentiate using Mathematica I get the
correct answer of sin(x^2).
But when I define a function (using g[x_]:=) as the definite integral
(from 0 to x) of e^(-t^2) and differentiate, I get the incorrect
answer of 0. (The correct answer is e^(-x^2).)
Why the inconsistency?
Oddly, if I define the function g above using "=" instead of ":=", all
works well.
Can someone explain the odd behavior?
Thanks,
Len
Hi, Len,
I tried and this is the result:
In[3]:= g[x_] := Integrate[Exp[-t^2], {t, 0, x}]
In[4]:= D[g[x], x]
Out[4]= \[ExponentialE]^-x^2
Sorry, Alexei
--
Alexei Boulbitch, Dr., habil.
Senior Scientist
IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg
Phone: +352 2454 2566
Fax: +352 2454 3566
Website: www.iee.lu
This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.
Interesting! Like you, I get correct results when differentiating
using "D". But when I differentiate using the prime sign (g'[x] ) I
get the incorrect answer of 0.
Len
this is nonsens.
f[x_] := Integrate[Sin[t^2], {t, 0, x}]
g[x_] := Integrate[Exp[-t^2], {t, 0, x}]
D[#, x] & /@ {g[x], f[x]}
gives
{E^(-x^2), Sin[x^2]}
That is why it is useful to post your full input and not a
verbal description.
Regards
Jens
> Interesting! Like you, I get correct results when differentiating
> using "D". But when I differentiate using the prime sign (g'[x] ) I
> get the incorrect answer of 0.
I think this is a case where Trace is useful, and when looking at the
output of Trace it seems clear that this is why it goes wrong for g':
In[14]:= Integrate[Exp[-t^2], {t, 0, #}]
Out[14]= 1/2 Sqrt[\[Pi]] Erf[3]
In[15]:= Integrate[Sin[t], {t, 0, #}]
Out[15]= 1 - Cos[#1]
I think Out[14] clearly is a bug, because whatever # may be, it is not 3
in almost all cases :-)
hth,
albert
2009/6/12 Len <lwap...@gmail.com>:
> Greetings:
>
> I define a function (using f[x_]:=) as the definite integral (from 0
> to x) of sin(t^2). When I differentiate using Mathematica I get the
> correct answer of sin(x^2).
>
> But when I define a function (using g[x_]:=) as the definite integral
> (from 0 to x) of e^(-t^2) and differentiate, I get the incorrect
> answer of 0. (The correct answer is e^(-x^2).)
>
> Why the inconsistency?
>
> Oddly, if I define the function g above using "=" instead of ":=", al=
l
> works well.
>
> Can someone explain the odd behavior?
>
> Thanks,
>
> Len
>
>
--
Peter Lindsay