Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Other Sciences
Programming and Computer Science
Non-linear elliptic differential equation - python
Reply to thread
Message
[QUOTE="leonmate, post: 5307779, member: 433837"] Hey guys, I'm going to be honest and say I'm so stuck on this assignment - I really need help! I've took on a third year computational physics course last year - turn your weaknesses into strengths someone told me. Well, I failed and I'm back doing it again this year! So, I just have to pass which means I need 30% in this assignment. But, I'm not getting there on my own - I've struggled to get to grips with the module - I got 20% in my last assignment :'( Can someone help guide me through it? So, I've already solved a [I]similar[/I] problem, the one I did was: u''(x) = f(x) = - exp(x) * (-2 + 2x + 5x[SUP]2[/SUP] + x[SUP]3[/SUP]) [code]from pylab import * from scipy import interpolate def EllipticSolver(Nx): dx = 1.0/Nx pts = linspace(-dx/2.0,1.+dx/2.0,Nx+2) soln = zeros(Nx+2) rhs = zeros(Nx+2) rhs = -exp(pts)*(-2.0 + 2.*pts + 5.*pts**2 + pts**3) soln = tridiagonal2(soln,rhs,dx) return pts[1:-1], soln[1:-1] def tridiagonal2(dat,d,dx): N = len(dat) print(N) dx2 = 1.0/(dx*dx) a = zeros(N) b = zeros(N) c = zeros(N) a[:] = dx2 c[:] = dx2 b[:] = -2.0*dx2 b[1] = -1.0*dx2 b[N-2] = -3.0*dx2 c[1] = c[1]/b[1] d[1] = d[1]/b[1] for j in range(2,N-1): c[j] = c[j]/(b[j] - c[j-1]*a[j]) d[j] = (d[j] - d[j-1]*a[j])/(b[j] - c[j-1]*a[j]) print(a) print(b) print(c) print(d) dat[N-2] = d[N-2] for j in range(N-3,0,-1): dat[j] = d[j] - c[j]*dat[j+1] return dat x1, soln1 = EllipticSolver(100) x2, soln2 = EllipticSolver(200) x3, soln3 = EllipticSolver(400) figure(1) clf() plot(x1,soln1,'r-') plot(x2,soln2,'g-') s2 = interpolate.interp1d(x2,soln2,'cubic') soln2a = s2(x1) s3 = interpolate.interp1d(x3,soln3,'cubic') soln3a = s3(x2) diff1 = soln1 - soln2a diff2 = soln2 - soln3a figure(2) clf() plot(x1,diff1,'r-') plot(x2,4.*diff2,'g-')[/code] Now I have to solve it for: u'' + 500*exp(-100*x[SUP]2[/SUP]) - u[SUP]3[/SUP] = 0 I guess I rearrange so: u'' = u[SUP]3[/SUP] - 500*exp(-100*x[SUP]2[/SUP]) and then solve that How do I solve it with an x and a u in the equation :O :( If you've made it this far I love you and please help me, I have until next Wednesday to get this done and I can't do it on my own..... pleeeeeease help I just need 30 damn percent I attached a copy of the assignmentLeon [/QUOTE]
Insert quotes…
Post reply
Forums
Other Sciences
Programming and Computer Science
Non-linear elliptic differential equation - python
Back
Top