I am trying to solve the system of PDE with NDSolve and I got an error message like this

NDSolve::deqn: "Equation or list of equations expected instead of

ConditionalExpression[[Eta]r[[Xi]r]==Ir[[Xi]r] (26/125 (1+Times[<<2>>])+2 Re[Times[<<2>>]])+Il[[Xi]l] (Im[Times[<<2>>]+Times[<<4>>]+Times[<<2>>]]-13/125 Re[Times[<<2>>]])+Sqrt[Il[[Xi]l]Ir[[Xi]r]] (Cos[[Phi][<<3>>]] (Times[<<2>>]+Times[<<2>>])-(Times[<<2>>]+Times[<<2>>]) Sin[[Phi][<<3>>]]),<<1>>] in the first argument {{ConditionalExpression[[Eta]r[[Xi]r]==Ir[[Xi]r] (Times[<<2>>]+Times[<<2>>])+Il[[Xi]l] (Im[<<1>>]+Times[<<2>>])+Sqrt[Times[<<2>>]] (Times[<<2>>]+Times[<<3>>]),<<1>>],<<4>>,<<1>>},{[CapitalPhi][0,0,0]==[Pi],[Eta]r[0]==1.57389,[Eta]l[0]==1.57389}}.

I have 2 questions related to this problem:

  • Can I somehow see what is <<1>>? As I undertand from here http://reference.wolfram.com/language/ref/Skeleton.html <<1>> is a short form of some expression, when mathematica think that it is too long. I just want to see full text of this error.

  • Can I tell to mathematica, that some of my unknown variables are real and more than 0. I am afraid, that I got this error message, because I have something like Sqrt[Ir*Il] in my system of PDE. and if mathematica think, that Ir and Il can be negative or complex, it will be very difficult to solve this system. I just want to tell mathematica try to find soliution only for positive Ir and Il. I tried to use Assuming like this

Assuming[Ir is Reals && Ir > 0, NDSolve[...]]

but it does not help anyhow.

Update with full example. I have many Greek symbols, when I copied it, it became chnaged a little bit

L := 1;
S := Sqrt[3]/4*L^2;
ϕ0 :=Pi;

ηr[ξr]==Im[β[ξr]]*Ir[ξr]+Im[θl[ξl,ξr]]*Il[ξl] + (Im[σr[ξl, ξr]]*Cos[ϕ[t,ξl,ξr]]-Re[σr[ξl, ξr]]*Sin[ϕ[t,ξl,ξr]])*Sqrt[Ir[ξr]*Il[ξl]],

ηl[ξl]==Im[β[ξl]]*Il[ξl]+Im[θr[ξl,ξr]]*Ir[ξr] + (Im[σl[ξl, ξr]]*Cos[ϕ[t,ξl,ξr]]+Re[σl[ξl, ξr]]*Sin[ϕ[t,ξl,ξr]])*Sqrt[Ir[ξr]*Il[ξl]],

μ *D[Φ[t,ξl,ξr],t]==(ωj[ξr,ωab,ku]-ωj[ξl,ωab,ku])-c/L*KH*(
-2*(Re[(σr[ξl, ξr]-σl[ξl, ξr])/2]*Cos[ϕ[t,ξl,ξr]]-Im[(σr[ξl, ξr]+σl[ξl, ξr])/2]*Sin[ϕ[t,ξl,ξr]])*Sqrt[Ir[ξ]*Il[ξ]]),



ϕ[t,ξl,ξr]==μ *Φ[t,ξl,ξr]+KH*Re[Z[ξr]-Z[ξl]]-ϕ0

ic = {
   Φ[0, 0, 0] == Pi,
   ηr[0] == Im[Z[0]] - ϵr/KH,
   ηl[0] == Im[Z[0]] - ϵr/KH

vars = {ηr, ηl, Φ, Ir, Il};

syssolution = Assuming[ηr∈Reals&&ηr>0&&ηl∈Reals&&ηl>0Ir[ξr]∈Reals&&Ir[ξr]>0&&Il[ξl]∈Reals&&Il[ξl]>0&&Φ∈Reals&&Φ>0ξr∈Reals&& ξl∈Reals && ξr < 0.5 && ξr > -0.5&& ξl < 0.5 && ξl > -0.5, NDSolve[{systemtosolve,ic},vars,{t,0,10^-6},{ξr,-0.1,0.1},{ξl,-0.1,0.1}]];

NDSolve::deqn: "Equation or list of equations expected instead of ConditionalExpression[ηr[ξr]==Ir[ξr]\ (26/125\ (1+Times[<<2>>])+2\ Re[Times[<<2>>]])+Il[ξl]\ (Im[Times[<<2>>]+Times[<<4>>]+Times[<<2>>]]-13/125\ Re[Times[<<2>>]])+Sqrt[Il[ξl]\Ir[ξr]]\ (Cos[ϕ[<<3>>]]\ (Times[<<2>>]+Times[<<2>>])-(Times[<<2>>]+Times[<<2>>])\ Sin[ϕ[<<3>>]]),<<1>>] in the first argument {{ConditionalExpression[ηr[ξr]==Ir[ξr]\ (Times[<<2>>]+Times[<<2>>])+Il[ξl]\ (Im[<<1>>]+Times[<<2>>])+Sqrt[Times[<<2>>]]\ (Times[<<2>>]+Times[<<3>>]),<<1>>],<<4>>,<<1>>},{Φ[0,0,0]==π,ηr[0]==1.57389,ηl[0]==1.57389}}."

There are functions β, θl, σr, Z which are normal complex functions and they are working good, because before I have a graphs for all of them.

I made a screenshot for better understanding (Image is a small in preview. Please save it and open separately to have a good quality.)


I tried to minimize my system and I found the main reason, but I still do not know what I can do.

My code looks like this

KH := Rationalize[0.12]; 
L := 1; 
S := Sqrt[3]/4*L^2;
μ := 4*S/(WL*L); ϕ0 := Pi;

systemtosolve = {    D[Φ[t, ξl, ξr], t] == 1 +
     Cos[μ *Φ[t, ξl, ξr] + 
       KH*Re[Z[ξr] - Z[ξl]] - ϕ0]    };

ic = {    Φ[0, ξl, ξr] == Pi    };
vars = {Φ};

syssolution =    NDSolve[{systemtosolve, ic},     vars, {t, 0, 1}, {ξr, -0.1, 0.1}, {ξl, -0.1, 0.1}];

NDSolve::deqn: Equation or list of equations expected instead of ConditionalExpression[(Φ^(1,0,0))[t,ξl,ξr]==1-Cos[3/25 Plus[<<2>>]+1250000000/791 Power[<<2>>] Φ[<<3>>]],(((0.
-2. I) ξl∈Reals&&Re[(0. +2. I) ξl]<0.208)||Re[(0. -1. I) ξl]>-0.104)&&(((0. -2. I) ξr∈Reals&&Re[(0. +2. I) ξr]<0.208)||Re[(0. -1. I) ξr]>-0.104)] in the first argument {{ConditionalExpression[(Φ^(1,0,0))[t,ξl,ξr]==1-Cos[Plus[<<2>>]],((Times[<<2>>]∈Reals&&Re[<<1>>]<0.208)||Re[Times[<<2>>]]>-0.104)&&((Times[<<2>>]∈Reals&&Re[<<1>>]<0.208)||Re[Times[<<2>>]]>-0.104)]},{Φ[0,ξl,ξr]==π}}.

The problem dissappeared if I remove function Z[] This function is defined like this

Z[x_] := 2*I*Integrate[Exp[-y^2.0 + 2.0*I*y*x], {y, 0, Infinity}];

When I just calculate Z function or draw it's graph everything is fine, but NDSolve do not like this function somehow.

Can you help me to understand, what is wrong with Z function?

  • 1
    $\begingroup$ The expression you showed that was shortened is what NDSolve was given as an argument. It is complaining that the argument is NOT an equation or a list of equations. I think you have a syntax problem somewhere, not a numerical one. Can you show a minimal example of your code so we can reproduce the problem? $\endgroup$ – MarcoB May 20 '15 at 21:56
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) 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. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 May 20 '15 at 22:09
  • $\begingroup$ In other words, following MarcoB, you can evaluate the first argument you gave to NDSolve to see what the message is complaining about. Probably ConditionalExpression is not the construct you want. $\endgroup$ – Michael E2 May 20 '15 at 22:11
  • $\begingroup$ Thank you for your answer. I updated main question and added my code. $\endgroup$ – Zlelik May 21 '15 at 6:09
  • 1
    $\begingroup$ on use of assumptions: DSolve and NDSolve do not use assumptions themselves. I can't find the reference on this now, but this came up before. Here is dsolve-will-not-apply-assumption question on assumptions with DSolve $\endgroup$ – Nasser May 21 '15 at 9:29

The OP still left out a definition (WL), but the problem is that Integrate generates a ConditionalExpression, on which NDSolve chokes.

2*I*Integrate[Exp[-y^2.0 + 2.0*I*y*x], {y, 0, Infinity}]
   2 I E^(-1. x^2) (0.886227 + (0. + 
         0.886227 I) Erfi[(1. + 0. I) x]), ((0. - 2. I) x ∈ 
       Reals && Re[(0. + 2. I) x] < 0) || Re[(0. - 1. I) x] > 0]

One can specify the option GenerateConditions -> False, but perhaps the results may not be correct? So let's try using assumptions, since x is real. It's also risky to use approximate numbers when using Integrate, so let's change 2.0 to 2.

2*I*Integrate[Exp[-y^2 + 2*I*y*x], {y, 0, Infinity}, Assumptions -> x ∈ Reals]
  2 I (1/2 E^-x^2 Sqrt[π] + I DawsonF[x])

I tested the OP's code (from "Update2") with the definition WL = 1, and a solution is produced without error.

Note: Given the problems with Integrate and complex-transcendental integrals, one should check this integral before proceeding.

  • $\begingroup$ Thank you very very much for your answer. WL = 1 is a good assumption, because it is just a constant (Wave Length in my case). This is very great answer and I did not try it yet, but looks like it will help me a lot. I cannot vote up your answer because I have low reputation now, I just registered with stackexchange :( $\endgroup$ – Zlelik May 27 '15 at 9:28
  • $\begingroup$ Could you please also tell me, how you get this expression in comments (**) after integrate? I mean how can I get what integrate really do? $\endgroup$ – Zlelik May 27 '15 at 9:31
  • $\begingroup$ @Zlelik I get it by typing shift-return. Do you mean when you execute the 2nd Integrate, you do not get 2 I (1/2 E^-x^2 Sqrt[π] + I DawsonF[x])? Perhaps, it depends on the version of Mathematica. I'm using V10.1. Completing the square inside the exponential, the integral is equivalent to 2*I*Exp[-x^2] Integrate[Exp[-(y - I x)^2], {y, 0, Infinity}, Assumptions -> x \[Element] Reals] (with or without the Assumptions), which yields I E^-x^2 Sqrt[\[Pi]] (1 + I Erfi[x]) and is equivalent. Or is your question about something else? $\endgroup$ – Michael E2 May 27 '15 at 10:09
  • $\begingroup$ I mean that I do not see 2 I (1/2 E^-x^2 Sqrt[π] + I DawsonF[x]) when I press shift+enter. Most probably I need to upgrade. $\endgroup$ – Zlelik May 27 '15 at 11:26
  • $\begingroup$ What do you think about using NIntegrate[] instead of Integrate[] with NDSolve? Because as I see NIntegrate is much faster in some cases. I really need only numerical calculations and most probably NIntegrate is completely fine for me. But when I tried to use it, I got another error message. I will try to put this error message a little bit later here. I do not have access to my Mathematica now. $\endgroup$ – Zlelik May 27 '15 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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