Re: question
- To: mathgroup at smc.vnet.net
- Subject: [mg132531] Re: question
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Tue, 8 Apr 2014 03:38:25 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140405054854.566716A57@smc.vnet.net>
This does not succeed in evaluating your result; however, may be of use in the future. Generally you should use NumericQ rather than NumberQ to restrict arguments for numerical operations. Unlike NumericQ, NumberQ evaluates to False for symbolic numbers (i.e., not explicit numbers), for example, NumericQ/@{3.14159,2.71828,1.61803,Pi,E,GoldenRatio} {True,True,True,True,True,True} NumberQ/@{3.14159,2.71828,1.61803,Pi,E,GoldenRatio} {True,True,True,False,False,False} Your integrals have significant convergence problems. Catastrophic loss of precision causes one or more of them to return unevaluated and tau not to be defined. Even with greater working precision, none of the methods for NIntegrate converge. In general, to help maintain precision, use exact numbers whenever possible (use Rationalize if necessary or more convenient) and Simplify expressions prior to substituting numerical values. Clear[beta1,beta2,q1,q2,a,b,c,F1,F2,factor1,factor2,g,y] workingPrecision=30; meth="GaussKronrodRule"; r1=1; r2=2; beta2[t_]={r1*Cos[2*Pi*t],r2*Sin[2*Pi*t]}; beta1[t_]=beta2[t+48/10*t^2*(t-1)^2]; q2[t_]=beta2'[t]/Sqrt[Norm[beta2'[t]]]// Simplify[#,Element[t,Reals]]&; q1[s_]=Assuming[{Element[s,Reals]}, beta1'[s]/Sqrt[Norm[beta1'[s]]]// FunctionExpand//Simplify]; a[t_,z_]=2*q1[t].q2'[z]//Simplify; b[t_,z_]=q1[t].q2[z]//Simplify; c[t_,z_]=2*q1'[t].q2[z]//Simplify; F1[t_,z_]=c[t,z]/b[t,z]//Simplify; F2[t_,z_]=a[t,z]/b[t,z]//Simplify; factor1[s_?NumericQ,z_?NumericQ]:= Exp[-NIntegrate[F2[s,u],{u,0,z}, WorkingPrecision->workingPrecision, Method->meth]] factor2[s_?NumericQ,z_?NumericQ]:= Exp[NIntegrate[F2[s,u],{u,0,z}, WorkingPrecision->workingPrecision, Method->meth]] g[s_?NumericQ,z_?NumericQ]:= NIntegrate[factor2[s,tau]*F1[s,tau],{tau,0,z}, WorkingPrecision->workingPrecision, Method->meth] y[s_?NumericQ,z_?NumericQ]:= factor1[s,z]*g[s,z] y[2/10,3/10] NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in u near {u} = {0.175779977684480217211152986508}. NIntegrate obtained 84.5079246037040969376387922437`30. and 84.8861114104337942809878854747`30. for the integral and error estimates. >> NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in tau near {tau} = {0.237889352684480217211152986508}. NIntegrate obtained -1.54198247933449999324805867741*10^36 and 1.54024583236196812134238868827`30.*^36 for the integral and error estimates. >> -0.3067284829323721017658899422 Bob Hanlon On Sat, Apr 5, 2014 at 1:48 AM, Hagwood, Charles R <charles.hagwood at nist.gov > 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 > > >
- References:
- question
- From: "Hagwood, Charles R" <charles.hagwood@nist.gov>
- question