WilburC

20 Reputation

One Badge

8 years, 277 days

MaplePrimes Activity


These are questions asked by WilburC

I have a problem integrating a solution from fsolve.   I read in another post on this forum that the solution was to use unapply.   This works if I then set up the integration as suggested (i.e., without giving the argument to the function), but not if you do it in a way that seems logical to me (i.e.,the first version of the int command marked ‘fails’ below.   if you can plot a function why can’t you integrate it ?).  

Anyway the real problem I have is if I want to use the solution found using fsolve as the argument of another function (h below) and then integrate that.  I assume the final line fails because of the same reason the initial attempt to integrate g(x) fails. However, I can’t figure out what the equivalent notation would be if I wanted to omit the ‘x’ variable.   I tried using unapply again, and also putting in quotes, but nothing works.

> restart;

> g:=unapply('fsolve(a*y^2-sin(y),y=2)',a);

> plot('g(x)',x=1..2);

> evalf(Int('g(x)',x=1..2));#this fails

> evalf(Int(g,1..2));#this works fine

> h:=x->x*sin(x);

> h(g(1.0));

> h(g(2.0));

> evalf(Int(h(g(x)),x=1..2));# this fails

Page 1 of 1