Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue running 1D example #123

Closed
huckl3b3rry87 opened this issue Oct 4, 2016 · 8 comments
Closed

Issue running 1D example #123

huckl3b3rry87 opened this issue Oct 4, 2016 · 8 comments

Comments

@huckl3b3rry87
Copy link

huckl3b3rry87 commented Oct 4, 2016

When I run:

using Interpolations
nx = 10
f(x) = sin(2pi/(nx-1) * (x-1))
xcoarse = `1:nx`
ycoarse = f(xcoarse);
xfine = 1:.1:xcoarse[end]
yfine = f(xfine);
yitp = interpolate(ycoarse, BSpline(Linear), OnGrid)

I get:

WARNING: sin{T <: Number}(x::AbstractArray{T}) is deprecated, use sin.(x) instead.
 in depwarn(::String, ::Symbol) at ./deprecated.jl:64
 in sin(::FloatRange{Float64}) at ./deprecated.jl:50
 in f(::UnitRange{Int64}) at ./In[1]:4
 in include_string(::String, ::String) at ./loading.jl:471
 in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/febbo/.julia/v0.6/IJulia/src/execute_request.jl:177
 in eventloop(::ZMQ.Socket) at /home/febbo/.julia/v0.6/IJulia/src/eventloop.jl:8
 in (::IJulia.##9#15)() at ./task.jl:363
while loading In[1], in expression starting on line 7

LoadError: MethodError: Cannot `convert` an object of type Type{Interpolations.Linear} to an object of type Interpolations.BSpline{D<:Interpolations.Degree}
This may have arisen from a call to the constructor Interpolations.BSpline{D<:Interpolations.Degree}(...),
since type constructors fall back to convert methods.
while loading In[1], in expression starting on line 12

 in Interpolations.BSpline{D<:Interpolations.Degree}(::Type{T}) at ./sysimg.jl:53

I am on Ubuntu 16.04 and

            _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0-dev.508 (2016-09-06 20:36 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit b1f1525 (27 days old master)
|__/                   |  x86_64-linux-gnu

Should I checkout the master Interpolations PKG?

@huckl3b3rry87
Copy link
Author

Does Interpolations.jl work with the new julia?

@timholy
Copy link
Member

timholy commented Oct 5, 2016

I haven't tried it, but to me "the new julia" means version 0.5. Version 0.6 is bleeding-edge (recommended only for users who contribute fixes to the packages they need).

@huckl3b3rry87
Copy link
Author

huckl3b3rry87 commented Oct 6, 2016

@timholy fair enough, I went back to 0.5, but I am still having issues when I type:

using Interpolations
nx = 10
f(x) = sin(2pi/(nx-1) * (x-1))
xcoarse = 1:nx
ycoarse = f(xcoarse);
xfine = 1:.1:xcoarse[end]
yfine = f(xfine);
yitp = interpolate(ycoarse)

I get:

ERROR: MethodError: Cannot `convert` an object of type Type{Interpolations.Linear} to an object of type Interpolations.BSpline{D<:Interpolations.Degree}
This may have arisen from a call to the constructor Interpolations.BSpline{D<:Interpolations.Degree}(...),
since type constructors fall back to convert methods.
 in Interpolations.BSpline{D<:Interpolations.Degree}(::Type{T}) at ./sysimg.jl:53

Any ideas?

@ChrisRackauckas
Copy link
Member

I just tried it and got the same error.

@ChrisRackauckas
Copy link
Member

The docs the example was taken from were just old. Using the README function:

itp = interpolate(A, BSpline(Linear()), OnGrid())

we got this working.

@timholy
Copy link
Member

timholy commented Oct 7, 2016

Where did you see these outdated docs?

@ChrisRackauckas
Copy link
Member

@timholy
Copy link
Member

timholy commented Nov 24, 2018

Fixed in #226

@timholy timholy closed this as completed Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants