So i'm working on a project to distribute a polymer gradient along a plate, using two separate pumps, and using known values for a [0% to 100%] & [100% to 0%] gradient I was able to create a set of equations in which 'should' be able to relate this for any gradient I want. There are 11 unknowns, and I can make 9 equations, plus 7 inequalities, two of which I would deem necessary, the others just keep the values positive. With the equations created, my known values for the 0 - 100 gradient work as a solution, yet when I try to solve the equations for the same gradient I already have the answer for, no solver I have tried seems to work..
My main program is written in python, and would prefer to keep it in it, but if it can be done in matlab, that would be OK as well..
Here is the matlab code I am using for testing, since I can't get anywhere close using python yet..:
clc
clear all
%% Givens
s1 = 0;
f1 = 1;
s2 = 1;
f2 = 0;
vt = 1200;
%% Unknowns
syms ri1 ri2 c1 c2 k1 k2 vf1 vf2 rf1 rf2 t
%% Equations
soln = vpasolve(...
[ri1 == c1,...
ri2 == c2,...
rf1 == k1 * t + c1,...
rf2 == k2 * t + c2,...
vf1 == ((k1 * t^2) / 2) + c1 * t,...
vf2 == ((k2 * t^2) / 2) + c2 * t,...
ri1 * s2 == ri2 * s1,...
rf1 * f2 == rf2 * f1,...
vt == vf1 + vf2,...
rf1 <= 8,...
rf2 <= 8,...
], [ri1 ri2 c1 c2 k1 k2 vf1 vf2 rf1 rf2 t], [0 8 4/75 150 0 8 8 0 -4/75 600 600])
For that test, I even use the correct solution for the guess, and I still get a null array. If I set a bounds to the vpasolve from [-inf, inf] it says it doesn't match with the variables. It also finishes the attempt to solve near instantly, so it is obviously just hitting NaN right away.
Here is a link to a google doc with formatted equations and the solutions.. Hopefully I have gone into detail enough, if not please let me know what more info you need!
Thanks for any help! -Kyle
P.S - I tried what was posted here without any success..
EDIT: I was able to solve it in mathmatica here.. The additional inequalities I added were to try and remove the first set from the answer, which didn't work, but the second set is the proper solution.
Looks like it might just be beyond matlab and python to solve and I may have to just catalog all the answers that mathmatica finds for it.