JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software
https://docs.sciml.ai/Symbolics/stable/
Other
1.37k stars 153 forks source link

Solving rational equation #29

Open baggepinnen opened 4 years ago

baggepinnen commented 4 years ago

I have the following equation which I would like to solve for the parameters kp,ki,kd,T. The variable s is the polynomial variable.

Equation(ModelingToolkit.Constant(0), (1.0 + s ^ 2 + s) * inv(0.2 * s ^ 2 + s) ^ 1 - ((kp + ki / s) + kd * s) * (1 / (s * T + 1) ^ 2))

I can't figure out how to do this without supplying a numerical value for s. It should really hold for all s. I guess I want to do something like https://mtk.sciml.ai/dev/tutorials/nonlinear/#Solving-Nonlinear-Systems-with-NLsolve-1 but I have to manually construct the system of equations?

Below is my code

using ModelingToolkit, ControlSystems

# @parameters s
@variables kp, ki, kd, T, s

function sym_pid(; kp=0., ki=0., kd=0., time=false, series=false)
    @variables s
    if series
        return time ? kp*(1 + 1/(ki*s) + kd*s) : kp*(1 + ki/s + kd*s)
    else
        return time ? kp + 1/(ki*s) + kd*s : kp + ki/s + kd*s
    end
end

Cs = sym_pid(;kp, ki, kd) # symbolic controller
Lf = 1/(s*T + 1)^2
C = Cs*Lf #|> simplify

kp_,ki_,kd_,T_ = 1,1,1,0.1
Cn = pid(;kp=kp_, ki=ki_, kd=kd_) # Numerical controller
Lf_ = tf(1,[T_, 1])^2
C_ = Cn*Lf_
"Convert a numeric transfer function to a symbolic"
function sym_tf(G::TransferFunction)
    n = reverse(numvec(G)[])
    sn = sum(s^i*n[i+1] for i in 0:length(n)-1)
    d = reverse(denvec(G)[])
    sd = sum(s^i*d[i+1] for i in 0:length(n)-1)
    simplify(sn/sd)
end

C_ns = sym_tf(C_)

## System of equations
eqs = [0 ~ C_ns - C]
ns = NonlinearSystem(eqs, [kp,ki,kd,T],[])
nlsys_func = generate_function(ns)[2]

f = eval(nlsys_func)
du = zeros(4); u = ones(4)
params = []
f(du,u,params) # Breaks here

j_func = generate_jacobian(ns)[2] # second is in-place
j! = eval(j_func)

using NLsolve
res = nlsolve((out, x) -> f(out, x, params), (out, x) -> j!(out, x, params), ones(4))

┆Issue is synchronized with this Trello card by Unito

YingboMa commented 3 years ago

tf is not defined. Could you provide a full MWE?

baggepinnen commented 3 years ago

tf is exported by ControlSystems, are you sure you didn't get a warning when importing ControlSystems that there was a name conflict or something?

ChrisRackauckas commented 2 weeks ago

@n0rbed this is handled by the new symbolic_solve?

n0rbed commented 2 weeks ago

@n0rbed this is handled by the new symbolic_solve?

If this refers to https://mtk.sciml.ai/dev/tutorials/nonlinear/#Solving-Nonlinear-Systems-with-NLsolve-1

Then yes, that linear system can be solved; The example by @baggepinnen though has an "inv" - if thats the reciprocal of its argument im not sure our solver handles it.

ChrisRackauckas commented 2 weeks ago

I just gave it a try:

using Symbolics, Nemo
@variables s kp kd ki T
ex = (1.0 + s ^ 2 + s) * inv(0.2 * s ^ 2 + s) ^ 1 - ((kp + ki / s) + kd * s) * (1 / (s * T + 1) ^ 2)
clipboard(symbolic_solve(ex, s))

I'm not convinced that keeping the rationals is a good API, though I have a morbid curiosity for exact computing that compels me to share the answer anyways.

answer.txt

ChrisRackauckas commented 2 weeks ago

Oh, that's because of the 0.2 because it's not 1//5. Fixing that simplifies it a ton:

using Symbolics, Nemo
@variables s kp kd ki T
ex = (1 + s ^ 2 + s) * inv(1//5 * s ^ 2 + s) ^ 1 - ((kp + ki / s) + kd * s) * (1 / (s * T + 1) ^ 2)
res = symbolic_solve(ex, s);
SymbolicUtils.BasicSymbolic{Real}[(-10T + kd - 5(T^2)) / (20(T^2)) + (1//2)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + (-200(T^2)*kd + 30T*(kd^2) - (kd^3) + 900(T^3)*kd + 200(T^3)*kp - 85(T^2)*(kd^2) - 20(T^2)*kd*kp + 750(T^5) + 525(T^4)*kd - 200(T^4)*ki - 900(T^4)*kp - 375(T^6)) / (500(T^6)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)))) + (100(T^2) - 60T*kd + 3(kd^2) - 100(T^3) + 170(T^2)*kd + 40(T^2)*kp - 125(T^4)) / (100(T^4)) + (-4000000(T^10) + 2400000(T^9)*kd - 120000(T^8)*(kd^2) + 4000000(T^11) - 6800000(T^10)*kd - 1600000(T^10)*kp + 5000000(T^12)) / (6000000(T^12))) - (1//2)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3))), (-10T + kd - 5(T^2)) / (20(T^2)) - (1//2)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + (-200(T^2)*kd + 30T*(kd^2) - (kd^3) + 900(T^3)*kd + 200(T^3)*kp - 85(T^2)*(kd^2) - 20(T^2)*kd*kp + 750(T^5) + 525(T^4)*kd - 200(T^4)*ki - 900(T^4)*kp - 375(T^6)) / (500(T^6)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)))) + (100(T^2) - 60T*kd + 3(kd^2) - 100(T^3) + 170(T^2)*kd + 40(T^2)*kp - 125(T^4)) / (100(T^4)) + (-4000000(T^10) + 2400000(T^9)*kd - 120000(T^8)*(kd^2) + 4000000(T^11) - 6800000(T^10)*kd - 1600000(T^10)*kp + 5000000(T^12)) / (6000000(T^12))) - (1//2)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3))), (-10T + kd - 5(T^2)) / (20(T^2)) + (1//2)*√((200(T^2)*kd - 30T*(kd^2) + kd^3 - 900(T^3)*kd - 200(T^3)*kp + 85(T^2)*(kd^2) + 20(T^2)*kd*kp - 750(T^5) - 525(T^4)*kd + 200(T^4)*ki + 900(T^4)*kp + 375(T^6)) / (500(T^6)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)))) + (4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + (100(T^2) - 60T*kd + 3(kd^2) - 100(T^3) + 170(T^2)*kd + 40(T^2)*kp - 125(T^4)) / (100(T^4)) + (-4000000(T^10) + 2400000(T^9)*kd - 120000(T^8)*(kd^2) + 4000000(T^11) - 6800000(T^10)*kd - 1600000(T^10)*kp + 5000000(T^12)) / (6000000(T^12))) + (1//2)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3))), (-10T + kd - 5(T^2)) / (20(T^2)) - (1//2)*√((200(T^2)*kd - 30T*(kd^2) + kd^3 - 900(T^3)*kd - 200(T^3)*kp + 85(T^2)*(kd^2) + 20(T^2)*kd*kp - 750(T^5) - 525(T^4)*kd + 200(T^4)*ki + 900(T^4)*kp + 375(T^6)) / (500(T^6)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)))) + (4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) - 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + (100(T^2) - 60T*kd + 3(kd^2) - 100(T^3) + 170(T^2)*kd + 40(T^2)*kp - 125(T^4)) / (100(T^4)) + (-4000000(T^10) + 2400000(T^9)*kd - 120000(T^8)*(kd^2) + 4000000(T^11) - 6800000(T^10)*kd - 1600000(T^10)*kp + 5000000(T^12)) / (6000000(T^12))) + (1//2)*√((4000000(T^10) - 2400000(T^9)*kd + 120000(T^8)*(kd^2) - 4000000(T^11) + 6800000(T^10)*kd + 1600000(T^10)*kp - 5000000(T^12)) / (12000000(T^12)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) + √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)) + 2∛((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)) - √(((128000000000000000000(T^30) - 384000000000000000000(T^31) - 268800000000000000000(T^30)*kd - 76800000000000000000(T^30)*kp + 768000000000000000000(T^32) - 1305600000000000000000(T^31)*kd + 230400000000000000000(T^31)*ki + 1075200000000000000000(T^31)*kp + 337920000000000000000(T^30)*(kd^2) - 23040000000000000000(T^30)*kd*ki + 15360000000000000000(T^30)*kd*kp + 15360000000000000000(T^30)*(kp^2) - 896000000000000000000(T^33) + 5068800000000000000000(T^32)*kd - 2419200000000000000000(T^32)*ki + 460800000000000000000(T^32)*kp + 537600000000000000000(T^31)*(kd^2) + 1105920000000000000000(T^31)*kd*ki - 1121280000000000000000(T^31)*kd*kp - 46080000000000000000(T^31)*ki*kp - 199680000000000000000(T^31)*(kp^2) - 128000000000000000000(T^30)*(kd^3) - 46080000000000000000(T^30)*(kd^2)*ki + 38400000000000000000(T^30)*(kd^2)*kp + 4608000000000000000(T^30)*kd*ki*kp + 7680000000000000000(T^30)*kd*(kp^2) - 1024000000000000000(T^30)*(kp^3) + 768000000000000000000(T^34) - 153600000000000000000(T^33)*kd + 1382400000000000000000(T^33)*ki - 4684800000000000000000(T^33)*kp + 384000000000000000000(T^32)*(kd^2) - 4055040000000000000000(T^32)*kd*ki - 537600000000000000000(T^32)*kd*kp + 69120000000000000000(T^32)*(ki^2) - 253440000000000000000(T^32)*ki*kp + 1628160000000000000000(T^32)*(kp^2) - 384000000000000000000(T^35) - 384000000000000000000(T^34)*kd + 2995200000000000000000(T^34)*ki + 499200000000000000000(T^34)*kp + 128000000000000000000(T^36)) / (27648000000000000000000(T^36)))^2 + ((-16000000000000(T^20) + 32000000000000(T^21) + 22400000000000(T^20)*kd + 6400000000000(T^20)*kp - 48000000000000(T^22) + 44800000000000(T^21)*kd - 19200000000000(T^21)*ki - 83200000000000(T^21)*kp - 16000000000000(T^20)*(kd^2) + 1920000000000(T^20)*kd*ki + 3200000000000(T^20)*kd*kp - 640000000000(T^20)*(kp^2) + 32000000000000(T^23) + 32000000000000(T^22)*kd + 182400000000000(T^22)*ki - 41600000000000(T^22)*kp - 16000000000000(T^24)) / (576000000000000(T^24)))^3)))]
n0rbed commented 2 weeks ago

That output is huge; Can the author double-check if this is correct? im a little doubtful of my creation

Also, me and alex kept the rationals because it makes more sense as an "exact symbolic solver"; looks ugly though i agree

ChrisRackauckas commented 2 weeks ago

julia> convert.(ComplexF64,[substitute(r, Dict(s=>1, kd=>1, kp=>1, ki=>1, T=>1)) for r in res])
4-element Vector{ComplexF64}:
 -1.727233711018889e-77 + 0.0im
                   -1.8 + 0.0im
                   -0.5 + 0.8660254037844386im
                   -0.5 - 0.8660254037844386im

So it looks like it's working. Though @baggepinnen I would probably recommend using the HomotopyContinuation methods for your application there, which MTK can now target.

ChrisRackauckas commented 2 weeks ago

@n0rbed it's because 0.2 != 1//5 so it expand it out to its full rational form 16 digits and that expands all of the numbers. It's kind of a bad UI thing, but double checking the values seems fine.

baggepinnen commented 2 weeks ago

The idea was to solve for [kp, ki, kd, T], not s. Trying

res = symbolic_solve(ex, [kp, ki, kd, T])

I was prompted to install Groebner.jl, and after doing so I get

julia> res = symbolic_solve(ex, [kp, ki, kd, T]);
[ Info: Assuming (((1 + T*s)^2)*(s + (1//5)*(s^2))) != 0
[ Info: Assuming (((1 + T*s)^2)*(s + (1//5)*(s^2))) != 0
[ Info: Assuming (((1 + T*s)^2)*(s + (1//5)*(s^2))) != 0
ERROR: DomainError with Invalid monomial ordering.:

Stacktrace:
  [1] map_variables(vars::Vector{Num}, varmap::Dict{DynamicPolynomials.Variable{…}, Int64})
    @ Groebner ~/.julia/packages/Groebner/3101Q/src/monomials/orderings.jl:347
  [2] ordering_transform(ord::Lex{false, Num}, varmap::Dict{DynamicPolynomials.Variable{…}, Int64})
    @ Groebner ~/.julia/packages/Groebner/3101Q/src/monomials/orderings.jl:355
  [3] io_convert_polynomials_to_ir(polynomials::Vector{DynamicPolynomials.Polynomial{…}}, options::Groebner.KeywordArguments)
    @ GroebnerDynamicPolynomialsExt ~/.julia/packages/Groebner/3101Q/ext/GroebnerDynamicPolynomialsExt.jl:32
  [4] groebner0(polynomials::Vector{DynamicPolynomials.Polynomial{…}}, options::Groebner.KeywordArguments)
    @ Groebner ~/.julia/packages/Groebner/3101Q/src/groebner/groebner.jl:9
  [5] #groebner#206
    @ ~/.julia/packages/Groebner/3101Q/src/interface.jl:110 [inlined]
  [6] groebner_basis(polynomials::Vector{Num}; kwargs::@Kwargs{ordering::Lex{false, Num}})
    @ SymbolicsGroebnerExt ~/.julia/packages/Symbolics/rtkf9/ext/SymbolicsGroebnerExt.jl:38
  [7] solve_zerodim(eqs::Vector{Num}, vars::Vector{Num}; dropmultiplicity::Bool, warns::Bool)
    @ SymbolicsGroebnerExt ~/.julia/packages/Symbolics/rtkf9/ext/SymbolicsGroebnerExt.jl:202
  [8] solve_zerodim
    @ ~/.julia/packages/Symbolics/rtkf9/ext/SymbolicsGroebnerExt.jl:167 [inlined]
  [9] solve_multivar(eqs::Vector{Num}, vars::Vector{Num}; dropmultiplicity::Bool, warns::Bool)
    @ SymbolicsGroebnerExt ~/.julia/packages/Symbolics/rtkf9/ext/SymbolicsGroebnerExt.jl:304
 [10] solve_multivar
    @ ~/.julia/packages/Symbolics/rtkf9/ext/SymbolicsGroebnerExt.jl:303 [inlined]
 [11] symbolic_solve(expr::Num, x::Vector{Num}; dropmultiplicity::Bool, warns::Bool)
    @ Symbolics ~/.julia/packages/Symbolics/rtkf9/src/solver/main.jl:204
 [12] symbolic_solve(expr::Num, x::Vector{Num})
    @ Symbolics ~/.julia/packages/Symbolics/rtkf9/src/solver/main.jl:145
 [13] top-level scope
    @ REPL[122]:1
Some type information was truncated. Use `show(err)` to see complete types.
n0rbed commented 2 weeks ago

@baggepinnen Can you share ex? full mwe pls

baggepinnen commented 2 weeks ago
using Symbolics, ControlSystemsBase

# @parameters s
@variables kp, ki, kd, T, s

function sym_pid(; kp=0., ki=0., kd=0., time=false, series=false)
    @variables s
    if series
        return time ? kp*(1 + 1/(ki*s) + kd*s) : kp*(1 + ki/s + kd*s)
    else
        return time ? kp + 1/(ki*s) + kd*s : kp + ki/s + kd*s
    end
end

Cs = sym_pid(;kp, ki, kd) # symbolic controller
Lf = 1/(s*T + 1)^2
C = Cs*Lf #|> simplify

kp_,ki_,kd_,T_ = 1//1, 1//1, 1//1, 1//10
Cn = pid(;kp=kp_, ki=ki_, kd=kd_) # Numerical controller
Lf_ = tf(1,[T_, 1])^2
C_ = Cn*Lf_
"Convert a numeric transfer function to a symbolic"
function sym_tf(G)
    n = reverse(numvec(G)[])
    sn = sum(s^i*n[i+1] for i in 0:length(n)-1)
    d = reverse(denvec(G)[])
    sd = sum(s^i*d[i+1] for i in 0:length(n)-1)
    simplify(sn/sd)
end

C_ns = sym_tf(C_)

ex = C_ns - C
using Nemo, Groebner
res = symbolic_solve(ex, [kp, ki, kd, T]);
convert.(ComplexF64,[substitute(r, Dict(s=>1, kd=>1, kp=>1, ki=>1, T=>1)) for r in res])
ChrisRackauckas commented 2 weeks ago

I'm not sure what that error is, but it needs a higher level description.

n0rbed commented 2 weeks ago

@baggepinnen Sorry for the late reply, is this okay?

julia> res = [symbolic_solve(ex, var)[1] for var in vars]
4-element Vector{SymbolicUtils.BasicSymbolic{Real}}:
 (-(1//1) + ki - s - (2//1)*T*s + (1//5)*ki*s - (s^2) - (2//1)*T*(s^2) + kd*(s^2) - (T^2)*(s^2) - (2//1)*T*(s^3) + (1//5)*kd*(s^3) - (T^2)*(s^3) - (T^2)*(s^4)) / (-s - (1//5)*(s^2))
 (-(1//1) - s - (2//1)*T*s + kp*s - (s^2) - (2//1)*T*(s^2) + kd*(s^2) + (1//5)*kp*(s^2) - (T^2)*(s^2) - (2//1)*T*(s^3) + (1//5)*kd*(s^3) - (T^2)*(s^3) - (T^2)*(s^4)) / (-(1//1) - (1//5)*s)
 (-(1//1) + ki - s - (2//1)*T*s + (1//5)*ki*s + kp*s - (s^2) - (2//1)*T*(s^2) + (1//5)*kp*(s^2) - (T^2)*(s^2) - (2//1)*T*(s^3) - (T^2)*(s^3) - (T^2)*(s^4)) / (-(s^2) - (1//5)*(s^3))
 (-10s + √(100ki*(s^2) + 120ki*(s^3) + 100kp*(s^3) + 100kd*(s^4) + 120ki*(s^4) + 120kp*(s^4) + 120kd*(s^5) + 20ki*(s^5) + 120kp*(s^5) + 120kd*(s^6) + 20kp*(s^6) + 20kd*(s^7)) - 10(s^2) - 10(s^3)) / (10(s^2) + 10(s^3) + 10(s^4))

julia> convert.(ComplexF64,[substitute(r, Dict(s=>1, kd=>1, kp=>1, ki=>1, T=>1)) for r in res])
4-element Vector{ComplexF64}:
                 8.0 + 0.0im
                 8.0 + 0.0im
                 8.0 + 0.0im
 0.09544511501033223 + 0.0im

Since you're solving for each variable in terms of the other variables using one equation ex, doing

symbolic_solve(ex, var)

Forces the solver to use the single variable solver, so it doesn't use Groebner basis (which is used if you call symbolic_solve(ex, [vars]) ) and avoids the error above.

baggepinnen commented 2 weeks ago

I would like to find values of all parameters [kp, ki, kd, T] such that ex = 0 for all s. The way I normally do this by hand is to set up a system of equations, one for each power of s, and then solve this system of equations. If we take a simple contrived example, solving for $a,b,c,d$ in $$\dfrac{s^2 + 1}{s^2 + 2s + 1} = \dfrac{s^2 + a}{bcs^2 + (b + c)s + d/c}$$ would yield $$a = 1, bc = 1, (b+c) = 2, d/c = 1$$ for 4 equations in 4 unknowns.

n0rbed commented 2 weeks ago

Aha i got you; This isnt currently supported yes. We could certainly write a function for this in the future. I'm not sure if including this in symbolic_solve is a good idea though.

n0rbed commented 2 weeks ago

@ChrisRackauckas what do you think?

ChrisRackauckas commented 2 weeks ago

I see, I thought he wanted to solve for s. Indeed if you want to solve for all but one variable this is a nice and common trick, and it can be recursed as well: get all solutions of one variable, and then use those solutions to get all solutions of the next, etc. Putting it into a system of equations is just doing that simultaneously in the case of rational functions, which is a good case to specialize.

n0rbed commented 1 week ago

@baggepinnen Checkout this new func and let me know what u think

n0rbed commented 1 week ago

Also id like to note that it only works if the coefficient next to any S in the equation is a polynomial. We'll use ia_solve in the future

ChrisRackauckas commented 1 week ago

https://github.com/JuliaSymbolics/Symbolics.jl/pull/1348 refactored that part a chunk and it should be more tested and robust.

ChrisRackauckas commented 1 week ago

Checkout this new func and let me know what u think

@n0rbed my understanding is that it's just part of the ia_solve pipeline now so symbolic_solve should be using it as a rule?

n0rbed commented 1 week ago

my understanding is that it's just part of the ia_solve pipeline now so symbolic_solve should be using it as a rule?

@ChrisRackauckas Yes, i didnt write the "detector" for this case yet though so didnt add it to symbolic_solve.