From: marjan on 23 Feb 2010 08:03 Dear MathGroup members, Please help me with this: I am trying to solve an numerical equation: sol = NDSolve[{D[Y[z, t], z, z] + 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] with boundary conditions: d(Y[a, t])/dz = 2*10^6 and d(Y[b, t])/dz = 2*10^6 , but i don't know how to write the boundary condition in this equation. when I write it like D[Y[a, t], z] == 20*10^5, D[Y [b, t], z] == 20*10^5 Mathematica gives this error NDSolve::deqn: equation or list of equations expected instead of "false" in the first argument {D[Y[z, t], z, z] + 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] , False,False} Thanks for your attention Marjan
From: Patrick Scheibe on 24 Feb 2010 06:19 Hi, check D[f[x, y], x] // InputForm which gives Derivative[1, 0][f][x, y] Therefore, you can use something like Derivative[1, 0][f][0, y] == blub to give the values at the 0-boundary. If you want a working sample, read the NDSolve documentation carefully. Cheers Patrick On Tue, 2010-02-23 at 08:03 -0500, marjan wrote: > Dear MathGroup members, > > Please help me with this: > I am trying to solve an numerical equation: sol = NDSolve[{D[Y[z, t], > z, z] + > 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] > with boundary conditions: d(Y[a, t])/dz = 2*10^6 and d(Y[b, t])/dz > = 2*10^6 , but i don't know how to write the boundary condition in > this equation. when I write it like D[Y[a, t], z] == 20*10^5, D[Y [b, > t], z] == 20*10^5 Mathematica gives this error > > NDSolve::deqn: equation or list of equations expected instead of > "false" in the first argument {D[Y[z, t], z, z] + > 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] , False,False} > > Thanks for your attention > Marjan > > >
From: dh on 25 Feb 2010 01:49 Hi Marjan, to make life easier, try to scale your variables that you get reasonable numerical coefficients. Then besides border condition, you also need initial values. Note also, that a and b must have numerical values. Partial derivatives at a certain place cane be specified in two ways, either: Derivative[1,0][Y][0,t] or: (D[Y[z,t],z]/.z->0) here is an example: eq = {D[Y[z, t], z, z] + Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t], Derivative[1, 0][Y][0, t] == 1, Derivative[1, 0][Y][1, t] == 1, Y[z, 0] == Sin[2 Pi z]/(2 Pi)}; sol = Y[z, t] /. NDSolve[eq, Y[z, t], {z, 0, 1}, {t, 0, .1}][[1]] ContourPlot[sol, {z, 0, 1}, {t, 0, .1}] Daniel On 23.02.2010 14:03, marjan wrote: > Dear MathGroup members, > > Please help me with this: > I am trying to solve an numerical equation: sol = NDSolve[{D[Y[z, t], > z, z] + > 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] > with boundary conditions: d(Y[a, t])/dz = 2*10^6 and d(Y[b, t])/dz > = 2*10^6 , but i don't know how to write the boundary condition in > this equation. when I write it like D[Y[a, t], z] == 20*10^5, D[Y [b, > t], z] == 20*10^5 Mathematica gives this error > > NDSolve::deqn: equation or list of equations expected instead of > "false" in the first argument {D[Y[z, t], z, z] + > 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] , False,False} > > Thanks for your attention > Marjan > > > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh(a)metrohm.com> Internet:<http://www.metrohm.com>
From: marjan on 25 Feb 2010 17:36 Dear Patrick, Thanks for your mail, the comment was useful. another thing is that if I solve this equation in one dimension with the real value of boundary conditions, after finding the best value for Precisions : ss = NDSolve[{D[Y[z], z, z] + 10^12 Sin[Y[z]] Cos[Y[z]] == 0, (D[Y[z], z] /. z -> 0) == 2*10^6, (D[Y[z], z] /. z -> 7*10^-6) == 2*10^6}, Y[z], {z, 0, 7*10^-6}, WorkingPrecision -> 12, PrecisionGoal -> 7, Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 7}, InterpolationOrder -> All] It gives this error NDSolve::berr: There are significant errors {-796330.005638,-795426.001883} in the boundary value residuals. Returning the best solution found {{Y[z] ->InterpolatingFunction[{{0,7.00000000000=D710^-6 }},<>][z]}} should I be worried about this error or this is at least the best approximation solution that is given? Regards Marjan On Feb 24, 12:19 pm, Patrick Scheibe <psche...(a)trm.uni-leipzig.de> wrote: > Hi, > > check > > D[f[x, y], x] // InputForm > > which gives > > Derivative[1, 0][f][x, y] > > Therefore, you can use something like > > Derivative[1, 0][f][0, y] == blub > > to give the values at the 0-boundary. If you want a working sample, read > the NDSolve documentation carefully. > > Cheers > Patrick > > On Tue, 2010-02-23 at 08:03 -0500, marjan wrote: > > Dear MathGroup members, > > > Please help me with this: > > I am trying to solve an numerical equation: sol = NDSolve[{D[Y[z, t], > > z, z] + > > 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] > > with boundary conditions: d(Y[a, t])/dz = 2*10^6 and d(Y[b, t]= )/dz > > = 2*10^6 , but i don't know how to write the boundary condition in > > this equation. when I write it like D[Y[a, t], z] == 20*10^5, D[Y [= b, > > t], z] == 20*10^5 Mathematica gives this error > > > NDSolve::deqn: equation or list of equations expected instead of > > "false" in the first argument {D[Y[z, t], z, z] + > > 10^12 Sin[Y[z, t]] Cos[Y[z, t]] == D[Y[z, t], t] , False= ,False} > > > Thanks for your attention > > Marjan
|
Pages: 1 Prev: Exporting interactive 3D objects from Mathematica to PDF Next: Transition to Wolfram Workbench |