equivalent assume() in R2011 version
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
hi,
what is the equivalent of assume() function, to define some condition for resolving a systeme of equation?
Antworten (1)
Walter Roberson
am 19 Mai 2015
evalin(symengine, 'assume(TheCondition)')
or
feval(symengine, 'assume', TheCondition)
4 Kommentare
Walter Roberson
am 19 Mai 2015
Try
s = symengine
evalin(s, 'Pi')
and show the result
studentU
am 19 Mai 2015
Bearbeitet: Walter Roberson
am 19 Mai 2015
Walter Roberson
am 19 Mai 2015
syms G F X2 X3 el a b x y
evalin(symengine, 'assume(-PI < a and a < Pi and -PI/2 < b and b < PI/2');
[a, b] = solve(G*cos(y)+F*sin(y) - 1, cos(y)*sin(el)-sin(y)*X2*cos(x)-sin(y)*X3*sin(x) - 1, a, b);
You should still expect poor results, as you are trying to solve for the value of two variables, a and b, that do not appear in the equations.
If you were to change the x and y to a and b, a solution is possible. However, the solution would be in terms of the F, G, el, X2, X3 variables, and unless you put assumptions on those variables (especially on F and G) it is not possible to figure out where the values would end up.
Supposing that you are trying to solve for x and y instead of a and b, then there are four solutions under the assumptions of real values. The code to generate them is:
t1 = (G ^ 2);
t2 = (F ^ 2);
t5 = sqrt((t1 * (t2 + t1 - 1)));
t6 = F + t5;
t8 = sin(el);
t9 = t8 ^ 2;
t12 = 2 * t9 * t5 * F;
t16 = ((t2 + 1) * t1 + t2 - 1) * t9;
t17 = X2 ^ 2;
t18 = X3 ^ 2;
t19 = (t17 + t18);
t20 = G - 1;
t21 = t20 ^ 2;
t23 = G + 1;
t24 = t23 ^ 2;
t25 = t19 * t21 * t24;
t29 = sqrt(-(-t12 + t16 - t25) * t18 * t1);
t30 = X2 * t6 * t29;
t31 = t18 * t8;
t32 = t20 * t23;
t33 = F * t5;
t34 = t33 - t1;
t36 = t31 * t32 * t34;
t38 = 1 / t19;
t40 = 1 / t6;
t43 = 1 / G;
t46 = 1 / (t1 - 1);
t47 = 1 / X3 * t43 * t46;
t51 = F * t1 * X2 * t8;
t53 = t8 * t5 * X2;
t56 = t43 * t46;
t59 = 1 / (t2 + t1);
t71 = F - t5;
t76 = sqrt(-t18 * (t12 + t16 - t25) * t1);
t77 = X2 * t71 * t76;
t78 = t33 + t1;
t80 = t31 * t32 * t78;
t83 = 1 / t71;
x1 = atan2((-t30 - t36) * t38 * t40 * t47, (-t51 + t53 + t29) * t38 * t56);
x2 = atan2((t30 - t36) * t38 * t40 * t47, (-t51 + t53 - t29) * t38 * t56);
x3 = atan2((-t77 + t80) * t38 * t83 * t47, (-t51 - t53 + t76) * t38 * t56);
x4 = atan2((t77 + t80) * t38 * t83 * t47, (-t51 - t53 - t76) * t38 * t56);
y1 = atan2(t6 * t59, -t34 * t59 * t43);
y2 = y1;
y3 = atan2(t71 * t59, t78 * t59 * t43);
y4 = y3;
Here the solution pairs are [x1,y1], [x2,y2], [x3,y3], [x4,y4]
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!