Is there a way to specify the dependent variable in eulers_method?
Consider
sage: u,v = PolynomialRing(QQ,2, "uv").gens()
sage: eulers_method(2*u + v, 1, 5, 0.2, 4)
On the face of it it's ambiguous whether this is solving du/dv = 2*u + v with u(v=1) = 5 or if it's doing dv/du = 2*u + v with v(u=1)=5. In practice it solves the latter, but how is that determined?
It appears to hinge on the order of u and v on the LHS of the first line but I can't find any mention of this in the documentation.
Asking for the code via
??eulers_methodand going till the end, we get it and there is an obvious asymmetry in the variablesx0andy0,so
his married withx0.How is the order of the arguments of f determined from the input expression?
The call in the example is:
The arguments above are placed inside the definition as follows:
fbecomes2*u+vandx0becomes1, andy0is5, andhis the step.2and we go tillx1which is4. The question is now, how we computei.e. why do we get
and not
11. Instead of answering this question, i would prefer to use a proper function in the call. so that there is no such question, depending on hidden structure. For instance:a.s.o.