## 90 Reputation

13 years, 34 days

Thanks

## Hello, Thank you for your replay and the...

Hello,

Thank you for your replay and the example.  This is my program:

`> restart;> with(DEtools);> k := 0;> ode := diff(U(t), t) = -((0.01/365)+((0.01/365)*U(t)))*U(t);`
`> ic1 := U(365*k) = 1000;> sol1 := dsolve({ic1, ode}, U(t), numeric);`
`> k := 1;> sigma := 1.5; A := proc (t) options operator, arrow; rhs(sol1(t)[2]) end proc; A(365*k);ic2 := U(365*k) = sigma*A(365*k);> sol2 := dsolve({ic2, ode}, U(t), numeric);> k := 2;> sigma := 1.5; A := proc (t) options operator, arrow; rhs(sol2(t)[2]) end proc; A(365*k);ic3 := U(365*k) = sigma*A(365*k);> sol3 := dsolve({ic3, ode}, U(t), numeric);> k := 3;> sigma := 1.5; A := proc (t) options operator, arrow; rhs(sol3(t)[2]) end proc; A(365*k);ic4 := U(365*k) = sigma*A(365*k);> sol4 := dsolve({ic4, ode}, U(t), numeric);`
` `
`and this is my do loop:`
`> restart;> with(DEtools);> k := 0;> ode := diff(U(t), t) = -((0.01/365)+((0.01/365)*U(t)))*U(t);`
`> ic1 := U(365*k) = 1000;> sol1 := dsolve({ic1, ode}, U(t), numeric);`
`> k := 1;                             > for k to 10 do 365*k; sigma := 1.5; V := proc (t) options operator, arrow; rhs(sol1(t)[2]) end proc; V(365*k); ic2 := U(365*k) = sigma*V(365*k); sol2 := dsolve({ic2, ode}, U(t), numeric) end do;`
` `
` `
`What I am trying to do is to run it at k=0 and then make a do-loop from k=1 to k=10 but as you can see I am using what i get from dsolve to make my new ic and then solve the ode again.`
`Can I do a do-loop that save what i get from k=1 and use it as new ic to run k=2 and so on?`
`Thank you very much.`

## Hello, Thank you for your replay and the...

Hello,

Thank you for your replay and the example.  This is my program:

`> restart;> with(DEtools);> k := 0;> ode := diff(U(t), t) = -((0.01/365)+((0.01/365)*U(t)))*U(t);`
`> ic1 := U(365*k) = 1000;> sol1 := dsolve({ic1, ode}, U(t), numeric);`
`> k := 1;> sigma := 1.5; A := proc (t) options operator, arrow; rhs(sol1(t)[2]) end proc; A(365*k);ic2 := U(365*k) = sigma*A(365*k);> sol2 := dsolve({ic2, ode}, U(t), numeric);> k := 2;> sigma := 1.5; A := proc (t) options operator, arrow; rhs(sol2(t)[2]) end proc; A(365*k);ic3 := U(365*k) = sigma*A(365*k);> sol3 := dsolve({ic3, ode}, U(t), numeric);> k := 3;> sigma := 1.5; A := proc (t) options operator, arrow; rhs(sol3(t)[2]) end proc; A(365*k);ic4 := U(365*k) = sigma*A(365*k);> sol4 := dsolve({ic4, ode}, U(t), numeric);`
` `
`and this is my do loop:`
`> restart;> with(DEtools);> k := 0;> ode := diff(U(t), t) = -((0.01/365)+((0.01/365)*U(t)))*U(t);`
`> ic1 := U(365*k) = 1000;> sol1 := dsolve({ic1, ode}, U(t), numeric);`
`> k := 1;                             > for k to 10 do 365*k; sigma := 1.5; V := proc (t) options operator, arrow; rhs(sol1(t)[2]) end proc; V(365*k); ic2 := U(365*k) = sigma*V(365*k); sol2 := dsolve({ic2, ode}, U(t), numeric) end do;`
` `
` `
`What I am trying to do is to run it at k=0 and then make a do-loop from k=1 to k=10 but as you can see I am using what i get from dsolve to make my new ic and then solve the ode again.`
`Can I do a do-loop that save what i get from k=1 and use it as new ic to run k=2 and so on?`
`Thank you very much.`

## @acer  Hello, Thank you for your ...

Hello,

It is only one ODE and I am solving it two times with new conditions.

Thanks

## @dskoog  I have maple 14. I &...

I have maple 14. I  copied your code and run it. It works with no errors. Thanks you so much for your help

## @dskoog  I have maple 14. I &...

I have maple 14. I  copied your code and run it. It works with no errors. Thanks you so much for your help

## Hello, Thank you for yor replay. I rece...

`Hello,`
`Thank you for yor replay. I  received an error when I run it. for k to 3 until end do `
`is in one maple input right?`
`Thanks`
`> restart;> with(DEtools); with(plots);> lambda := 0.1; delta := .5; tau := 40;> for k to 3 do 365*k;  `
` ode:=diff(U(t),t)=-(lambda(t)U(t))U(t); `
`inc1 := U(0) = 100;   ;sol1 := dsolve({inc1, ode}, U(t), numeric);F := proc (t) options operator, arrow; rhs(sol1(t)[2]) end proc; `
`F(365*k+tau+0);Z:=(1-delta[])*F((365 k)+tau[]+0);  `
`inc2:=U((365 k)+tau[]+0)= Z; `
` sol2:=dsolve({ode,inc2},U(t),numeric);   `
`end do; ;Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equationst -> rhs(sol1(t)[2])Error, (in F) invalid input: rhs received sol1(365*k+40)[2], which is not valid for its 1st argument, expr> `

## Hello, Thank you for yor replay. I rece...

`Hello,`
`Thank you for yor replay. I  received an error when I run it. for k to 3 until end do `
`is in one maple input right?`
`Thanks`
`> restart;> with(DEtools); with(plots);> lambda := 0.1; delta := .5; tau := 40;> for k to 3 do 365*k;  `
` ode:=diff(U(t),t)=-(lambda(t)U(t))U(t); `
`inc1 := U(0) = 100;   ;sol1 := dsolve({inc1, ode}, U(t), numeric);F := proc (t) options operator, arrow; rhs(sol1(t)[2]) end proc; `
`F(365*k+tau+0);Z:=(1-delta[])*F((365 k)+tau[]+0);  `
`inc2:=U((365 k)+tau[]+0)= Z; `
` sol2:=dsolve({ode,inc2},U(t),numeric);   `
`end do; ;Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equationst -> rhs(sol1(t)[2])Error, (in F) invalid input: rhs received sol1(365*k+40)[2], which is not valid for its 1st argument, expr> `
 1 2 3 4 Page 4 of 4
﻿