Skip to content

Can't figure out how to create multivariate approximation #330

Open
@baggepinnen

Description

@baggepinnen

Hi guys, I'm trying to figure out how to create a multivariate approximation to a nonlinear function dfx, but can't quite understand the multivariate interface. Below is an attempt at creating an order 7 approximation, but the two nonlinear equations get approximated linearly only. What am I doing wrong?

using TaylorModels
function dxf(xs, us)
    [
    xs[3]
    xs[4]
       -0.8333333333333334((0.1(0.9810000000000001sin(xs[2]) - 0.08333333333333334(-us[1] - 0.1(xs[4]^2)*sin(xs[2]))*cos(xs[2]))*cos(xs[2])) / (0.008333333333333335(cos(xs[2])^2) - 0.05) - us[1] - 0.1(xs[4]^2)*sin(xs[2]))
       (0.9810000000000001sin(xs[2]) - 0.08333333333333334(-us[1] - 0.1(xs[4]^2)*sin(xs[2]))*cos(xs[2])) / (0.008333333333333335(cos(xs[2])^2) - 0.05)
    ]
end

nx = 4; nu = 1
taylor_expand(zeros(nx+nu); order=7) do xu
    xs = xu[1:4]
    us = xu[5]
    dxf(xs, u)
end
4-element Vector{TaylorN{Float64}}:
                          1.0 x₃ + 𝒪(‖x‖⁸)
                          1.0 x₄ + 𝒪(‖x‖⁸)
  1.9620000000000002 x₂ + 1.0 x₅ + 𝒪(‖x‖²)
            - 23.544 x₂ - 2.0 x₅ + 𝒪(‖x‖²)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions