# Solve system of ordinary differential equations that doesn't have an initial condition (t=0), but has an inifinity condition (t=infinity)?

I have a question for solving t -> Infinity on Mathematica. First, I have a system of ODEs:

feqn1 = {x'[t] == -k1*x[t]*y[t]/h[t] + k2*z[t],
y'[t] == 3*(-k1*x[t]*y[t]/h[t] + k2*z[t]),
z'[t] == k1*x[t]*y[t]/h[t] - k2*z[t],
h'[t] == -3*(-k1*x[t]*y[t]/h[t] + k2*z[t]),
x == .001, z == 0, y == 0.2, h == .001};


Then I solved the equations by NDSolve.

NDSolve[feqn1, {x, y, z, h}, {t, 0, 1000}];


and for the second part of the problem, I have another set of ODE.

seqn1 = {x2'[t] == -k1*x2[t]*y[t]/h2[t] + k2*z[t],
h2'[t] == -3*(-k1*x2[t]*y[t]/h2[t] + k2*z[t])}


The initial conditions are h2 == 1 at t = Infinity, x2 = 0.001.

Thanks.

• You can approximate the boundary condition at infinity with a suitably large number, e.g. h2[1/$MachineEpsilon] == 1. Also, see this, among a number of other old MathGroup posts on handling such boundary conditions. – J. M. will be back soon Nov 8 '12 at 0:24 • An alternative is to change variables in your ODE so that infinity becomes 1 say (?) – chris Nov 8 '12 at 8:45 • Thanks J.M & Chris... I tried to look up the document, they used DShoot, but I couldn't find a command on Mathematica for "DShoot". And I also tried set x2[t=1000]= 0.001, but Mathematica only gave me error msg. – DumbleKo Nov 8 '12 at 18:53 ## 1 Answer The comments have made two suggestions - one that we change variables so that$[0,\infty)$corresponds to a bounded region like$[0,1)$and the other that we simply solve over a large interval of the form$[0,M]$. Since you've already got InterpolatingFunctions defined over$[0,1000]$in your system, I suppose that the second suggestion probably makes the most sense. Also, as appealing as a change of variables sounds, in my experience this likely generates a singularlity at the right endpoint making anyway. Here's your initial system; I grabbed values of$k_1$and$k_2$from another post. Clear[x,y,z,h] k1 = 0.000392; k2 = 0.00759355499; feqn1 = {x'[t] == -k1*x[t]*y[t]/h[t] + k2*z[t], y'[t] == 3*(-k1*x[t]*y[t]/h[t] + k2*z[t]), z'[t] == k1*x[t]*y[t]/h[t] - k2*z[t], h'[t] == -3*(-k1*x[t]*y[t]/h[t] + k2*z[t]), x == .001, z == 0, y == 0.2, h == .001}; {x,y,z,h} = {x,y,z,h} /. First[ NDSolve[feqn1,{x,y,z,h},{t,0,1000}] ];  We'll use a shooting method to solve the boundary value problem. That is, we'll write a function shot that solves an initial value problem in terms of a parameter a, with initial conditions at the left endpoint. The idea is to choose the parameter a so that the right hand boundary condition is satisfied. Here's shot: Clear[shot]; shot[a_?NumericQ] := Module[{}, solution = First[NDSolve[ {x2'[t] == -k1*x2[t]*y[t]/h2[t] + k2*z[t], h2'[t] == -3*(-k1*x2[t]*y[t]/h2[t] + k2*z[t]), h2 == 1, x2 == a}, {h2, x2}, {t, 0, 1000}]]; {h2Try, x2Try} = {h2, x2} /. solution; x2Try] Plot[shot[a], {a, -2, 2}] The plot indicates that shot is one-to-one and that there's probably a unique solution to your problem. We can find it with FindRoot: FindRoot[shot[a] == 0.001, {a, 0}] (* Out: {a -> -0.00479028} *)  Note that the solutions for$x_2$and$h_2$are already stored in the variables x2Try and h2Try. We can plot them over various intervals as below. I'm actually plotting$x_2(t)$and$h_2(t)-1\$ here since, otherwise, they look like two flat lines.

Manipulate[
Plot[{x2Try[t], h2Try[t] - 1}, {t, 0, max}],
{{max, 1}, 0.1, 1000}] • If need be, one could save on memory in the definition of shot[] by having the start and endpoints in the integration interval coincide: x2 /. First @ NDSolve[(* equations *), {h2, x2}, {t, 1000, 1000}]. – J. M. will be back soon Nov 8 '12 at 13:31
• @ Mark McClure: Thanks for the answer, but I'm still trying to figure out "a" because according to your answer, it seems like at t=0, x2=a, which equals to some values. But in my case, at t=0, x2=0 and t=inifinity, x2=0.001 is the boundary conditions. Maybe I misunderstood something here... – DumbleKo Nov 8 '12 at 18:52
• @DumbleKo At no point in your question do I see a specification for x2, which is a good thing! You've got a first order system in the two unknown functions h2 and x2 - correct? You've already specified that h2==1. If you additionally specify that x2==0, then your solution is uniquely determined so you can't expect to force the value of x2 at infinity. If you want some particular value for x2 at infinity, then you might be able to get it, if you allow flexibility at zero. That's the approach taken here. – Mark McClure Nov 8 '12 at 20:29
• @ Mark McClure: I see. Sorry I was confused by the my question and trying to solve this problems from different approach. But thanks for answering all my questions. They've been very helpful. – DumbleKo Nov 8 '12 at 21:12
{"ft_lang_label":"__label__en","ft_lang_prob":0.7964986,"math_prob":0.99649525,"size":2265,"snap":"2019-43-2019-47","text_gpt3_token_len":794,"char_repetition_ratio":0.103936315,"word_repetition_ratio":0.0,"special_character_ratio":0.3969095,"punctuation_ratio":0.18574108,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9986145,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,3,null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-18T05:56:25Z\",\"WARC-Record-ID\":\"<urn:uuid:9dab4068-3799-4c27-b5fa-f6645f516008>\",\"Content-Length\":\"148546\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:2386346f-7053-40cc-a1b8-a8f9847004d3>\",\"WARC-Concurrent-To\":\"<urn:uuid:77a4d2e3-9461-471f-9f4d-95c77248a6c4>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://mathematica.stackexchange.com/questions/14259/solve-system-of-ordinary-differential-equations-that-doesnt-have-an-initial-con\",\"WARC-Payload-Digest\":\"sha1:B4XG34JJX7R5O5YZFKAU52CWK36Z5TF6\",\"WARC-Block-Digest\":\"sha1:UXLEEWNPQXPQBM5B66OVMAW76RMGCQTH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496669454.33_warc_CC-MAIN-20191118053441-20191118081441-00378.warc.gz\"}"}