Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to find the zero of a mysterious function sigma defined by a differential equation of the following form $$u*\sigma'(u)+(1-\chi_0)*\sigma(u)+\sum_{k=1}^{D} \sigma(u-x_k)(\chi_{k-1}-\chi_{k})=0,$$ with the initial condition $\sigma(u)=u^{\chi(0)-1}$ if $u<=x_1$ and $\sigma(u)=0$ if $u<0$ in these two cases: ($D=10$ for both cases and $x_0=0$)

1) $x_k=1/(3*(D-k+1))$ and $$\chi_k=8* (\cos((2*(D-k)+3)π/(3*(D-k)+4)))^3-4* \cos((2*(D-k)+3)π/(3*(D-k)+4)).$$ 2) $x_k= 1/(2*(D-k+1))$ and $$\chi_k=16* \cos(((D-k)+2)π/(2*(D-k)+5))^4 -12*\cos(((D-k)+2)π/(2*(D-k)+5)))^2 +1.$$ I want just to mention that the sequence $(x_k)$ is increasing and we have $$x_0=0<x_1<x_2<...<x_D<X_{D+1}=+\infty.$$ This is the Mathematica formal:

1)For the first case:

chi[k_]:=8* (Cos[(2*(D-k)+3)π/(3*(D-k)+4)])^3-4* Cos[(2*(D-k)+3)π/(3*(D-k)+4)] 
dsol3:[D_]=NDSolve[{ud'[u]+(1-chi[0]) d[u]+Sum[d[u-x[k]]*(chi[k-1]-chi[k]) ,{k,1,D}]]==0, d[u/; u<=x[1]]==If[u<=0, 0, u^(chi[0]-1)]},d,{u,0,6000}] 
sigma3[u_]:=Evaluate[d[u]]/. First[Evaluate[dsol3[D]]] NSolve[sigma3[u]==0,{u,0,6000}]

2)For the second case:

chi[k_]:=16* (Cos[(K1-k+2)π/(2*(K1-k)+5)])^4 -12*( Cos[(K1-k+2)π/(2*(K1-k)+5)])^2 +1 
dsol4:[D_]=NDSolve[{ud'[u]+(1-chi[0]) d[u]+Sum[d[u-x[k]]*(chi[k-1]-chi[k]) ,{k,1,D}]]==0, d[u/; u<=x[1]]==If[u<=0, 0, u^(chi[0]-1)]},d,{u,0,6000}] 
sigma4[u_]:=Evaluate[d[u]]/. First[Evaluate[dsol4[D]]] NSolve[sigma4[u]==0,{u,0,6000}] 

Thank you. Khadija

share|improve this question
Is this a general math question? This site is about the software Mathematica... – Yves Klett Jun 13 '15 at 22:31
Please provide your equation and parameter definitions in Mathematica format. – bbgodfrey Jun 14 '15 at 2:23
Please edit all relevant info and code into the question. – Yves Klett Jun 14 '15 at 6:57
I reformatted your code to make it readable, but it certainly is not correct. Please check for syntax errors, such as the use of the protected symbol D. – bbgodfrey Jun 14 '15 at 12:20
Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. – bbgodfrey Jun 14 '15 at 16:59
up vote 4 down vote accepted

This delay differential equation can be solved numerically as follows. For case 1,

n = 10;
x[k_] := If[k == 0, 0, 1/(3*(n - k + 1))] 
chi[k_] := 8*(Cos[(2*(n - k) + 3) π/(3*(n - k) + 4)])^3 - 
        4*Cos[(2*(n - k) + 3) π/(3*(n - k) + 4)]

s = NDSolveValue[{u d'[u] + (1 - chi[0]) d[u] + 
      Sum[d[u - x[k]]*(chi[k - 1] - chi[k]), {k, 1, n}] == 0, 
      d[u /; u <= x[1]] == If[u <= 0, 0, u^(chi[0] - 1)]}, d, {u, x[1], 5}]
Plot[s[u], {u, x[1], 5}, PlotRange -> {-2 10^-8, 2 10^-8}, AxesLabel -> {u, d}]

enter image description here

FindRoot[s[u], {u, 2.2}]
{* {u -> 2.25542} *}

The second case is similar

x[k_] := If[k == 0, 0, 1/(2*(n - k + 1))]
chi[k_] := 16*(Cos[(n - k + 2) π/(2*(n - k) + 5)])^4 - 
        12*(Cos[(n - k + 2) π/(2*(n - k) + 5)])^2 + 1

with a zero at 3.20177.

share|improve this answer
@Khadija, why don't you try running it yourself? Also, I removed a comment asking to be e-mailed the results; this is considered disrespectful. – J. M. Jun 14 '15 at 20:51
I am sorry if I caused any disturbance. I tried with my Mathemtica version but it didn't work that's why I asked to compile this one by someone who has a more advanced version than the mine. – Khadija Mbarki Jun 14 '15 at 21:37
@KhadijaMbarki No harm done from my perspective. You might wish to delete your three Comments containing significant amounts of code, however. Slide the cursor to the right of the end of a comment to see a red "x" that allows deletion. I do hope that you become an active contributor to StackExchange. Best wishes. – bbgodfrey Jun 14 '15 at 22:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.