Giter Club home page Giter Club logo

Comments (7)

Datseris avatar Datseris commented on June 10, 2024

Hi,
Please provide a Minimal Working Example, i.e., a code that can run and produce this error. This helps me produce the error.

from dynamicalsystems.jl.

Datseris avatar Datseris commented on June 10, 2024

(also, please do not ignore the issue template. It is there for a reason: to solve your bug faster. This means, you should also report the versions that you used)

from dynamicalsystems.jl.

gacarita avatar gacarita commented on June 10, 2024

Here is the code i'm using

using DataFrames, DifferentialEquations, DynamicalSystems, Plots

@inline @inbounds function vy0(C,p,v)
	"""
	Initial Velocity for cte jacobi conservation
		in:
			C = cte jacobi
			v = position and velocities of the particle
			cartesian coordinates
			p = mass ratio parameter == μ2
		out:
			ydot = velocity in y

	"""
		x, y, x̂= v
		μ = p
		#distance vectors
		r1 = sqrt((x+μ)^2 + y^2)
		r2 = sqrt((x - (1-μ))^2 + y^2)
		ŷ = sqrt(x^2 + y^2 - x̂^2 + 2*((1-μ)/r1 + μ/r2) - C)
		if x > 0
			return -ŷ
		end
		if x < 0
			return ŷ
		end
end


@inline @inbounds function eom!(du,u,p,t)
    """
    Planar Circular Restricted 3body problem
    Equations of motion in co-rotating frame

        in:
            u = position and velocities of the particle
            cartesian coordinates
                x = u[1]
                y = u[2]
                vx = u[3]
                vy = u[4]
            p = mass ratio parameter == μ2
            t = time span
        out:
            du = integration of the acel. and vel.

    """
        local μ = p

        #cartesian coordinates
        x = u[1]
        y = u[2]
        vx = u[3]
        vy = u[4]

        r1 = sqrt((x + μ)^2 + y^2)
        r2 = sqrt((x - (1-μ))^2 + y^2)

        du[1] = vx # F1
        du[2] = vy # F2
        du[3] =  2*vy  + x - (1 - μ)*(μ + x)/(r1^3) - μ*(x -(1-μ))/(r2^3) # F3
        du[4] = -2*vx  + y - ((1 - μ)/(r1^3) + μ/(r2^3))*y # F4
        return
    end

p=0.07

x0=-1.24
y0=0.19
vx0=0
vyu = vy0(-1.2,p,[x0,y0,vx0])

u0 = [x0,y0,vx0,vyu]
plane = (3, 0.0)

ds = ContinuousDynamicalSystem(eom!, u0, p)
psos = poincaresos(ds, plane, 6000.0; u0 = u0,direction = 0,rootkw = (xrtol = 1e-9, atol = 1e-9),
        diffeq = (alg = Vern9()))
scatter(psos[:, 1], psos[:, 2]; markersize = 2.0)

#code works fine until here

pvalues = collect(0.1:0.15:201)
i = Int(1)
plane = (3, 0.0)
tf = 200.0
p_index = 1

output = produce_orbitdiagram(ds, plane, i,pvalues;
                              tfinal = tf, Ttr = 200.0)


from dynamicalsystems.jl.

Datseris avatar Datseris commented on June 10, 2024

The call signature for produce_orbitdiagram is:
image

You only provide 4 positional arguments, you miss p_index.

from dynamicalsystems.jl.

gacarita avatar gacarita commented on June 10, 2024

Sorry i missed that part when i shared the code, however even setting p_index=1 in to the output

output = produce_orbitdiagram(ds, plane, i,p_index,pvalues;
                              tfinal = tf, Ttr = 200.0)

I still get an error

no method matching setindex!(::Float64, ::Float64, ::Int64)

from dynamicalsystems.jl.

Datseris avatar Datseris commented on June 10, 2024

I see. Well it's because your parameter "container" isn't a container, but a number, p=0.07. Do p = [0.07] instead. Numbers are not mutable, but vectors are.

from dynamicalsystems.jl.

gacarita avatar gacarita commented on June 10, 2024

Gotcha. Thank you.

from dynamicalsystems.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.