# Hi everyone, hope this is the right channel. New to Julia, long-time R user. I am

**URL:** <https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087>\
**Category:** General Usage\
**Created:** [February 26, 2021, 1:44pm UTC](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087 "2021-02-26T13:44:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 26, 2021, 1:44pm UTC](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087/1 "2021-02-26T13:44:22Z")

</div>

Hi everyone, hope this is the right channel. New to Julia, long-time R user. I am looking for the equivalent of R’s approxfun in Julia and its use in ODE systems (as in here: [https://tpetzoldt.github.io/deSolve-forcing/deSolve-forcing.html#example\_1:\_time-varying\_input](https://tpetzoldt.github.io/deSolve-forcing/deSolve-forcing.html#example_1:_time-varying_input)). Is there a simple code example/tutorial available online for when you have an ODE with a time-varying input modelled with an approx function? TIA

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1614346949482300?thread_ts=1614346949.482300&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![Paulo\_Jabardo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paulo_jabardo/32/3196_2.png) [@Paulo\_Jabardo](https://discourse.julialang.org/u/Paulo_Jabardo)\
**Post date:** [February 26, 2021, 1:49pm UTC](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087/2 "2021-02-26T13:49:59Z")

</div>

Take a look at the package [Interpolations](https://github.com/JuliaMath/Interpolations.jl). I think it does what you need.

---

<div class="post-metadata">

**Author:** ![fkrauer](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fkrauer](https://discourse.julialang.org/u/fkrauer)\
**Post date:** [February 26, 2021, 5:48pm UTC](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087/3 "2021-02-26T17:48:40Z")

</div>

Thanks Paulo, I was also recommended to look into [GitHub - PumasAI/DataInterpolations.jl: A library of data interpolation and smoothing functions](https://github.com/PumasAI/DataInterpolations.jl) and [https://github.com/JuliaApproximation/ApproxFun.jl](https://github.com/JuliaApproximation/ApproxFun.jl)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 26, 2021, 6:07pm UTC](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087/4 "2021-02-26T18:07:43Z")

</div>

Note that if you plug interpolated data into an ODE solver (using e.g. Interpolations.jl or [Dierckx.jl](https://github.com/kbarbary/Dierckx.jl)), you should tell the solver where the knots of your interpolation are ([using `tstops`](https://diffeq.sciml.ai/stable/basics/common_solver_opts/#Output-Control)) so that it knows to expect discontinuous derivatives. (Or you could use a smooth fit.)

See e.g. [Accuracy for discontinuous right hand side · Issue #245 · SciML/DifferentialEquations.jl · GitHub](https://github.com/SciML/DifferentialEquations.jl/issues/245)
