Evaluating an integral with symbolic integral limits

8 views (last 30 days)
Hi,
This is my code:
syms s y0
result = int( ((1+s)/(((1+s)^3-(1+y0)^3)/3 - ((1+s)^2-(1+y0)^2)/2)^0.5), s, y0, 1);
r = solve(result == 20^0.5);
I was trying to evaluate the following integral which has a lower integral limit as a symbolic variable y0. I wanted to evaluate the result of the integration (which I am assuming should be an expression in terms of y0 according to my code) by using the 'solve' function in matlab by equating the equation to be equal to 20^0.5 (Hence, giving a value for y0).
This is what i get for the result:
result: int((s + 1)/((s + 1)^3/3 - (s + 1)^2/2 + (y0 + 1)^2/2 - (y0 + 1)^3/3)^(1/2), s == y0..1)
But for the last line of the code, I get this error:
Error using mupadengine/feval (line 157)
MuPAD error: Error: The second argument must be of form x or x = a..b. [int]
Error in solve (line 170)
sol = eng.feval('symobj::solvefull',eqns,vars);
Error in HW3_graph_code (line 7)
r = solve(result == 20^0.5);
Should I use fsolve to solve the relation?
Thank you
Ushnik
  1 Comment
modem sudhakar
modem sudhakar on 3 Apr 2016
Edited: Walter Roberson on 3 Apr 2016
Hi mukherjee,
how you solved this problem. I am facing similar problem as below. Please sugget the way to solve it.
syms x V; Pr=solve( int(x.^2.* exp(-x-1./(x+V)),x,1,inf )-0.5 ==0,V); Warning: Explicit integral could not be found. Error using mupadengine/feval (line 157) MuPAD error: Error: The second argument must be of form x or x = a..b. [int]
Error in solve (line 160) sol = eng.feval('symobj::solvefull',eqns,vars);

Sign in to comment.

Accepted Answer

Roger Stafford
Roger Stafford on 9 Mar 2014
It is not surprising that 'int' was unable to obtain an explicit expression for this integral, which I believe involves incomplete elliptic integrals of the first and/or second kinds. To obtain a numerical solution to your equation, it would be necessary to create a function which can numerically evaluate the difference between your integral and 20^0.5 as a function of y0. Then you can hand the problem to matlab's 'fzero'. Of course you will need to provide an initial estimate for y0, but you can do that by first using the 'plot' function to show roughly where your function crosses zero. Because a complete numerical integration is required for each step in fzero's iterative procedure, your fzero code (and your plot code, too) will tend to be slow.
  11 Comments
Ushnik Mukherjee
Ushnik Mukherjee on 11 Mar 2014
Hi Roger,
I got the error sorted out! Thank you very much for all your help! Just one last question, I tried using your substitution of a new variable, and I also evaluated the integral without the substitution. The solutions are a bit different, why is that?
Regards
Ushnik
modem sudhakar
modem sudhakar on 2 Apr 2016
Edited: Walter Roberson on 2 Apr 2016
Hi mukherjee,
how you solve this problem. I am facing similar problem as below. Please sugget the way to solve this problem.
syms x V; Pr=solve( int(x.^2.* exp(-x-1./(x+V)),x,1,inf )-0.5 ==0,V); Warning: Explicit integral could not be found. Error using mupadengine/feval (line 157) MuPAD error: Error: The second argument must be of form x or x = a..b. [int]
Error in solve (line 160) sol = eng.feval('symobj::solvefull',eqns,vars);

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!