MATLAB: How to find a “symfun” that is inside a integral equation? (knowing the results of this integral equation..)

integral of symfunMATLABsolvesolve symfununknown symfun

I want to find the symfun N(a), whose integral from "b" to "c" is known to be "- b^3/3 – 2*b + c^3/3 + 2*c".
Here is the code I thought it would be a good option:
syms a b c N(a)
integral=int(N(a),a,b,c)
solution=-b^3/3-2*b+c^3/3+2*c %that's the solution of the integral IF N(a) was a^2+2;
solve(integral==solution,N(a))
% I was hoping the answer was N(a)=a^2+2;
Instead of N(a)=a^2+2 – the solution I'm looking for, I get:
Warning: Unable to find explicit solution. For options, see help.
ans =
b: [0×1 sym]
c: [0×1 sym]
Can someone tell what is wrong with this code??
Thanks!!

Best Answer

You will not be able to proceed this way.
However, if you propose a trial polynomial such as
a0 + a1*a + a2*a^2 + a3*a^3
then you can integrate it over b to c. Subtract from that the solution, b^3/3 - 2*b + c^3/3 + 2*c .
Now, you know that all of the terms of the result must be 0, so you can start pulling apart the expression using coeffs() with respect to b or c, and solve() for the parts to all equal 0.
solution = (b^3/3 - 2*b + c^3/3 + 2*c)
proffer = a0 + a1*a + a2*a^2 + a3*a^3;
t = int(proffer,a,b,c) - solution;
[P,Q] = coeffs(t, c)
P(Q==1) = []
sol = solve(P);
resolved = subs(proffer, sol)