Serving the Quantitative Finance Community

 
User avatar
vit2007
Topic Author
Posts: 0
Joined: February 3rd, 2007, 7:44 am

ODE question

March 29th, 2007, 6:06 am

Does anybody know how to solvedy*(x+y) = dx*(x-y)with x0 = -1, y0 = 1.Thanks in advance.
 
User avatar
prospero
Posts: 1
Joined: March 16th, 2002, 4:00 am

ODE question

March 29th, 2007, 11:04 am

dy/(x-y)=dx/(x+y) => d(xy)/(x^2+y^2)=d(.5(x^2-y^2))/(x^2+y^2),and go from there.
 
User avatar
vit2007
Topic Author
Posts: 0
Joined: February 3rd, 2007, 7:44 am

ODE question

March 29th, 2007, 2:17 pm

Great!What about another one:(x-y)*dy = (x+y)*dxi.e.x*dy - y*dx = x*dx + y*dy
 
User avatar
gentinex
Posts: 0
Joined: June 8th, 2006, 1:16 pm

ODE question

March 29th, 2007, 5:37 pm

Nice signature! Let me offer a way to do the first one which will also give you a better idea of how to do the second.Let's do a substitution u(x) = x + y(x). Then du/dx = 1 + dy/dx, and x - y = -u + 2x. Thus, our original equationdy/dx = (x-y) / (x+y)becomesdu/dx - 1 = (-u + 2x) / u = -1 + 2x/udu/dx = 2x/uand hopefully you know how to solve this. The second one you gave should be solvable by a similar method.
 
User avatar
vN
Posts: 0
Joined: May 12th, 2004, 5:05 am

ODE question

March 29th, 2007, 10:03 pm

The equation translates tody / dx = (x-y)/(x+y)Let z = y+x, thend(z-x) / dx = (2x - z)/zwhich is equivalent todz / dx = 2x/zwhich is equivalent todz^2 = 2dx^2so: z^2 = 2x^2 + csubstituting x+y for z, we gety^2 + 2xy - x^2 = cone can verify that this equition satisfies the ODE
Last edited by vN on March 29th, 2007, 10:00 pm, edited 1 time in total.
 
User avatar
ppauper
Posts: 11729
Joined: November 15th, 2001, 1:29 pm

ODE question

March 30th, 2007, 2:35 pm

Firstorder homogeneous differential equation
 
User avatar
alanxyz
Posts: 0
Joined: February 28th, 2007, 1:28 pm

ODE question

July 2nd, 2007, 1:43 pm

define u = y/x.
 
User avatar
ramnathv
Posts: 0
Joined: June 22nd, 2005, 8:58 pm

ODE question

July 6th, 2007, 11:52 am

 
User avatar
ramnathv
Posts: 0
Joined: June 22nd, 2005, 8:58 pm

ODE question

July 6th, 2007, 11:53 am

This ODE can be easily solved by rearranging terms(x+y)dy=(x-y)dyxdy + ydx = xdx - ydyd(xy) = xdx - ydyIntegrating both sides, we getxy = x^2/2 - y^2/2 + c
 
User avatar
ExSan
Posts: 495
Joined: April 12th, 2003, 10:40 am

ODE question

February 12th, 2013, 9:28 pm

Numerical Approximation of Partial Differential EquationsEuler Method forDownload and install GNUPLOTDownload ( Extract) and Execute attached ExSan_Euler_SolverInstructions - Sample: a ---> 1 b ---> -3 c ---> 8 d ---> 2 x_o = ---> -5 x_f = ---> 4STEP h = .001This ODE One More Time (1-y-Y | N-n-0) ? ---> nA txt LOG FILE will be DISPLAYED, please close itExSan directory will show the gnuplot files that have been generated, click them in order to generate the gif images. Then click the corresponding exsan_out.html
Attachments
Exsan V.4.03.N Euler_ODE_solver_01.zip
(1.05 MiB) Downloaded 101 times
Last edited by ExSan on February 11th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22933
Joined: July 16th, 2004, 7:38 am

ODE question

February 14th, 2013, 3:25 pm

How many steps did you take (aka 1/h)? edit: h = 0.001.Looks like a nasty layer at x = -1.
Last edited by Cuchulainn on February 13th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
ExSan
Posts: 495
Joined: April 12th, 2003, 10:40 am

ODE question

February 15th, 2013, 12:25 am

QuoteOriginally posted by: CuchulainnHow many steps did you take (aka 1/h)? edit: h = 0.001.Looks like a nasty layer at x = -1. x_o: -5 y_o: 1 x_f: 4 STEP h: 0.001Number of Steps: 9001----> (xf - xo)/hIMO Euler Method is really poor, now I will try to code the Improved Method of Eulerref: Elementary Differential Equations and Boundary Value Problems - Boyce & DiPrima
Last edited by ExSan on February 14th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22933
Joined: July 16th, 2004, 7:38 am

ODE question

February 15th, 2013, 9:05 am

A variation/improvement is the predictor corrector method Easy to program.
Last edited by Cuchulainn on February 14th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
ExSan
Posts: 495
Joined: April 12th, 2003, 10:40 am

ODE question

February 15th, 2013, 4:52 pm

QuoteOriginally posted by: CuchulainnA variation/improvement is the predictor corrector method Easy to program.These two methods are so highly dependent on h, every time I test with different -h- the final result is "dramatically" different. The smaller the h, the higher number of steps, and the demand of memory increases !How to choose h? I do no want to keep on trying and trying and all the time getting different charts.Maybe Runge Kutta is more suitable ?Attached Updated Version this ODE SOLVER. It includes Euler Method(red) + Predictor Corrector (green)INSTRUCTIONSInstall GNUPLOTDownload (*Extract*) and Execute attached ExSan_Euler_Predictor_Corrector_ODE_SolverA txt LOG FILE will be DISPLAYED, please close itExSan directory will show the gnuplot files (.plt) generated, click them in order to reproduce corresponding gif images. Then click exsan_out.html
Attachments
Exsan V.4.03.O ODE_solver_Euler_Predictor_Corrector.zip
(1.05 MiB) Downloaded 86 times
Last edited by ExSan on February 14th, 2013, 11:00 pm, edited 1 time in total.
 
User avatar
Alan
Posts: 3050
Joined: December 19th, 2001, 4:01 am
Location: California
Contact:

ODE question

February 15th, 2013, 10:46 pm

Assuming there is a singularity at x = x_sing ~ -1.04, then1. What is its nature? (do both dy/dx and y become infinite from one side/both sides, or just dy/dx from one side/both sides, or?)2. Why should one expect any of the methods discussed to blindly and successfully navigate through the singularity? Is the ODE problem even well-posed starting from x_init < x_sing and then expecting to have x_final > x_sing