Re: To Wolfram Mathgroup. Help me..
- To: mathgroup at smc.vnet.net
- Subject: [mg121031] Re: To Wolfram Mathgroup. Help me..
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Wed, 24 Aug 2011 03:14:11 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201108230948.FAA02706@smc.vnet.net>
On 08/23/2011 04:48 AM, Jiwan Kim wrote: > Hello, mathgroup. > > I send you this mail to ask your help in fixing the error. > I have a minor error message in the following code. > I have got a error message "No more memory available.Mathematica kernel has > shut down." whenever I wanted to get ReflNorm[t] by integrating > f[z]*Eta[z,t]. > This is not a complex code. This is strange. > If I use 'NIntegrate' instead of 'Integrate', it seems working well. > But, there appears another error message like following. > > "NIntegrate::inumr: "The integrand 0.0247936\ \[ExponentialE]^<<1>>\ \ > Sign[<<1>>]\ (6.5\ Cos[1.08875-0.0389557\ z]-1.3\ Sin[1.08875-<<21>>\ \ > z]) has evaluated to non-numerical values for all sampling points in \ > the region with boundaries {{0,200}}."" > > Could you help me to fix these errors ? > Thank you in advance. > > Best regards, > Jiwan. > > Remove["Global`*"]; > \[Rho] := 8910;(* mass density : kg/m^3 *) > v := 4080;(* sound velocity : nm/ns *) > \[Beta] := 1.3 10^-5;(* linear expansion : /K *) > B := 1.8 10^11; (* bulk modulus : Pa *) > c := 3 10^8; (* light speed : nm/ns *) > \[Lambda] := 800; \[Omega] := > 2 \[Pi] c/\[Lambda]; (* light wavelength : nm *) > Cl := 3.96 10^6; (* lattice heat cap. : J/m^3K = 26.1 J/mol.K *) > g := 4.4 10^17; (* coupling constant : W/m^3.K *) > K := 91; (* thermal conductivity : W/m.K *) > Q1 := 0.2199; (* (g/K)^(1/2) : /nm *) > \[Xi]1 := 13.5; (* pump absorption depth: nm *) > \[Xi]2 := 14.5; (* probe absorption depth: nm *) > Dl := 2.3 10^-5; (* diffusivity : m^2/s *) > n := 2.48; k := 4.38 ;(* reflectivity index at 800 nm *) > A1 := 1.3; A2 := 6.5; (* dn/d\[Eta], dk/d\[Eta] *) > R := 0.3; (* reflection at interface *) > \[Eta]0 := 1; > > f0 = 8 (2 \[Pi])/\[Lambda] (n^2 (n^2 + k^2 - 1)^2 + > k^2 (n^2 + k^2 + 1)^2)^(1/2)/((n + 1)^2 + k^2)^2; > \[Phi] = ArcTan[(k (n^2 + k^2 + 1))/(n (n^2 + k^2 - 1))]; > f[z_] := f0 (A1 Sin[(4 \[Pi] n z)/\[Lambda] - \[Phi]] + > A2 Cos[(4 \[Pi] n z)/\[Lambda] - \[Phi]]) Exp[-z/\[Xi]2]; > \[Eta][z_, > t_] := \[Eta]0 \[Xi]1 Q1 Sign[v t - z] Exp[-Q1 Abs[z - v t]]; > ReflNorm[t_] = Integrate[f[z]*\[Eta][z, t], {z, 0, Infinity}] > Plot[ReflNorm[t], {t, -0.02, 0.05}, PlotRange -> All] After rationalizing the input I get, for the integrand, ii = (2199*Sqrt[3384539269/8693]*E^((-2*z)/29 - (2199*Abs[-4080*t + z])/10000)*Pi* Sign[4080*t - z]*((13*Cos[(31*Pi*z)/2500 - ArcTan[4806101/2514596]])/2 + (13*Sin[(31*Pi*z)/2500 - ArcTan[4806101/2514596]])/10))/173860000; This is readily integrated. I add the assumption that t is real valued; not sure if it was needed but it might have helped. Integrate[ii, {z, 0, Infinity}, Assumptions -> Element[t, Reals]] Here is the result, in Mathematica 8.0.1. Piecewise[{{(-829023*E^((112149*t)/125)*Pi*(650639220709 + 95456183196*Pi))/ (1511364980*(7017580441 + 12931216*Pi^2)), t <= 0}}, (829023*Pi*(-2385725143074414992669*Sqrt[29421799865417] + 669871444168762469436*Sqrt[29421799865417]*Pi - 4396148701265192144*Sqrt[29421799865417]*Pi^2 + 1234364523443046336*Sqrt[29421799865417]*Pi^3 + 21576420682706574245779400000*E^((2232321*t)/3625)* Cos[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] - 945169355455791661078227224*E^((2232321*t)/3625)*Pi* Cos[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] - 76091929833695631414400000*E^((2232321*t)/3625)*Pi^2* Cos[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] - 2736265796819694905661824*E^((2232321*t)/3625)*Pi^3* Cos[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] + 4315284136541314849155880000*E^((2232321*t)/3625)* Sin[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] + 4725846777278958305391136120*E^((2232321*t)/3625)*Pi* Sin[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] - 15218385966739126282880000*E^((2232321*t)/3625)*Pi^2* Sin[(6324*Pi*t)/125 - ArcTan[4806101/2514596]] + 13681328984098474528309120*E^((2232321*t)/3625)*Pi^3* Sin[(6324*Pi*t)/125 - ArcTan[4806101/2514596]]))/ (1511364980*Sqrt[29421799865417]*E^((112149*t)/125)* (1915900441 + 12931216*Pi^2)*(7017580441 + 12931216*Pi^2))] It plots without much fuss. As for your use of NIntegrate (which I think is generally a good idea for such problems), the issue is that it is attempting some evaluations, due to Plot, prior to t being given values. Could try instead: ReflNorm2[t_?NumericQ] := NIntegrate[f[z]*\[Eta][z, t], {z, 0, Infinity}] Plot[ReflNorm2[t], {t, -0.02, 0.05}, PlotRange -> All] This plot takes longer than the one from using Integrate, but that does not count the considerable time needed to do the exact symbolic integration. Also keep in mind that this would work without rationalizing the input, whereas I am not so sure Integrate would handle that (I did not try it). Daniel Lichtblau Wolfram Research
- References:
- To Wolfram Mathgroup. Help me..
- From: Jiwan Kim <hwoarang.kim@gmail.com>
- To Wolfram Mathgroup. Help me..