Dear Natalia,
I try to use ODE from SciSmalltalk because I want to replace our adhoc RungeKutta code that we use in one my research project called Kendrick about epidemiological modeling: https://github.com/UMMISCO/Kendrick Basically diseases are modelled as a system of differential ODEs. Before doing that, I would like to do something simpler but I'm a bit stucked at the moment :-) For example, I try to mimic the 1D ODE example of odeint here : http://headmyshoulder.github.io/odeint-v2/examples.html |dt system stepper solver| dt := 0.1. system := ExplicitSystem block: [:x :t | 3.0/(2.0*t*t) + x/(2.0*t)]. stepper := RungeKuttaStepper onSystem: system. solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. How do you solve the ODE ? Any hints ? Regards, -- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/ -- You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hello, Serge.
-- If you want to solve that ODE, you just need to execute (solver solve: system startState: 0 startTime: 1 endTime: 10) or (solver solve: system startState: 0 startTime: 1 endTime: 10 stepSize: 0.1). If you want me to tell how does every step work let me know. P.S. I will add it on github wiki. Best regards, Natalia Четвер, 17 квітня 2014 р. 11:43:36 UTC+3 користувач Serge Stinckwich написав: Dear Natalia, You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hello, I added https://github.com/SergeStinckwich/SciSmalltalk/wiki/Quick-start-to-ODEOn Apr 17, 2014, at 3:03 PM, Natalia Tymchuk <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Thank you Natalia for starting a page about that. I think we should
continue to work on a more elaborate documentation. I understand how to solve an ODE, but now I would like to plot the result between 1 and 10 for example. How I could do that ? What represent the result of the solver ? Regards, On Thu, Apr 17, 2014 at 8:53 PM, Natalia Tymchuk <[hidden email]> wrote: > > Hello, > I added > https://github.com/SergeStinckwich/SciSmalltalk/wiki/Quick-start-to-ODE > > > On Apr 17, 2014, at 3:03 PM, Natalia Tymchuk <[hidden email]> > wrote: > > Hello, Serge. > If you want to solve that ODE, you just need to execute > > (solver solve: system startState: 0 startTime: 1 endTime: 10) > or > (solver solve: system startState: 0 startTime: 1 endTime: 10 stepSize: 0.1). > > If you want me to tell how does every step work let me know. > > P.S. I will add it on github wiki. > Best regards, > Natalia > > > Четвер, 17 квітня 2014 р. 11:43:36 UTC+3 користувач Serge Stinckwich > написав: >> >> Dear Natalia, >> >> I try to use ODE from SciSmalltalk because I want to replace our adhoc >> RungeKutta code that we use in one my research project called Kendrick >> about epidemiological modeling: >> https://github.com/UMMISCO/Kendrick >> >> Basically diseases are modelled as a system of differential ODEs. >> >> Before doing that, I would like to do something simpler but I'm a bit >> stucked at the moment :-) >> For example, I try to mimic the 1D ODE example of odeint here : >> http://headmyshoulder.github.io/odeint-v2/examples.html >> >> |dt system stepper solver| >> dt := 0.1. >> system := ExplicitSystem block: [:x :t | 3.0/(2.0*t*t) + x/(2.0*t)]. >> stepper := RungeKuttaStepper onSystem: system. >> solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. >> >> How do you solve the ODE ? >> >> Any hints ? >> >> Regards, >> -- >> Serge Stinckwich >> UCBN & UMI UMMISCO 209 (IRD/UPMC) >> Every DSL ends up being Smalltalk >> http://www.doesnotunderstand.org/ > > > -- > You received this message because you are subscribed to the Google Groups > "SciSmalltalk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "SciSmalltalk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/d/optout. -- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/ -- You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Ok I made some progress.
I'm able to solve a simple 1D ODE : ================================================ |dt system stepper solver state values diagram| dt := 0.01. system := ExplicitSystem block: [:x :t | (3.0/(2.0*t*t)) + (x/(2.0*t))]. stepper := RungeKuttaStepper onSystem: system. solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. state := 0.0. values := (1.0 to: 20.0 by: dt) collect:[:t | state := stepper doStep: state time: t stepSize: dt]. diagram := GETDiagramBuilder new. (diagram lineDiagram) models: values; yourself. diagram open ================================================ When I draw the result with GraphET, I obtain a line. Normally, the analytic result is : x(t) = sqrt(t) - 1/t as told here : http://headmyshoulder.github.io/odeint-v2/examples.html Any idea ? After that, I try to implement the Lorentz attractor : ================================================ | solver stepper system dt sigma r b state values diag| sigma := 10.0. r := 28. b := 8.0/3.0. dt := 0.005. system := ExplicitSystem block: [:x :t | | c | c:= DhbVector new: 3. c at: 1 put: sigma * ((x at: 2) - (x at: 1)). c at: 2 put: r * (x at: 1) - (x at: 2) - ((x at: 1) * (x at: 3)). c at: 3 put: (b negated * (x at: 3) + ((x at: 1) * (x at: 2))). c]. stepper := RungeKuttaStepper onSystem: system. solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. state := #(10.0 10.0 10.0). values := (0.0 to: 3.5 by: dt) collect:[:t | state := stepper doStep: state time: t stepSize: dt]. values. diag := GETDiagramBuilder new. (diag scatterplot) models: values; x: [ :v |v at:1]; y: [ :v |v at:2]; regularAxis; dotSize: 2. diag open. ================================================ I'm able to view the nice butterfly figure. Look at the attached picture. When I try to draw with more points, for exemple : 0.0 to:10.0 I have an error ... At the moment, I don't understand if this a problem with GraphET or SciSmalltalk. Regards, On Fri, Apr 18, 2014 at 9:59 AM, Serge Stinckwich <[hidden email]> wrote: > Thank you Natalia for starting a page about that. I think we should > continue to work on a more elaborate documentation. > > I understand how to solve an ODE, but now I would like to plot the > result between 1 and 10 for example. > How I could do that ? > > What represent the result of the solver ? > > Regards, > > On Thu, Apr 17, 2014 at 8:53 PM, Natalia Tymchuk > <[hidden email]> wrote: >> >> Hello, >> I added >> https://github.com/SergeStinckwich/SciSmalltalk/wiki/Quick-start-to-ODE >> >> >> On Apr 17, 2014, at 3:03 PM, Natalia Tymchuk <[hidden email]> >> wrote: >> >> Hello, Serge. >> If you want to solve that ODE, you just need to execute >> >> (solver solve: system startState: 0 startTime: 1 endTime: 10) >> or >> (solver solve: system startState: 0 startTime: 1 endTime: 10 stepSize: 0.1). >> >> If you want me to tell how does every step work let me know. >> >> P.S. I will add it on github wiki. >> Best regards, >> Natalia >> >> >> Четвер, 17 квітня 2014 р. 11:43:36 UTC+3 користувач Serge Stinckwich >> написав: >>> >>> Dear Natalia, >>> >>> I try to use ODE from SciSmalltalk because I want to replace our adhoc >>> RungeKutta code that we use in one my research project called Kendrick >>> about epidemiological modeling: >>> https://github.com/UMMISCO/Kendrick >>> >>> Basically diseases are modelled as a system of differential ODEs. >>> >>> Before doing that, I would like to do something simpler but I'm a bit >>> stucked at the moment :-) >>> For example, I try to mimic the 1D ODE example of odeint here : >>> http://headmyshoulder.github.io/odeint-v2/examples.html >>> >>> |dt system stepper solver| >>> dt := 0.1. >>> system := ExplicitSystem block: [:x :t | 3.0/(2.0*t*t) + x/(2.0*t)]. >>> stepper := RungeKuttaStepper onSystem: system. >>> solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. >>> >>> How do you solve the ODE ? >>> >>> Any hints ? >>> >>> Regards, >>> -- >>> Serge Stinckwich >>> UCBN & UMI UMMISCO 209 (IRD/UPMC) >>> Every DSL ends up being Smalltalk >>> http://www.doesnotunderstand.org/ >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "SciSmalltalk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [hidden email]. >> For more options, visit https://groups.google.com/d/optout. >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "SciSmalltalk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [hidden email]. >> For more options, visit https://groups.google.com/d/optout. > > > > -- > Serge Stinckwich > UCBN & UMI UMMISCO 209 (IRD/UPMC) > Every DSL ends up being Smalltalk > http://www.doesnotunderstand.org/ -- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/ -- You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. Screen Shot 2014-04-18 at 12.34.15.png (133K) Download Attachment |
For the Lorentz attractor, I find something, apparently from time to
time (and I dunno why), a state value (a vector) is replaced by a number ... No idea why at the moment. On Fri, Apr 18, 2014 at 12:34 PM, Serge Stinckwich <[hidden email]> wrote: > Ok I made some progress. > I'm able to solve a simple 1D ODE : > > ================================================ > |dt system stepper solver state values diagram| > dt := 0.01. > system := ExplicitSystem block: [:x :t | (3.0/(2.0*t*t)) + (x/(2.0*t))]. > stepper := RungeKuttaStepper onSystem: system. > solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. > > state := 0.0. > values := (1.0 to: 20.0 by: dt) collect:[:t | > state := stepper doStep: state time: t stepSize: dt]. > > diagram := GETDiagramBuilder new. > (diagram lineDiagram) > models: values; > yourself. > diagram open > > ================================================ > > When I draw the result with GraphET, I obtain a line. > Normally, the analytic result is : x(t) = sqrt(t) - 1/t > as told here : > http://headmyshoulder.github.io/odeint-v2/examples.html > > Any idea ? > > After that, I try to implement the Lorentz attractor : > > ================================================ > | solver stepper system dt sigma r b state values diag| > sigma := 10.0. > r := 28. > b := 8.0/3.0. > dt := 0.005. > system := ExplicitSystem > block: [:x :t | | c | > c:= DhbVector new: 3. > c at: 1 put: sigma * ((x at: 2) - (x at: 1)). > c at: 2 put: r * (x at: 1) - (x at: 2) - ((x at: 1) * (x at: 3)). > c at: 3 put: (b negated * (x at: 3) + ((x at: 1) * (x at: 2))). > c]. > stepper := RungeKuttaStepper onSystem: system. > solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. > state := #(10.0 10.0 10.0). > > values := (0.0 to: 3.5 by: dt) collect:[:t | > state := stepper doStep: state time: t stepSize: dt]. > values. > diag := GETDiagramBuilder new. > (diag scatterplot) > models: values; > x: [ :v |v at:1]; > y: [ :v |v at:2]; > regularAxis; > dotSize: 2. > diag open. > ================================================ > > I'm able to view the nice butterfly figure. Look at the attached picture. > When I try to draw with more points, for exemple : 0.0 to:10.0 > I have an error ... At the moment, I don't understand if this a > problem with GraphET or SciSmalltalk. > > Regards, > > On Fri, Apr 18, 2014 at 9:59 AM, Serge Stinckwich > <[hidden email]> wrote: >> Thank you Natalia for starting a page about that. I think we should >> continue to work on a more elaborate documentation. >> >> I understand how to solve an ODE, but now I would like to plot the >> result between 1 and 10 for example. >> How I could do that ? >> >> What represent the result of the solver ? >> >> Regards, >> >> On Thu, Apr 17, 2014 at 8:53 PM, Natalia Tymchuk >> <[hidden email]> wrote: >>> >>> Hello, >>> I added >>> https://github.com/SergeStinckwich/SciSmalltalk/wiki/Quick-start-to-ODE >>> >>> >>> On Apr 17, 2014, at 3:03 PM, Natalia Tymchuk <[hidden email]> >>> wrote: >>> >>> Hello, Serge. >>> If you want to solve that ODE, you just need to execute >>> >>> (solver solve: system startState: 0 startTime: 1 endTime: 10) >>> or >>> (solver solve: system startState: 0 startTime: 1 endTime: 10 stepSize: 0.1). >>> >>> If you want me to tell how does every step work let me know. >>> >>> P.S. I will add it on github wiki. >>> Best regards, >>> Natalia >>> >>> >>> Четвер, 17 квітня 2014 р. 11:43:36 UTC+3 користувач Serge Stinckwich >>> написав: >>>> >>>> Dear Natalia, >>>> >>>> I try to use ODE from SciSmalltalk because I want to replace our adhoc >>>> RungeKutta code that we use in one my research project called Kendrick >>>> about epidemiological modeling: >>>> https://github.com/UMMISCO/Kendrick >>>> >>>> Basically diseases are modelled as a system of differential ODEs. >>>> >>>> Before doing that, I would like to do something simpler but I'm a bit >>>> stucked at the moment :-) >>>> For example, I try to mimic the 1D ODE example of odeint here : >>>> http://headmyshoulder.github.io/odeint-v2/examples.html >>>> >>>> |dt system stepper solver| >>>> dt := 0.1. >>>> system := ExplicitSystem block: [:x :t | 3.0/(2.0*t*t) + x/(2.0*t)]. >>>> stepper := RungeKuttaStepper onSystem: system. >>>> solver := (ExplicitSolver new) stepper: stepper; system: system; dt: dt. >>>> >>>> How do you solve the ODE ? >>>> >>>> Any hints ? >>>> >>>> Regards, >>>> -- >>>> Serge Stinckwich >>>> UCBN & UMI UMMISCO 209 (IRD/UPMC) >>>> Every DSL ends up being Smalltalk >>>> http://www.doesnotunderstand.org/ >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "SciSmalltalk" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [hidden email]. >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "SciSmalltalk" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [hidden email]. >>> For more options, visit https://groups.google.com/d/optout. >> >> >> >> -- >> Serge Stinckwich >> UCBN & UMI UMMISCO 209 (IRD/UPMC) >> Every DSL ends up being Smalltalk >> http://www.doesnotunderstand.org/ > > > > -- > Serge Stinckwich > UCBN & UMI UMMISCO 209 (IRD/UPMC) > Every DSL ends up being Smalltalk > http://www.doesnotunderstand.org/ -- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/ -- You received this message because you are subscribed to the Google Groups "SciSmalltalk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |