symbolic integral with symbolic integral limits , how do i code this

hi all, kindly help me to solve above 2 equations . all symbols are constant and subject is r .thanks

 Accepted Answer

syms r A1 A2 R
M1 = int( sqrt(A1+A2*r^2)*r, r, 0, R)
L1 = int( sqrt(A1+A2*r^2)/(1+4*r), r, 0, R)
You will see M1 given as a piecewise output. That is telling you that if you were able to give some constraints on your inputs, you might be able to come out with a simpler output.
In particular, if you are able to confine your symbols to be real-valued,
syms r A1 A2 R real
then you get a useful closed-form solution for M1.
MATLAB cannot find a closed-form solution for L1. (Some other programs I have tried think about it for a long time; I am not sure yet whether they will come out with anything.)

5 Comments

In the second case, because R could be less than -1/4, there is the possibility that you are integrating a term that passes through 1/0
Because A1 or A2 could be negative, A1+A2*r^2 could end up negative, leading to complex-valued solutions.
Because A1, A2, or R could be complex, A1+A2*r^2 could be complex itself
Thank you for your guideline and i got the answer , however i am sorry i couldn't mention that , in the equation L1 , the r is positive .so it won't give complex problem. and A1 and A2 are also positive. now i have a question , how do i put these condition on the code? A1,A2,r > 0 . when i do , i get this ''Warning: Explicit integral could not be found.'' do i have to write a function that uses independent variable as input? Many thanks
syms A1 A2 R positive
syms r
assume(r>=0)
However it will not help: there does not appear to be a symbolic solution for that case.
Mathematica says that the closed form for L is
(1/(32 Sqrt[16 A1+A2]))(-8 Sqrt[A1 (16 A1+A2)]+8 Sqrt[(16 A1+A2) (A1+A2 R^2)]+Sqrt[A2 (16 A1+A2)] Log[A1 A2]+2 (16 A1+A2) Log[4 A1+Sqrt[A1 (16 A1+A2)]]+32 A1 Log[1+4 R]+2 A2 Log[1+4 R]-2 Sqrt[A2 (16 A1+A2)] Log[A2 R+Sqrt[A2 (A1+A2 R^2)]]-32 A1 Log[4 A1-A2 R+Sqrt[(16 A1+A2) (A1+A2 R^2)]]-2 A2 Log[4 A1-A2 R+Sqrt[(16 A1+A2) (A1+A2 R^2)]])

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!