Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newspeer1.nac.net!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Sseziwa Mukasa Newsgroups: comp.soft-sys.math.mathematica Subject: Re: question Date: Tue, 8 Apr 2014 07:35:51 +0000 (UTC) Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <20140405054854.566716A57@smc.vnet.net> Lines: 93 Organization: Time-Warner Telecom NNTP-Posting-Date: 08 Apr 2014 07:41:46 GMT NNTP-Posting-Host: 22c934a7.news.twtelecom.net X-Trace: DXC=io=NSOUakYXIQ@m7RATcWVC_A=>8kQj6];[h;PUXBgbTj4eD5l`OG?_EFiONJ7[GoV44bQ6BW`5MT X-Complaints-To: abuse@twtelecom.net Xref: csiph.com comp.soft-sys.math.mathematica:16744 NIntegrate evaluates its arguments symbolically before it does numerical evaluation. So the problem is F1 and factor2 are being evaluated symbolically when g is evaluated and it's that you want to suppress not the evaluation of g with non-numeric arguments. That said there are other issues with evaluating your expressions numerically: (Debug) In[1]:= r1=1; r2=2; beta2[t_]:={r1*Cos[2*Pi*t],r2*Sin[2*Pi*t]} beta1[t_]:=beta2[t+4.8*t^2*(t-1)^2] = q2[t_]:=FunctionExpand[beta2'[t]/Sqrt[Norm[beta2'[t]]],Assumptions->t\[Element]Reals&&beta2'\[Element]Vectors[2,Reals]] = q1[s_]:=FunctionExpand[beta1'[s]/Sqrt[Norm[beta1'[s]]],Assumptions->s\[Element]Reals&&beta2'\[Element]Vectors[2,Reals]] a[t_,z_]:=2*q1[t].q2'[z]//FunctionExpand b[t_,z_]:=q1[t].q2[z]//FunctionExpand c[t_,z_]:=2*q1'[t].q2[z]//FunctionExpand F1[t_,z_?NumericQ]:=c[t,z]/b[t,z] F2[t_,z_]:=a[t,z]/b[t,z] factor1[s_,z_]:=Exp[-NIntegrate[F2[s,u],{u,0,z}]] factor2[s_,z_?NumericQ]:=Exp[NIntegrate[F2[s,u],{u,0,z}]] g[s_,z_]:=NIntegrate[factor2[s,tau]*F1[s,tau],{tau,0,z}] y[s_,z_]:=factor1[s,z]*g[s,z] y[.2,.3] (Debug) During evaluation of In[1]:= NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >> (Debug) During evaluation of In[1]:= NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in u near {u} = {0.175777}. NIntegrate obtained -2.75436 and 6.834469819790337` for the integral and error estimates. >> (Debug) During evaluation of In[1]:= NIntegrate::errprec: Catastrophic loss of precision in the global error estimate due to insufficient WorkingPrecision or divergent integral. >> (Debug) Out[16]= 15.7109 NIntegrate[factor2[0.2,tau] F1[0.2,tau],{tau,0,0.3}] You may want to plot your function and choose different regions of integration. On Apr 5, 2014, at 1:48 AM, Hagwood, Charles R wrote: > > I am so sick of Mathematica. It no longer seems to be a package to do applied work, but more for the university types. I have spent several hours using several combinations > of ?NumberQ in the following code, but still I get an error. Last weekend I spend several hours using FunctionExpand to get results I can read. > > Any help appreciated. > > > > r1=1; > r2=2; > beta2[t_]:={r1*Cos[2*Pi*t],r2*Sin[2*Pi*t]} > > beta1[t_]:=beta2[t+4.8*t^2*(t-1)^2] > > q2[t_]:= > = FunctionExpand[beta2'[t]/Sqrt[Norm[beta2'[t]]],Assumptions->t\[Element] Reals && beta2'\[Element]Vectors[2,Reals]] > > q1[s_]:=FunctionExpand[ > beta1'[s]/Sqrt[Norm[beta1'[s]]],Assumptions->s\[Element] Reals&& beta2'\[Element]Vectors[2,Reals]] > > > a[t_, z_] := 2*q1[t].q2'[z] // FunctionExpand > b[t_, z_] := q1[t].q2[z] // FunctionExpand > c[t_, z_] := 2*q1'[t].q2[z] // FunctionExpand > > > F1[t_, z_] := c[t, z]/b[t, z] > F2[t_, z_] := a[t, z]/b[t, z] > > > > factor1[s_, z_] := Exp[-NIntegrate[F2[s, u], {u, 0, z}]] > > factor2[s_, z_] := Exp[NIntegrate[F2[s, u], {u, 0, z}]] > > g[s_, z_?NumberQ] := NIntegrate[factor2[s, tau]*F1[s, tau], {tau, 0, z}] > > y[s_, z_] := factor1[s, z]*g[s, z] > > y[.2, .3] > > > I get the error > > NIntegrate::nlim: _u_ = _tau_ is not a valid limit of integration > >