Why vpasolve fails with piecewise functions?
7 views (last 30 days)
Show older comments
I am trying to solve an equation by vpasolve function but I have observed that the function fails when piecewise function are involved in the computation. Here below the instructions and the solutions.
Please can you help me?
Best regards,
Federica Gioia
%Symbolic variables
syms malphau nalphau alphaf
%Symbolic piecewise functios
malphau=piecewise(0<alphaf<1, 11/10 - alphaf/10)
nalphau=piecewise(0<alphaf<1, -((111*alphaf)/10 - 2537/50)/(12*alphaf + 28))
% Solutions using VAPSOLVE with or without initial point
Pyutot=vpasolve(malphau==nalphau, alphaf)
Pyutot =
Empty sym: 0-by-1
Pyutot=vpasolve(malphau==nalphau, alphaf,0)
Pyutot =
Empty sym: 0-by-1
Pyutot=vpasolve(malphau==nalphau, alphaf,0.5)
Pyutot =
Empty sym: 0-by-1
%So it seams that there are no solutions even if I change the initial point.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Symbolic functions (WITHOUT using piecewise functions)
malphau=11/10 - alphaf/10
nalphau=-((111*alphaf)/10 - 2537/50)/(12*alphaf + 28)
% Solutions using VAPSOLVE
Pyutot=vpasolve(malphau==nalphau, alphaf)
Pyutot =
0.98117409934254853809751846778507
16.935492567324118128569148198882
% There are two solutions!
2 Comments
Walter Roberson
on 7 Feb 2019
Edited: Walter Roberson
on 7 Feb 2019
the second is invalid as it is outside 0 to 1 in a range the piecewise would calculate as nan.
0 is outside the strict inequalities
Answers (0)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!