Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Re: out of memory problem' topicStudent Support Forum > General > "Re: out of memory problem"

Help | Reply To Topic
Author Comment/Response
Forum Moderator
email me
03/27/97 09:08am

Reply to message #252 from Chuang Iyuan: > MathID:6134-53297-22059
> License:L2764-8010 > Hi, > I tried to solve some questions. However
> the student version gave me out of memory message after around one
hour. > I did these questions on professional > version 2.2.3 on school
computer lab, and got the results in just few minitues. Is this the
limit of student version? > > The questions are as follow: > sigma[x_,T_]=(a+c(T-x))Exp[-k(T-x)]+b
> h1=Integrate[sigma[v,T]*Integrate[sigma[v,s],{s,t,T}],{v,0,t}] >
H1[t_,T_,a_,b_,c_,k_]=Integrate[h1,{T,t,T}] > > Iyuan Chuang Without
more information on the systems involved, I can not say much about
the differences in the results that you report. It may well be that
the speed and memory differences of the two machines would be sufficient
to explain the difference in performance. Unless you are using a pre
V2.2.4 student version, your student version is functionally identical
to the professional version within releases. That having been said
there is something that you can do to speed up your calculation. First
if your functions are reasonably will behaved, e.g. no singularities,
you can replace the definite integrals with indefinite integrals and
evaluate the results at the limits of integration. Careful definite
integration also requires checking for singularities in the range
of integration, and taking limits at the endpoints, rather than just
substituting the endpoints into the indefinite integral. This takes
much more time. Here is your example with some rudimentary changes
in that direction. First I evaluate the function definition for sigma.
In[35]:= sigma[x_,T_]=(a+c(T-x))Exp[-k(T-x)]+b Out[35]= \!\(b + E\^\(\(-k\)\
\((T - x)\)\)\ \((a + c\ \((T - x)\))\)\) Now I look at your next
step and break it up, evaluating the inner integal first as an indefinite
integral. h1=Integrate[sigma[v,T]*Integrate[sigma[v,s],{s,t,T}],{v,0,t}]
In[36]:= InnerInt = Integrate[sigma[v,s],s] Out[36]= \!\(b\ s + E\^\(\(-k\)\
s\)\ \(( \(-\(\(c\ E\^\(k\ v\)\ s\)\/k\)\) + \(E\^\(k\ v\)\ \((\(-c\)
- a\ k + c\ k\ v)\)\)\/k\^2)\)\) Now I evaluate this at the limits
of the original definite integration. In[37]:= DefInnerInt= (InnerInt
/. s -> T) - (InnerInt /.s->t) Out[37]= \!\(\(-b\)\ t + b\ T - E\^\(\(-k\)\
t\)\ \(( \(-\(\(c\ E\^\(k\ v\)\ t\)\/k\)\) + \(E\^\(k\ v\)\ \((\(-c\)
- a\ k + c\ k\ v)\)\)\/k\^2)\) + E\^\(\(-k\)\ T\)\ \(( \(-\(\(c\ E\^\(k\
v\)\ T\)\/k\)\) + \(E\^\(k\ v\)\ \((\(-c\) - a\ k + c\ k\ v)\)\)\/k\^2)\)\)
Now I evaluate the outer integral as an indefinite integral. This
time I suppress the output for space considerations. In[38]:= OuterInt
= Integrate[sigma[v,T]*InnerInt,v]; Again the limits are put in. In[39]:=
DefOuterInt =( OuterInt/. v->t) - (OuterInt /. v -> 0); This is your
h1. The process goes on with the replacement of your expression H1[t_,T_,a_,b_,c_,k_]=Integrate[h1,{T,t,T}]
with the following In[40]:= LastInt = Integrate[DefOuterInt,T]; In[41]:=
H1[t_,T_,a_,b_,c_,k_]=(LastInt/. T->T) - (LastInt /. T->t); In[42]:=
H1[6,1,1,1,1,3]//N Out[42]= \!\(1.21486611562424196`*^12\) Forum Moderator


URL: ,
Help | Reply To Topic