You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function grad(f,vars) #vars is an array of variables
if length(f) > 1
f1 = ModelingToolkit.jacobian(f,vars)
else
f1 = ModelingToolkit.gradient(f,vars)
end
f2,f2! = ModelingToolkit.build_function(f1,vars,ModelingToolkit.simplified_expr,Val{false})
return f2
end
Now, try grad([x,y,z],[x,y,z]) after declaring x, y, z to be variables. The result is not a constant identity matrix function, even though it should be. Rather, it's a vector with 9 entries, a flattened form of what the answer should be. Is there a bug somewhere?
The text was updated successfully, but these errors were encountered:
Define the function
function grad(f,vars) #vars is an array of variables
if length(f) > 1
f1 = ModelingToolkit.jacobian(f,vars)
else
f1 = ModelingToolkit.gradient(f,vars)
end
f2,f2! = ModelingToolkit.build_function(f1,vars,ModelingToolkit.simplified_expr,Val{false})
return f2
end
Now, try grad([x,y,z],[x,y,z]) after declaring x, y, z to be variables. The result is not a constant identity matrix function, even though it should be. Rather, it's a vector with 9 entries, a flattened form of what the answer should be. Is there a bug somewhere?
The text was updated successfully, but these errors were encountered: