# How to use DifferentialEquations with complicated equations

**URL:** https://discourse.julialang.org/t/how-to-use-differentialequations-with-complicated-equations/20740
**Category:** New to Julia
**Tags:** diffeq
**Created:** [February 13, 2019, 10:34am UTC](https://discourse.julialang.org/t/how-to-use-differentialequations-with-complicated-equations/20740 "2019-02-13T10:34:28Z")
**Posts on this page:** 1
**Showing post:** 18

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [May 10, 2019, 9:33am UTC](https://discourse.julialang.org/t/how-to-use-differentialequations-with-complicated-equations/20740/18 "2019-05-10T09:33:20Z")

</div>

> [@HelgavonLichtenstein](#):
>
> ERROR: MethodError: no method matching zero(::Type{Array{Float64,1}})

I don’t think the code you posted actually contains the line that is causing your error. It appears your error comes from a confusion of the functions `zero` and `zeros` (I noted something similar when I commented on your related issue last night [here](https://discourse.julialang.org/t/very-slow-array-creation-and-benchmark-iterate-error/24020/5))

Consider:

```julia
help?> zero
search: zero zeros iszero set_zero_subnormals get_zero_subnormals count_zeros

  zero(x)

  Get the additive identity element for the type of x (x can also specify the
  type itself).

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> zero(1)
  0

  julia> zero(big"2.0")
  0.0

  julia> zero(rand(2,2))
  2×2 Array{Float64,2}:
   0.0 0.0
   0.0 0.0

```

Which is different from:

```julia
help?> zeros
search: zeros count_zeros set_zero_subnormals get_zero_subnormals leading_zeros

  zeros([T=Float64,] dims...)

  Create an Array, with element type T, of all zeros with size specified by
  dims. See also fill, ones.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> zeros(1)
  1-element Array{Float64,1}:
   0.0

  julia> zeros(Int8, 2, 3)
  2×3 Array{Int8,2}:
   0 0 0
   0 0 0

```

Your use case seems largely to be the creation of arrays filled with zeros, for which `zeros` is the appropriate function. Your error likely comes from calling:

```julia
julia> zero(Array{Float64,1})
ERROR: MethodError: no method matching zero(::Type{Array{Float64,1}})

```

i.e. calling the `zero` function with a Type, rather than in instance/object of a type.

More generally I think others have already pointed out that many of your issues and questions fundamentally boil down to relatively basic misunderstandings of usage and behaviour of variables, functions, values, types etc. in Julia. I think it might be helpful for you to work through an introductory resource that clarifies some of these questions and hopefully helps you to avoid issues you seem to keep running into; I always found Ben Lauwen’s [Think Julia](https://benlauwens.github.io/ThinkJulia.jl/latest/book.html) an excellent resource for this tasks and I’d recommend you take a couple of days to work through it step-by-step!

---

_[View the full topic](https://discourse.julialang.org/t/how-to-use-differentialequations-with-complicated-equations/20740)._
