Asked by Darcy Chou
on 26 Jun 2018

syms tp t

NN=((exp(-1.45*10^(-4)*tp^1.274))^1.5)/2

z=4/3*pi*NN*(t-tp)^3

Z=int(z,tp,0,t)

output is

Z =

int((2*pi*exp(-(2674777890687885*tp^(637/500))/18446744073709551616)^(3/2)*(t - tp)^3)/3, tp, 0, t)

that is not an analytical solution, then how can I get the analytical solution?

If t=10 ,how to get the numerical solution?

Thanks for reading.

Answer by Ameer Hamza
on 26 Jun 2018

Accepted Answer

The existence of an analytical solution is not always necessary. I cannot prove mathematically but it might be the case that this function does not have an analytical solution at all. It might also be the limitation of MATLAB symbolic engine. In the first case, there is not much you can do other than resorting to the numerical solution. In the second case, you may try some other symbolic math engine. As far as the numerical result is concerned, you can get it as with integral().

syms tp t

NN=((exp(-1.45*10^(-4)*tp^1.274))^1.5)/2;

z=4/3*pi*NN*(t-tp)^3;

Z=int(z,tp,0,t);

Z_function = matlabFunction(z);

Z_numerical = integral(@(tp) Z_function(10, tp), 0, 10);

Darcy Chou
on 26 Jun 2018

Ameer Hamza
on 26 Jun 2018

You are welcome.

Sign in to comment.

Answer by KSSV
on 26 Jun 2018

syms tp t

NN=((exp(-1.45*10^(-4)*tp^1.274))^1.5)/2 ;

z=4/3*pi*NN*(t-tp)^3 ;

Z=int(z,0,t)

subs(Z,'t',10)

KSSV
on 26 Jun 2018

I am considering tp as a constant. I think it is a constant.

Walter Roberson
on 26 Jun 2018

No, the syntax

Z=int(z,tp,0,t)

means integrate z(tp) over tp = 0 to tp = t . tp is not a constant in the integral.

t might be a constant, but tp is not.

Darcy Chou
on 26 Jun 2018

Z=int(z,tp,0,t)

in this syntax, z is the integrand and tp is the variable of integration,

Z is a definite integral whose upper limit is the variable t.

Sign in to comment.

Answer by Walter Roberson
on 26 Jun 2018

You have

NN=((exp(-1.45*10^(-4)*tp^1.274))^1.5)/2

Remember that exp(A*x)^B is the same as exp(A*B*x), so you can bring the 1.5 inside, forming

NN=exp(-1.5*1.45*10^(-4)*tp^1.274)/2

Now introduce a symbolic variable A and rewrite this as

syms tp nonnegative

syms A positive

NN = exp(-A*tp^sym(1.274)) / 2

for A = 1.5*1.45*10^(-4) but leave A as symbolic at the moment.

Then look at

z=4/3*pi*NN*(t-tp)^3

and see that this can be rewritten as

z = B * exp(-A*tp^sym(1.274)) * (t-tp)^3

for B = 4/3*pi/2

Now you want int(z, tp, 0, t)

which is int(B * exp(-A*tp^sym(1.274)) * (t-tp)^3, tp, 0, t)

which is B * int(exp(-A*tp^sym(1.274)) * (t-tp)^3, tp, 0, t)

And it turns out that MATLAB can calculate

temp = int(exp(-A*tp^sym(1.274)) * (t-tp)^3, tp, 0, t)

fairly quickly.

So the overall result is 4/3*pi/2 * subs(temp, A, 1.5*1.45*10^(-4))

Darcy Chou
on 26 Jun 2018

Thank you for your kind answer!

As mentioned above, we can get that Z is a function of t,

and then I want

Y=1-exp(-Z)

y=-diff(Y)

How can I get the min of y(t) and the relative value of t when t > 0 using

fminbnd()

I'm sincerely looking forward to your reply.

Walter Roberson
on 26 Jun 2018

Ameer Hamza
on 26 Jun 2018

int(exp(A*tp^1.274)*(t-tp)^3, tp)

in term of gamma function. Although gamma function is itself defined in term of an integral for most cases.

I cannot find the required definite integral because its calculation requires a pro license. But I guess maple or Mathematica might be able to give a solution for the definite integral. Although I am not sure whether such a solution will be useful for any practical purpose.

Also from @Darcy comment, it appears that the result will later be used in a numerical optimization problem. Since you are eventually using a numerical optimization algorithm, it might be better to also use numerical integration techniques instead of searching for a closed form solution.

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 1 Comment

## Walter Roberson (view profile)

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/407424-how-to-get-an-analytical-solution#comment_582551

Sign in to comment.