Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Derivative of a real function gives Complex res...' topicStudent Support Forum > General > "Derivative of a real function gives Complex res..."

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Sumit
11/24/12 02:03am

Hi Dimanche,

I think the problem is due to differentiability of Abs. You must have noticed "Abs'[]" in your output. So long you are interested in values Abs do its job perfectly. If you can define the derivative of Abs function the imaginary part will vanish. For example

absolute[x_ + I y_] := Sqrt[x^2 + y^2]
f1[x_] := Simplify[Sin[2*Pi*x/10] + I*Cos[2*Pi*x/20]]
f2[x_] := absolute[f1[x]]
f3[x_] := f2'[x]
f3[1] // N

0.184658

Or if you want to stick with Abs then you have to teach him differentiation, like

diff[f_, x_, x0_, h_] := 1/h (f[x0 + h/2] - f[x0 - h/2])
f1[x_] := Simplify[Sin[2*Pi*x/10] + I*Cos[2*Pi*x/20]]
f2[x_] := Abs[f1[x]]
x0 = 1;
h = .0001;
diff[f2, x, x0, h]

0.184658

Hope it will answer you.
Best,
-Sumit

URL: ,

Subject (listing for 'Derivative of a real function gives Complex res...')
Author Date Posted
Derivative of a real function gives Complex res... Dimanche 11/22/12 8:24pm
Re: Derivative of a real function gives Complex... Nasser M. Ab... 11/24/12 00:50am
Re: Derivative of a real function gives Complex... Sumit 11/24/12 02:03am
Re: Re: Derivative of a real function gives Com... Dimanche 11/24/12 12:03pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic