fricas (1) -> ++ ++ Functional derivatives (Frechet derivative) ++ Sample: Lagrangian of a double pendulum ++ Ugly output of derivatives of (univariate) functions :( ++ Type: Void
fricas macro mks2 s == mksn(s, Type: Void
fricas macro mkeq(s, Type: Void
fricas -- Frechet derivative (functional derivative, Type: Void
fricas -- test: DF(xt.1^n+sin xt.1,
Type: List(BasicOperator?)
fricas x:=map(operator,
Type: List(BasicOperator?)
fricas y:=map(operator,
Type: List(BasicOperator?)
fricas l:=mks2 l
Type: List(Symbol)
fricas m:=mks2 m
Type: List(Symbol)
fricas -- Make functions of t qt:=[f(t) for f in q]
Type: List(Expression(Integer))
fricas xt:=[f(t) for f in x]
Type: List(Expression(Integer))
fricas yt:=[f(t) for f in y]
Type: List(Expression(Integer))
fricas -- Geometry,
Type: List(Equation(Expression(Integer)))
fricas eqy:=mkeq(yt,
Type: List(Equation(Expression(Integer)))
fricas -- All in a matrix meqxy:= matrix [eqx,
Type: Matrix(Equation(Expression(Integer)))
fricas -- Potential energy V:=operator 'V
Type: BasicOperator?
fricas eqV:=V(concat[xt,
Type: Equation(Expression(Integer))
fricas -- Kinetic energy T:=operator 'T
Type: BasicOperator?
fricas v:=D(matrix [xt,
Type: SquareMatrix?(2,
fricas vv:=diagonal(transpose(v)*v)
Type: DirectProduct?(2,
fricas eqT:=T(concat listOfLists transpose v)=(1/2)*(m.1*vv.1 + m.2*vv.2)
Type: Equation(Expression(Integer))
fricas -- DF(eqT,
Type: BasicOperator?
fricas Largs:=concat [concat[xt,
Type: List(Expression(Integer))
fricas eqL:=L(args)=rhs(eqT)-rhs(eqV)
Type: Equation(Expression(Integer))
fricas -- Side conditions sc1:=map(normalize,
Type: Equation(Expression(Integer))
fricas sc2:=map(normalize,
Type: Equation(Expression(Integer))
fricas L2:=operator 'L2
Type: BasicOperator?
fricas eqL2:=L2(Largs)=rhs(eqT)-rhs(eqV)+A*(rhs(sc1)-lhs(sc1))+B*(rhs(sc2)-lhs(sc2))
Type: Equation(Expression(Integer))
fricas -- Lagrange equations with SC eqL2x:=[rhs(D(DF(eqL2, fricas Compiling function DF with type (Equation(Expression(Integer)),
Type: List(Equation(Expression(Integer)))
fricas eqL2y:=[rhs(D(DF(eqL2,
Type: List(Equation(Expression(Integer)))
fricas eqL2x.1
Type: Equation(Expression(Integer))
fricas eqL2x.2
Type: Equation(Expression(Integer))
fricas eqL2y.1
Type: Equation(Expression(Integer))
fricas eqL2y.2
Type: Equation(Expression(Integer))
|