[Anfang] [Hauptseite] [Suchen] [LDFM]
I tried the following :
> f:=t->Int(g(t),t); > ResMaple1:=f(t)-f(0); > ResMaple2:=f(t)-eval(f(t),t=0);
I wanted :
> ResWanted:=Int(g(u),u=0..t);
I also tried int instead of Int...
In fact the Int is no entered by hand but by dsolve ! The value at 0 comes when I try to remove _C1...
Nobukazu Shimeno (9.2.99)
You can make a definite integral from an indefinite integral easily, because the derivative of an indefinite integral is its integrand. I hope the following will fit for your purpose.
> de := diff(y(x), x)=g(x); > dsolve(de, y(x)); > f := unapply(rhs(%), x); > Int(diff(f(x), x), x=0..t);
Helmut Kahovec (10.2.99)
If I correctly understand what you want then I'd solve your problem as shown below. Note the fundamental difference between an antiderivative and a definite integral, and remember that some functions are basically defined by definite integrals (like the Error function, for example).
> restart;
If you either start with
> J:=Int(g(t),t);
/
|
J := | g(t) dt
|
/
or with
> G:=unapply(J,t);
/
|
G := t -> | g(t) dt
|
/
then you may define
> ConvertToDefInt:=proc(J,u::name,J0::algebraic) > if type(J,`+`) or type(J,`*`) > then map(procname,J,u,J0) > elif type(J,`^`) and type(op(2,J),posint) > then procname(J/op(1,J),u,J0)*procname(op(1,J),u,J0) > elif type(J,Int(algebraic,name)) > then J0+Int(subs(op(2,J)=u,op(1,J)),u=0..op(2,J)) > elif not(hasfun(J,Int)) > then J > else 'procname'(args) > fi > end:
and get
> ResWanted:=ConvertToDefInt(a*J^2+b*G(t)+c,u,G0);
/ t \2 / t \
| / | | / |
| | | | | |
ResWanted := a |G0 + | g(u) du| + b |G0 + | g(u) du| + c
| | | | | |
| / | | / |
\ 0 / \ 0 /
G0 is the value of the result you want at t=0. It should be known and can be zero.
Douglas B. Meade (22.2.99)
As previous respondents have mentioned, your fundamental problem is to confuse definite and indefinite integrals. The best way I can show the problem with your definition is as follows:
> restart;
> f := t->Int(g(t),t);
/
|
f := t -> | g(t) dt
|
/
> f(0);
/
|
| g(0) d0
|
/
Notice how the integration "variable" is now 0 -- this is going to cause problems.
I believe the following is a much simpler and more intuitive solution to your problem.
> F := t->Int(g(s),s=0..t);
t
/
|
F := t -> | g(s) ds
|
/
0
> F(t)-F(0);
t 0
/ /
| |
| g(s) ds - | g(s) ds
| |
/ /
0 0
> combine( % );
t
/
|
| g(s) ds
|
/
0
> F(t)-F(r);
t r
/ /
| |
| g(s) ds - | g(s) ds
| |
/ /
0 0
> value( % );
t r
/ /
| |
| g(s) ds - | g(s) ds
| |
/ /
0 0
> combine( % );
t
/
|
| g(s) ds
|
/
r
Note that my choice to use t=0 as an endpoint of the integration interval could be replaced with, say, t=a without changing the way Maple treats this problem.
[Anfang] [Hauptseite] [Suchen] [LDFM]