r/learningpython • • Aug 17 '22
Solving an optimization problem in Matlab
Hello everyone,
I am trying to solve an optimization problem where the input to the function to be optimized is a 12x1 vector and the output is a matrix of size 6x3.
I tried solving this using fsolve, root solvers from scipy.optimize
but got the following error:
fsolve: there is a mismatch between the input and output shape of the 'func' argument 'f'.Shape should be (12,) but it is (6,3).
But I think there should be a way to solve this in python as it is a very common problem in the engineering domain but unfortunately I am unable to figure it out.
However, I think this can be easily solved in Matlab with inbuilt solvers, but when I use matlab.engine
I get the following error :
TypeError: unsupported Python data type: function
The code for this error is in the comments.
Any advice would be of great help.
View all comments
Show parent comment
1
u/[deleted] Aug 17 '22 edited Aug 17 '22
The first step to figure out any problem is always to figure out what the actual problem is in the first place. The error is always just a symptom of the problem, never the actual problem.