Welcome! Log In Create A New Profile

Advanced

Assignment 3 - Question 2

Posted by murfinke 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assignment 3 - Question 2
May 11, 2007 11:22AM
On page 373.

"(If the differential equation is nonlinear, this technique leads to a set of nonlinear equations that are more difficult to solve. Solving such a set of nonlinear equations is best done by iteration, starting with some initial approximation to the solution vector)"

This is exactly what is required to solve Assignment 3 - Question 2 but I am struggling to know where to begin.

Can anyone help with some ideas so that I can at least get going on this one.
Thanks
avatar Re: Assignment 3 - Question 2
May 14, 2007 10:20PM
i just started a3 this evening and have only finished off q1, so unfortunately i can't help with q2 (maybe tomorrow, i badly need sleep now). usually problem solutions only occur to me minutes before or after the handin deadline (or exam) anyway :|

regarding q1 though, a step size of 0.2 is really really poor, and using a smaller step size i can get y(2) = 4 with y'(1) = -3 or so, so i'd imagine that choosing a y'(1) significantly different to -3 is just wrong (making one error compensate for another)! here are my results with h = 0.2 (there is quite a bit of freedom in how this system is solved, like which eq you iterate first):
y'(1) = -2.99:
--------------

x = 1.000000, est: -2.596802  anal: -2.000000
x = 1.200000, est: -3.164576  anal: -2.592000
x = 1.400000, est: -3.700099  anal: -3.136000
x = 1.600000, est: -4.301923  anal: -3.584000
x = 1.800000, est: -5.481760  anal: -3.888000
x = 2.000000, est: -5.481760  anal: -4.000000

y'(1) = -3.01:
--------------

x = 1.000000, est: -2.603202  anal: -2.000000
x = 1.200000, est: -3.193152  anal: -2.592000
x = 1.400000, est: -3.810026  anal: -3.136000
x = 1.600000, est: -4.739819  anal: -3.584000
x = 1.800000, est: -8.083086  anal: -3.888000
x = 2.000000, est: -8.083086  anal: -4.000000
before interpolation is done, the two guesses should bracket the desired value, which is not the case here! yet, with a smaller stepsize like 0.02, it becomes the case! i'm going to submit the assignment with that stepsize, since 0.2 is just really too poor with modified euler for this problem to make sense - i suspect a typo (had one last year too with cos233). if only i'd started more than 24 or so hours before the deadline, i could've gotten confirmation from the lecturer :/
Re: Assignment 3 - Question 2
May 15, 2007 04:50PM
My Results for Q1 are slightly different to yours. And at this late stage I am not changing them.

y'(1) = -2.99:
--------------

Xn	  Y(x)	   Anal
1	-2.00000	-2.00000
1.2	-2.86899	-2.59200
1.4	-3.51202	-3.13600
1.6	-3.94462	-3.58400
1.8	-4.22707	-3.88800
2	-4.41891	-4.00000


y'(1) = -3.01:
--------------

Xn	  Y(x)	  Anal
1	-2.00000	-2.00000
1.2	-2.87501	-2.59200
1.4	-3.52372	-3.13600
1.6	-3.96117	-3.58400
1.8	-4.24777	-3.88800
2	-4.44336	-4.00000
avatar Re: Assignment 3 - Question 2
May 15, 2007 04:57PM
argh, seems like i got something wrong :/
Re: Assignment 3 - Question 2
May 15, 2007 06:59PM
Here are my results for Q2. I am not sure they are right as I had to get a little creative to get a solution. Let me know how you get a long.

x	y(x)	Anal
0.0	1.000000	1.000000
0.1	1.110210	1.094156
0.2	1.206820	1.173195
0.3	1.283940	1.231973
0.4	1.335750	1.265594
0.5	1.356920	1.269765
0.6	1.342980	1.241189
0.7	1.290880	1.178012
0.8	1.199520	1.080278
0.9	1.070300	0.950388
1.0	0.907672	0.793539
1.1	0.719693	0.618105
1.2	0.518444	0.435942
1.3	0.320380	0.262559
1.4	0.146519	0.117150
1.5	0.022425	0.022425
avatar Re: Assignment 3 - Question 2
May 15, 2007 09:55PM
i've also had to get creative for question 2, but am still having issues with it. there's an obvious typo for the dirichlet boundary condition; what i'm doing is rearranging my eqs to be something like f(y1,y2,y3,x)=0 then using the method of steepest descent to find a solution.
avatar Re: Assignment 3 - Question 2
May 15, 2007 10:16PM
i have a feeling i'm making a pretty obvious mistake with some pretty sophisticated code, and am too sleepy to realise it :/
Re: Assignment 3 - Question 2
May 15, 2007 10:17PM
I used y(0) = 1 and guessed y(0.1) which enables you to solve the set of equations by using iteration. I then used G3 = G2 + (DR-R2)(G1-G2)/(R1-R2) to improve my guess of y(0.1). The end result is the values I have above.
avatar Re: Assignment 3 - Question 2
May 15, 2007 10:22PM
oh the q1 isn't a problem so much as q2, i'm just hunting some silly problem in my code... sleep would really help :|

well, 12am has come and gone. this assignment could have gone better, could also have gone worse; definitely won't start the next one a few hours before the deadline (yeah i know i say it everytime)!

in the end the gradient search took a stupid number of iterations to get anywhere near a plausible solution, which leads me to believe i made a silly mistake somewhere. here are my final results for q2:
iter 256: |grad(f)|^2 = 0.006599
iter 512: |grad(f)|^2 = 0.002829
iter 768: |grad(f)|^2 = 0.001964
iter 1024: |grad(f)|^2 = 0.001413
iter 1280: |grad(f)|^2 = 0.001014
iter 1536: |grad(f)|^2 = 0.000726
iter 1792: |grad(f)|^2 = 0.000518
iter 2048: |grad(f)|^2 = 0.000369
iter 2304: |grad(f)|^2 = 0.000264
iter 2560: |grad(f)|^2 = 0.000190
iter 2816: |grad(f)|^2 = 0.000138
iter 3072: |grad(f)|^2 = 0.000103
iter 3095: |grad(f)|^2 = 0.000100
solution has converged, comparing with analytic:
f(0.0) = 0.87700, analytic is 1.00000
f(0.1) = 0.97317, analytic is 1.09416
f(0.2) = 1.05680, analytic is 1.17319
f(0.3) = 1.12256, analytic is 1.23197
f(0.4) = 1.16513, analytic is 1.26559
f(0.5) = 1.17962, analytic is 1.26976
f(0.6) = 1.16207, analytic is 1.24119
f(0.7) = 1.10997, analytic is 1.17801
f(0.8) = 1.02278, analytic is 1.08028
f(0.9) = 0.90250, analytic is 0.95039
f(1.0) = 0.75414, analytic is 0.79354
f(1.1) = 0.58621, analytic is 0.61811
f(1.2) = 0.41096, analytic is 0.43594
f(1.3) = 0.24458, analytic is 0.26256
f(1.4) = 0.10717, analytic is 0.11715
obviously my answers suck, and yours rock :| i'd be very interested to hear how you solved it and/or exchange code. i'm doing this in c++, you? my email address is in my profile, i'm happy to send my finished assignments (3 small pdf files); i have a feeling you also got 100% for the first two so it'd be interesting indeed.
avatar Re: Assignment 3 - Question 2
June 15, 2007 07:13PM
*pokepoke* exchange solutions? no?
Sorry, only registered users may post in this forum.

Click here to login