# Can we find a DDe's canstant from a table

**URL:** <https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676>\
**Category:** Biology, Health, and Medicine\
**Created:** [May 25, 2022, 8:31pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676 "2022-05-25T20:31:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Achraf\_el\_fadli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/achraf_el_fadli/32/36477_2.png) [@Achraf\_el\_fadli](https://discourse.julialang.org/u/Achraf_el_fadli)\
**Post date:** [May 25, 2022, 8:31pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/1 "2022-05-25T20:31:24Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/1/6/165d2c354e34db574efe229c1491189122987385.png)  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/4/640cdd05605a0ddeb74b8587a75d736ba61ead6a.png)  
for finding a,b,c the most compatible with the model

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [May 25, 2022, 8:36pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/2 "2022-05-25T20:36:19Z")

</div>

Is this for a class? We cannot help you with homework questions on this forum.

---

<div class="post-metadata">

**Author:** ![Achraf\_el\_fadli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/achraf_el_fadli/32/36477_2.png) [@Achraf\_el\_fadli](https://discourse.julialang.org/u/Achraf_el_fadli)\
**Post date:** [May 25, 2022, 8:53pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/3 "2022-05-25T20:53:07Z")

</div>

nope i just wanna use julia but i don’t know how

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [May 25, 2022, 8:55pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/4 "2022-05-25T20:55:10Z")

</div>

Okay.

Please read about [how to make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757).

Asking for help on forums is a skill, and we can’t help you unless you give more information and follow the instructions in that post.

---

<div class="post-metadata">

**Author:** ![Achraf\_el\_fadli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/achraf_el_fadli/32/36477_2.png) [@Achraf\_el\_fadli](https://discourse.julialang.org/u/Achraf_el_fadli)\
**Post date:** [May 25, 2022, 9:11pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/5 "2022-05-25T21:11:07Z")

</div>

‘’'julia  
using DifferentialEquations  
using Pkg  
#using Plots

using Plots  
function f(du, u, h, p, t)

```
a, b,c, τ = p
⌛ = h(p, t - τ, idxs = 1)
du[1] = u[1] * (1 - u[1] - (a * ⌛ + b)*exp(-c*⌛))

```

end

u0 = [0.008]  
τ = 7  
h(p, t; idxs = 1) = 0.008  
a = 0.517;  
b = 0.988;  
c=0.173;  
p = [a, b,c,τ]  
tspan = (8.0, 23.0)

prob = DDEProblem(f, u0, h, tspan, p, canstant\_lag = [τ])  
sol = solve(prob,saveat=1)  
temps=[8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]  
verus=[5.011,0.199,0.01,0.0063,1.0056,0.008,0.0056,0.003,0.005,0.01,0.016,0.02,0.039,0.015,0.0001,0.0001]  
L=[temps,verus]  
scatter!(temps,verus)  
vir=Array(L)  
temp\_prob=remake(prob,p=[10,5,40,6])  
temp\_sol=solve(temp\_prob,saveat=1)

using DiffEqFlux,Optim  
function loss(p)  
temp\_prob=remake(prob,p=p)  
temp\_sol=solve(temp\_prob,saveat=1)  
c=sum(abs2,Array(temp\_sol)-vir)

end

loss([1,2,4,5])  
pinit=[1,2,3,4]  
res=DiffEqFlux.sciml\_train(loss,pinit,BFGS())  
‘’’

I wanna transform vir to the same dimension of temp\_sol

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [May 25, 2022, 9:21pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/6 "2022-05-25T21:21:11Z")

</div>

**Post** [**quoted code**](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530) by enclosing code blocks in triple-backticks :

````julia
```julia
function f(x, y)
    x + y
end
```

````

This will highlight syntax and use a monospace font.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 26, 2022, 12:35pm UTC](https://discourse.julialang.org/t/can-we-find-a-ddes-canstant-from-a-table/81676/7 "2022-05-26T12:35:33Z")

</div>

> [@Achraf\_el\_fadli](#):
>
> I wanna transform vir to the same dimension of temp\_sol

Just transpose it and set `saveat` to the right time points? (saveat = 16:23 if I’m not mistaken?)
