# Errors trying to solve a differential equation using NDSolve[ ]?

Posted 13 days ago
225 Views
|
5 Replies
|
0 Total Likes
|
 Hello, I am new at this and have some problems solving a differential equation in Mathematica.I want to solve this equation: Felectrical+Fsurfaceviscosity=maIn which F_electrical is obtained from a partial derivative relative to xs. I have written my code bellow: \[Epsilon]0 = 8.85*10^-12 ; \[Epsilon]g = 42*\[Epsilon]0; \[Xi] = 0.1; R1 = 50*10^-9; \[Rho]ag = 10.49*10^3; cd = 0.5 10^-8; \[Epsilon]rel = ((\[Epsilon]g - \[Epsilon]0)/(\[Epsilon]g + \ \[Epsilon]0)); x1 = 500 10^-9; z1 = 5 10^-9; z1s = -5 10^-9; zs = 5 10^-9; x2 = -500 10^-9; z2 = 5 10^-9; z2s = -5 10^-9; U[xs_]:=(1/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^3 - ( 3* (xs - x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^5 + 1/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^3 - ( 3* (xs - x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^5)-\[Epsilon]rel*(1/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^3 - ( 3* (xs - x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^5 + 1/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^3 - ( 3* (xs - x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^5+1/(Sqrt[(zs - zss)^2])^3); F_electrical=-U'[xs]; F_surfaceviscositi = -cd*xs'[t]; ma=4/3*\[Pi]*\[Xi]*(R1)^3*\[Rho]ag*xs''[t]; F_total=F_electrical+F_surfaceviscosity-ma; NDSolve[{ftotal == 0, xs == 100 10^-9 , xs == 300 10^-9}, xs, {t, 0, 3031}] ; When I try to plot this, I get tones of errors! I should mention that no boundary conditions are specified in the reference article and I have chosen them from the original graph itself which I have attached a picture of it. Does anyone have any idea how I can plot my graph? Answer
5 Replies
Sort By:
Posted 13 days ago
 Your code has some syntax problems. This makes sense: \[Epsilon]0 = 8.85*10^-12; \[Epsilon]g = 42*\[Epsilon]0; \[Xi] = 0.1; R1 = 50*10^-9; \[Rho]ag = 10.49*10^3; cd = 0.5 10^-8; \[Epsilon]rel = ((\[Epsilon]g - \[Epsilon]0)/(\[Epsilon]g + \ \[Epsilon]0)); x1 = 500 10^-9; z1 = 5 10^-9; z1s = -5 10^-9; zs = 5 10^-9; x2 = -500 10^-9; z2 = 5 10^-9; z2s = -5 10^-9; U[xs_] := (1/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^3 - (3*(xs - x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1)^2])^5 + 1/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^3 - (3*(xs - x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2)^2])^5) - \[Epsilon]rel*(1/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^3 - (3*(xs - x1)^2)/(Sqrt[(xs - x1)^2 + (zs - z1s)^2])^5 + 1/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^3 - (3*(xs - x2)^2)/(Sqrt[(xs - x2)^2 + (zs - z2s)^2])^5 + 1/(Sqrt[(zs - zss)^2])^3); Felectrical = -U'[xs[t]]; Fsurfaceviscosity = -cd*xs'[t]; ma = 4/3*\[Pi]*\[Xi]*(R1)^3*\[Rho]ag*xs''[t]; Ftotal = Felectrical + Fsurfaceviscosity - ma; NDSolve[{Ftotal == 0, xs == 100 10^-9, xs == 300 10^-9}, xs, {t, 0, 3031}] but it may not be what you meant. However, it does not compute, because of numerical problems. Answer
Posted 13 days ago
 Thanks for your reply, do you know any ways that I can resolve these numerical problems? Or maybe I should use some other code instead of NDSolve? Answer
Posted 13 days ago
 Your equation is singular when xs[t] is plus or minus 100cd. Answer
Posted 13 days ago
 Are you sure you want a boundary value problem? Answer
Posted 13 days ago
 Actually no I am not sure, and as I am new in Mathematica, I really don't know if I have any other way to solve it! I would appreciate it if you could give me any hint. Answer