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

trapz fails on vector integrands #15

Closed
mzaffalon opened this issue Mar 21, 2024 · 1 comment
Closed

trapz fails on vector integrands #15

mzaffalon opened this issue Mar 21, 2024 · 1 comment

Comments

@mzaffalon
Copy link

vx=range(0,1,length=10)
vy=range(0,2,length=20)
vz=range(0,1,length=30)
M=[[x, x^2+y^2+z^2] for x=vx,y=vy,z=vz];
trapz((vx,vy,vz),M) #-> ERROR: MethodError: no method matching one(::Type{Vector{Float64}})

but the signature for https://github.com/francescoalemanno/Trapz.jl/blob/master/src/kernels.jl#L19 is M <: AbstractArray{Tm,Nm}. Can Trapz.jl be extended to vector integrands?

@francescoalemanno
Copy link
Owner

just use

[trapz((vx,vy,vz),getindex.(M,i)) for i = 1:2]

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

2 participants