0

I work with symbolic toolbox, and here is my code:

syms x h
g=(1-x).*(1-x+h);
int(g,-inf,inf)

and the result is :

ans = piecewise([h in R_, Inf], [0 < sign(Im(h)) and h in R_, Inf + i*Inf], [sign(Im(h)) < 0 and h in R_, Inf - i*Inf])

the answer I calculated was:1/3-0.5*h+1/6*h^3

and I want to get this answer using MATLAB

Are there some way to get it?

horchler
  • 18,384
  • 4
  • 37
  • 73
Heinz
  • 2,415
  • 6
  • 26
  • 34
  • Either your calculation is wrong or you've typed something incorrectly above. That integral does not converge on `[-Inf Inf]`. Mathematica confirms this. You should also tell the `int` function which variable you'd like to integrate with respect to, i.e., `int(g,x,-inf,inf)`. If you know anything about `x` and/or `h` (e.g., > 0, Real, etc.) you should use [`assume`](http://www.mathworks.com/help/symbolic/assume.html) to help the Symbolic Toolbox solve such equations. – horchler Jun 05 '13 at 15:17
  • Try `int(g,x)` - that gives you `x^3/3 + (- h/2 - 1)*x^2 + (h + 1)*x`. And then figure out how that function behaves. – Schorsch Jun 05 '13 at 15:23

0 Answers0