Open kindlychung opened 7 years ago
You should use dFx1(x1=>x1_val, x2=>x2_val)
and similarly for newx1
.
Problem with not using these keyword args (is that the Julia name?) is that without them the number of variables depend on the expression.
For example assume you order according to alphabetic order, x, y
.
expr = x + y^2
print(expr(1, 2))
expr = diff(e, y)
print(expr(1, 2))
expr
is 2*y
at the end, but it would print 2 instead of 4, because SymEngine doesn't know about x and y and knows only about y.
I hope this clarifies the issue. Let me know if you have any doubts.
For example here is a toy implementation of deepest descent algorithm:
As you can see, the expression
dFx1
takesx1, x2
as parameters, whilenewx1
takess, x2, x1
as parameters, in that order. There is no logic in this and it is awkward to use.Would be nice if the parameters are ordered by a certain rule.