A123 === Subject: Re: imagesize to full width of current screen > greetings, > i'm trying to determine the current width of the notebook screen to > size graphics and manipulate's to fit the whole width of the window. = > > i've looked at PageWidth, ImageSize->All, ImageSize->Full, ImageSize- > >Large, ImageSize->Scaled[s] (ImageSize->Scaled@1 is equivalent to = > > ImageSize->Full), $* variables, ... > this is a common feature in other programming languages (javascript in = > > web browsers for example). i've also searched this mailing list > without success. any ideas? > Mitch >> the information is in the WindowSize option of the corresponding >> notebook object. This will give you the size of the notebook that >> evaluates it: >> >> WindowSize /. Options[EvaluationNotebook[]] >> >> when working with manipulates and palettes you also might want to use >> ButtonNotebook[] , SelectedNotebook[] and Notebooks[] to get a handle at >> the notebook you are after. >> >> Just in case: You can also get the size of the screen with: >> >> ScreenRectangle /. Options[$FrontEnd] >> >> which then lets you choose a reasonable size for a new notebook/window. > ScreenRectangle does not appear in the $FrontEnd options in Mathematica 6.0, > but it is mentioned in the Help file as a function not yet fully > integrated (in 6.0). > Is there any other way to call it? in another post there was mentioned: FullScreenArea /. SystemInformation[Devices, ScreenInformation] SystemInformation is new in version 6 and it is not clear to me how fully integrated this is and whether it could be changed in newer versions, but it might be a better choice. Note that ScreenRectangle is an option for $FrontEnd since at least version 4.2, so it has quite a history in being not yet fully integrated :-) hth, albert === Subject: Re: imagesize to full width of current screen magma, Try Options[$FrontEnd, ScreenRectangle] or (from Mathematica 6 on) CurrentValue[$FrontEnd, ScreenRectangle] === Subject: Re: Real and Complex Roots presented in a single plot We can also recognize and see the real parts of all = the complex roots of z where the curve is nearest to x -axis at {1.4, 4.2, 6.6, 9.6, 12.3, 15.3, 17.7}. They are near to x-values where the local maxima/minima occur.But we cannot 'see' their complex parts, as they need to be computed. > > Please note that your claim that the real part of the complex roots is > found at the local minima of the given function as the indipendent > variable moves on the real axis, is not valid in general and wrong in > this particular instance. > > For example in the interval {1,2} there are 2 local extrema found > using the derivative: > > f[z_] := 1.3 Sin[1.7 z] + 0.6 Sin[4 z] > > The derivative: > > In[43]:= fp[z_] := D[f[z], z] > > In[44]:= fp[z] > > Out[44]= 2.21 Cos[1.7 z] + 2.4 Cos[4 z] > > In[73]:= extrema = z /. FindRoot[fp[z], {z, #}] & /@ {1.4, 1.6} > > Out[73]= {1.33751, 1.69029} > > The first is the local minimum (see the plot). > But the complex roots in interval {1,2} are > > 1.27946 + 0.374308 I and 1.27946 - 0.374308 I > > The real part is 1.27946, while the minimum was at 1.33751 (I do not have Presentations). My point is that 1.33751 is sufficiently near to and corresponding to the root place holder 1.27946 so that succesive tangents drawn in complex Newton-Raphson procedure the roots would not settle anywhere else. Narasimham > This can be visualized on the complex plane using Presentations: > > f[z_] := 1.3 Sin[1.7 z] + 0.6 Sin[4 z] > > Needs[Presentations`Master`] > > fp[z_] := D[f[z], z] > > extrema = z /. FindRoot[fp[z], {z, #}] & /@ {1.4, 1.6} > > roots = z /. > FindRoot[ > f[z], {z, ToComplex@#}] & /@ {{-0.005546, -0.02102}, {1.28= 5, > 0.3771}, {1.279, -0.3678}, {2.081, > 0.01109}, {3.462, -0.008173}, {4.194, -0.3485}, {4.213, > 0.345}} // Chop; > > In the following plot we see the roots (blu) and the extrema (red) in > the interval {1,2} > > With[{zmin = -.5 - I, zmax = 5 + I, > contourlist = {0, 0.1, 0.2, .5, .505, .5095, .51, .53, 0.55, 0.57, > 0.6, .61, .62, .6205, 1}}, > Draw2D[{ComplexCartesianContour[f[z], {z, zmin, zmax}, Abs, > Contours -> contourlist, ColorFunctionScaling -> False, > ColorFunction -> (ContourColors[contourlist, > ColorData[SolarColors]][#] &), PlotPoints -> {30, 15= }, > MaxRecursion -> 3, PlotRange -> {0, 11}], > ComplexCirclePoint[#, 3, Black, Blue] & /@ roots, > ComplexCirclePoint[#, 3, Black, Red] & /@ extrema, > ComplexLine[{-5, 5}]}, AspectRatio -> Automatic, > PlotRange -> {{1, 2}, {-.7, .7}}, Frame -> True, > FrameLabel -> {Re, Im}, RotateLabel -> False, > PlotLabel -> Row[{Modulus of , f[z]}], ImageSize -> 900, > Background -> Legacy@Linen]] === Subject: Re: weird NMaximize behaviour Hi Andrzej, We do not know what method is chosen by the default Method->Automatic, but it seems to me that some up hill method is invoked. Starting at some point x0>1, the algorithm will then go towards larger x until reaching the border of the region. To fix this, we need to choose a method that does not simply go uphill but tries to find a global maximum, e.g. SimulatedAnnealing or DifferentialEvolution. E.g. SimulatedAnnealing gives: {9.,{x->-2.,y->0.999067}} Daniel > I have just encountered strange behaviour by NMaximize (which has been > ruining a demonstration I have been working on): > > This is fine: > > NMaximize[{(x - 1)^2, -2 <= x <= 2}, {x}] > {9., {x -> -2.}} > > but this definitely is not: > > NMaximize[{(x - 1)^2, -2 <= x <= 2 && -1 <= y <= 1}, {x, y}] > {1., {x -> 2., y -> 0.87904}} > > The objective function s independent of y, yet NMaximize seems to go > off on some wild goose chase and ends up with a very poor maximum. > > This does not happen here: > > NMaximize[{(x - 2)^2, -2 <= x <= 2}, {x}] > {16., {x -> -2.}} > > NMaximize[{(x - 2)^2, -2 <= x <= 2 && -1 <= y <= 1}, {x, y}] > {16., {x -> -2., y -> -0.980305}} > > Kind of weird. > > Andrzej Kozlowski > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Re: weird NMaximize behaviour Try to pick a method such as DifferentialEvolution NMaximize[{(x - 1)^2, -2 <= x <= 2 && -1 <= y <= 1}, {x, y}, Method -> DifferentialEvolution] {9., {x -> -2., y -> 1.}} I believe the default condition uses NelderMead and that apparently provides the wrong result. The RandomSearch takes a while. SimulatedAnnealing converges to the right answer as well. === Subject: Re: Variable names in Mathematica NO, they are NOT reserved. Example (converted to InputForm, which I'd never use when actually entering Greek letters [Alpha]=2; [Alpha]+10 12 Perhaps you're confusing some Greek letters with similarly-shaped symbols, such as the Element symbol or the Sum symbol. > > I can't seem to get an answer to this simple question: are greek letters > allowed as variable names in Mathematica? I have tried this with limited > success (v 5.2). It seems that some greek letters are reserved, for example === Subject: Re: Variable names in Mathematica > > I can't seem to get an answer to this simple question: are greek letter= s allowed as variable names in Mathematica? I have tried this with limite= d success (v 5.2). It seems that some greek letters are reserved, for example > for variable names you can use all latin, greek, script and gothic > letters. Exceptions are the one letter functions or constants: > C, D, E, I, K, N, O and $, which are protected. > > K isn't protected, but lives in the System` context and is used > internally e.g. as summation variable. It will not be cleared with > Clear[Global`*]. > > Gruss Peter > -- > ==-==-==-==-==-==-==-==-==-==-== =-==-==-==-==-==-==-==-==-==-==-= == > Peter Breitfeld, Bad Saulgau, Germany --http://www.pBreitfeld.de .....and of course greek Pi is protected too. === Subject: Re: blurry ellipse > NB: This is a mathematical problem, not necessarily a Mathematica problem= . > > I need a rasterized, blurry ellipse, i.e. an ellipse convolved with a > Gaussian. I already know how to make a blurry circle. You take the Fourie= r > transform of a circle (i.e. a Bessel function), the Fourier transform of = a > Guassian, multiply them, and transform them back. No problem. Since an > ellipse is just a circle that has been squashed in one dimension, I figur= ed > I could make a blurry one the same way as I make blurry circles. I just > needed to squash the Bessel function first. And I was right. The code bel= ow > works just fine, *except* the intensity varies as you go around the elips= e. > If anyone could tell me how to fix that problem, I'd be very grateful! > > BlurryEllipse[sizePix_, radiusPix_, sigmaPix_,stretchFactors_: {1, 1}] := = > > Module[{half = sizePix/2, x, y, f, r, a, pr2}, > > f = 2*Pi*radiusPix/sizePix; > pr2 = -2 (Pi*sigmaPix/sizePix)^2; > > RotateRight[ > > Abs[ > Chop[ > > InverseFourier[ > > RotateRight[ > > Table[r1= > A= bs[stretchFactors[[1]]*x+ > = stretchFactors[[2]]*I*y]; > r2 == Abs[x + I*y]; > Bessel= J[0, f*r1] Exp[pr2 (r2^2)], > {y, -half= , half-1} , {x, -half, half-1}], > {half, half}]]]],= {half,half}]] > > size = 64; rad = 24; scale = 3; > tmp = BlurryEllipse[size, rad, scale, {1, .5}]; > Show[Graphics[Raster[tmp/Max[Max[tmp]]]], ImageSize -> 400] > > Intensity varies around the elipse. We can compare amplitude (or power) > ratios between major and minor axes: > > In[]:=Max[tmp[[33]]]/Max[Transpose[tmp][[33]]] > > Out[]=1.93009 > > In[]:= Sqrt[Total[tmp[[33]]^2]/Total[Transpose[tmp][[33]]^2]] > > Out[]= 1.98887 > > I was surprised these numbers weren't closer to 2. How can we make intens= ity > invariant around the ellipse? Good day, Using Exp[pr2 (r1^2)] as kernel instead of Exp[pr2 (r2^2)] seems to work better. V.Astanoff === Subject: Re: blurry ellipse Hi Joshua, you can blurry any picture by a convolution with a suitable kernel. Here is an example. We first create a picture of an ellips. Then we increasingly blurry it three times. Note that we must keep the numbers between 0..1 because of Raster: n=100; pict=Table[0,{n},{n}]; Scan[(pict[[Round[n/2+n/5 Sin[#]],Round[n/2+2 n/5Cos[#]]]]=1)&,Range[0,2Pi,0.01]]; Graphics[Raster[pict]] kernel={{1,1},{1,1}}; pict=ListConvolve[kernel,pict];pict=pict/Max[pict]; Graphics[Raster[pict]] kernel={{1,1,1},{1,1,1},{1,1,1}}; pict=ListConvolve[kernel,pict];pict=pict/Max[pict]; Graphics[Raster[pict]] kernel={{1,1,1,1},{1,1,1,1},{1,1,1,1},{1,1,1,1}}; pict=ListConvolve[kernel,pict];pict=pict/Max[pict]; Graphics[Raster[pict]] Note that you may instead of using a larger kernel, repeat the operation. hope this helps, Daniel > NB: This is a mathematical problem, not necessarily a Mathematica problem. > > I need a rasterized, blurry ellipse, i.e. an ellipse convolved with a > Gaussian. I already know how to make a blurry circle. You take the Fourier > transform of a circle (i.e. a Bessel function), the Fourier transform of a > Guassian, multiply them, and transform them back. No problem. Since an > ellipse is just a circle that has been squashed in one dimension, I figured > I could make a blurry one the same way as I make blurry circles. I just > needed to squash the Bessel function first. And I was right. The code below > works just fine, *except* the intensity varies as you go around the elipse. > If anyone could tell me how to fix that problem, I'd be very grateful! > > BlurryEllipse[sizePix_, radiusPix_, sigmaPix_,stretchFactors_: {1, 1}] := > > Module[{half = sizePix/2, x, y, f, r, a, pr2}, > > f = 2*Pi*radiusPix/sizePix; > pr2 = -2 (Pi*sigmaPix/sizePix)^2; > > RotateRight[ > > Abs[ > Chop[ > > InverseFourier[ > > RotateRight[ > > Table[r1= > Abs[stretchFactors[[1]]*x+ > stretchFactors[[2]]*I*y]; > r2 = Abs[x + I*y]; > BesselJ[0, f*r1] Exp[pr2 (r2^2)], > {y, -half, half-1} , {x, -half, half-1}], > {half, half}]]]], {half,half}]] > > size = 64; rad = 24; scale = 3; > tmp = BlurryEllipse[size, rad, scale, {1, .5}]; > Show[Graphics[Raster[tmp/Max[Max[tmp]]]], ImageSize -> 400] > > Intensity varies around the elipse. We can compare amplitude (or power) > ratios between major and minor axes: > > In[]:=Max[tmp[[33]]]/Max[Transpose[tmp][[33]]] > > > Out[]=1.93009 > > > In[]:= Sqrt[Total[tmp[[33]]^2]/Total[Transpose[tmp][[33]]^2]] > > Out[]= 1.98887 > > > > I was surprised these numbers weren't closer to 2. How can we make intensity > invariant around the ellipse? > > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: WorldPlot and crosshatching countries This shouldn't be difficult but after having spent some time on it, I haven't made any headway. I am trying to illustrate two variables on a world map. The first is illustrated using color. The second, a binary variable, by a thick, black border. Instead of using the thick, black border, I'd like to use vertical, diagonal, or horizontal cross hatching. Below is some simple code which illustrates the process using the thick, black border. How do I use cross hatching? I am using version 6. Best, Daniel << WorldPlot` border = {Black, Thickness[.01]}; country1 = {USA, China, Nigeria}; country2 = {China}; color1 = {Blue, Red, Yellow}; color2 = {Hue[3, 1, 1, .01]}; map1 = WorldPlot[{country1, color1}, WorldToGraphics -> True, WorldGridBehind -> True, WorldBackground -> White, WorldGrid -> None, ImageSize -> {500}] map2 = WorldPlot[{country2, color2}, WorldToGraphics -> True, WorldBorders -> border, WorldGrid -> None, ImageSize -> {500}] finalmap = Show[{map1, map2}] -- boydkramer@gmail.com === Subject: Debracketing array symbols For a class project I generate 1D and 2D arrays of arbitrary size with entries [i] and [i,j] that I need then to convert to i and ij for export to other languages that do not allow brackets in symbol names. E.g. 1D: {A[1],A[2],A[3],A[4]} -> {A1,A2,A3,A4} 2D: {{W[1,1],W[1,2]},{W[2,1],W[2,2]}} -> {{W11,W12},{W21,W22}} Question: would this be the simplest way to do it? DebracketArrayEntries[Wm_]:=Module[{dim,rep,i,j,n,m,s,Wr}, rep={[->,]->,,->, ->}; Wr=Wm; dim=Length[Dimensions[Wm]]; If [dim==1,n=Length[Wm]; Print[n=,n]; For [i=1,i<=n,i++, s=ToString[Wm[[i]]]; Wr=Wr/.Wm[[i]]->Symbol[StringReplace[s,rep]] ]]; If [dim==2,{n,m}=Dimensions[Wm]; For [i=1,i<=n,i++, For[j=1,j<=m,j++, s=ToString[Wm[[i,j]]]; Wr=Wr/.Wm[[i,j]]->Symbol[StringReplace[s,rep]] ]]]; Return[Wr]]; The procedural style is to simplify conversion to C++. === Subject: Re: Debracketing array symbols Hi carlos, you could e.g. try: {A[1],A[2],A[3],A[4]}/.x_[y_]:>Symbol[ToString[x]<>ToString[y]] hope this helps, Daniel > > For a class project I generate 1D and 2D arrays of arbitrary size with > entries [i] and [i,j] that I need then to convert > to i and ij for export to other languages that do not > allow brackets in symbol names. E.g. > > 1D: {A[1],A[2],A[3],A[4]} -> {A1,A2,A3,A4} > > 2D: {{W[1,1],W[1,2]},{W[2,1],W[2,2]}} -> {{W11,W12},{W21,W22}} > > Question: would this be the simplest way to do it? > > DebracketArrayEntries[Wm_]:=Module[{dim,rep,i,j,n,m,s,Wr}, > rep={[->,]->,,->, ->}; Wr=Wm; > dim=Length[Dimensions[Wm]]; > If [dim==1,n=Length[Wm]; Print[n=,n]; > For [i=1,i<=n,i++, s=ToString[Wm[[i]]]; > Wr=Wr/.Wm[[i]]->Symbol[StringReplace[s,rep]] ]]; > If [dim==2,{n,m}=Dimensions[Wm]; > For [i=1,i<=n,i++, For[j=1,j<=m,j++, s=ToString[Wm[[i,j]]]; > Wr=Wr/.Wm[[i,j]]->Symbol[StringReplace[s,rep]] ]]]; > Return[Wr]]; > > The procedural style is to simplify conversion to C++. > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Re: Apparent error integrating product of DiracDelta's Hmmm. I appreciate (mostly) the niceties of this argument, but what about the practical matter that as an intermediate step in some problem I may want to have some DiracDelta's floating around prior to a final integration? Michael > > How do I get: Integrate[DiracDelta[z- x] DiracDelta[z- y], {z-Infinity, Infinit= y}= ] to give DiracDelta[x-y] as the result? Currently it gives 0. I = ha= ve all three variable assumed to be Reals. I am using 6.0.0. Michael Mandelberg > I think you have synatx error in the limit part. I assume you mean to = wri= te > {z, -Infinity,Infinity} > > Given that, I think zero is the correct answer. When you multiply 2= de= ltas > at different positions, you get zero. Integral of zero is zero. > > Nasser > No Nasser, the correct value of the integral should be DiracDelta[x- y], as Michael said. This value is indeed 0 if x != y but it is not 0 if x==y. > > It is not 0 at x==y, but neither is it DiracDelta[x-y]. The value the= re > is undefined. > Mathematica correctly calculates: > Integrate[f[z - x] DiracDelta[z - y], {z, -Infinity, Infinity}, Assumptions -> y [Element] Reals] > as > f[-x + y] > > This is making a tacit assumption that f is a nice function. Nice, in > this context, means it is an element of Schwartz space S: C^infinity and > vanishing faster than any polynomial at +-infinity. DiracDelta, suffice > it to say, is not an element of S (it's not even a function). > However it fails to recognize that if f[z-x] is replaced by DiracDelta[z-x], the result should be > DiracDelta[-x + y] > or the equivalent > DiracDelta[x - y] > > This is not a failure but rather an active intervention. > In the help file, under possible issues it is mentioned that Products of distributions with coinciding singular support cannot be defined: > > This is a statement of mathematics and not specific to Mathematica. > So perhaps at the moment the only way to do the integral is: > Integrate[f[z - x] DiracDelta[z - y], {z, -Infinity, Infinity}, Assumptions -> y [Element] Reals] /. f -> DiracDelta > hth > > Here is a general rule of thumb. If you are working with DiracDelta > function(al)s, instead approximate them as ordinary functions. If > different methods of approximation will lead to different results, then > what you have cannot be defined. One can use this notion to see that, > for example, DiracDelta[x]^2 is not defined. > > Daniel Lichtblau > Wolfram Research- Hide quoted text - > > - Show quoted text - === Subject: Re: Apparent error integrating product of DiracDelta's > > How do I get: Integrate[DiracDelta[z- x] DiracDelta[z- y], {z-Infinity, Infinit= y}= ] to give DiracDelta[x-y] as the result? Currently it gives 0. I = ha= ve all three variable assumed to be Reals. I am using 6.0.0. Michael Mandelberg > I think you have synatx error in the limit part. I assume you mean to = wri= te > {z, -Infinity,Infinity} > > Given that, I think zero is the correct answer. When you multiply 2= de= ltas > at different positions, you get zero. Integral of zero is zero. > > Nasser > No Nasser, the correct value of the integral should be DiracDelta[x- y], as Michael said. This value is indeed 0 if x != y but it is not 0 if x==y. > > It is not 0 at x==y, but neither is it DiracDelta[x-y]. The value the= re > is undefined. > Mathematica correctly calculates: > Integrate[f[z - x] DiracDelta[z - y], {z, -Infinity, Infinity}, Assumptions -> y [Element] Reals] > as > f[-x + y] > > This is making a tacit assumption that f is a nice function. Nice, in > this context, means it is an element of Schwartz space S: C^infinity and > vanishing faster than any polynomial at +-infinity. DiracDelta, suffice > it to say, is not an element of S (it's not even a function). > However it fails to recognize that if f[z-x] is replaced by DiracDelta[z-x], the result should be > DiracDelta[-x + y] > or the equivalent > DiracDelta[x - y] > > This is not a failure but rather an active intervention. > In the help file, under possible issues it is mentioned that Products of distributions with coinciding singular support cannot be defined: > > This is a statement of mathematics and not specific to Mathematica. > So perhaps at the moment the only way to do the integral is: > Integrate[f[z - x] DiracDelta[z - y], {z, -Infinity, Infinity}, Assumptions -> y [Element] Reals] /. f -> DiracDelta > hth > > Here is a general rule of thumb. If you are working with DiracDelta > function(al)s, instead approximate them as ordinary functions. If > different methods of approximation will lead to different results, then > what you have cannot be defined. One can use this notion to see that, > for example, DiracDelta[x]^2 is not defined. > > Daniel Lichtblau > Wolfram Research Very interesting answer! Yet, taking a naive (physicist's ?) point of view, the result seems intuitively correct. Mr. Delta himself (P.A.M. Dirac) in his The principles of quantum mechanics published in 1930 confirms the result (eq. 15.9 in the Italian 4th edition). He even proves it, a little bit later. The proof is a bit heuristics because he assumes the integral is defined in the first place. Yet the whole Delta function story was at the time just heuristics. Apparently the delta was described for the first time in this book (Wikipedia). I am also pretty sure he uses the result somewhere else later in the book (probably where double integrals appear). So, could he have been so wrong after having been so right before? More to the point: I found very intriguing your claim that If different methods of approximation will lead to different results, then what you have cannot be defined. I agree with you of course, but could you show with Mathematica - maybe with a Manipulate program - that this is the case with this integral? Could you find 2 different approximation methods which give 2 different results? I look forward to seeing it. Concerning DiracDelta[x]^2, I would agree it is undefined at least because its integral, if it existed, would be DeltaDirac[0], which is undefined. === Subject: Working modulo 2 Howdy, How does one reduce a polynomial's coefficients modulo 2? For example, I have a function that sums several polynomials, and currently produces a result like this: 7 + x + 4 y + 4 x y + 3 z + 2 x z + 4 y z + 4 x y z I want to reduce this to 1 + x + z I thought I might be able to do this by somehow coercing the terms into a list and then doing Sum[L[[i]],{i,1,Length[L]},Modulus->2], but no such luck. Any ideas? Bob H === Subject: the graphic of a function i think i've asked this before. anyway, i am new in mathematica and i want how can I create the graphic of an exact function the same as I do for Sin[]. for example f(x)=x^2/(x+1)^2 can anyone help? === Subject: Re: Functional programming? > To a novice in these matters like myself it looks to me as if:1. Debugging > FP code could be very challenging > 2. Although FP looks very concise and fast, there a lot going on that's not > immediately apparent and its not clear [ to me ] how to get full hand-on on > that code. > I know these comments will seem naive to the many experts out there, but its > just my observation. > > Peter > > I don't think this comment is naive at all - code in a style that seems clear to you, but bear in mind that if you expect performance to be an issue, the innermost loops should use FP if at all possible. Often the only way to unpick really complex expressions, is to select successively larger pieces (using Ctrl-. ) copy them somewhere, and see how they evaluate. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Functional programming? > > To me, using Mathematica without learning functional programing > is somewhat analogous to driving a sports car without learning > to use the higher gears. You can get from point A to point B in > a sports car using only first gear but clearly that isn't > efficient use of the sports car. Similarly, you can solve > problems with Mathematica using procedural programing but that > isn't efficient use of Mathematica. > This is true, but Stephen Wolfram did include all the procedural constructs as well, and I think he did this for a reason. There are certain messy real-world bits of data processing that are easier to code in procedural style. My point is simply that we should not condemn procedural programming to the point where users give up on problems that they could otherwise have solved using (say) While[...]. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Functional programming? (RPN -v- Algebraic) > > Debating which is better (functional programing or procedural > programing) is analogous to debates of early calculators > comparing HP's RPN style to TI's algebraic style. Either could > get the task done. And it was possible to find example problems > that were more efficiently done by one than by the other. Actually, this question was answered many years ago, and RPN required significantly less work to solve non-toy programs. How was this determined? By comparing the number of keystrokes needed to solve various standard programs, like interest-rate calculations in the financial world. People just counted the keystrokes in the programs provided in the respective users manuals, on the assumption that each such program was written by experts working for the respective manufacturers, and so would be as close to optimal as humanly possible, making the comparison both fair and informative. The bottom line was that it took RPN about two thirds the keystrokes that algebraic took for the same problem. This certainly is my personal experience as well. Joe Gwinn === Subject: Re: Functional programming? >David Bailey says: >>I think you have chosen a rather favourable example here. Suppose >>instead that you need to remove every zero together with the >>preceding element (sweeping from left to right). >A quick and dirty fp answer is (safer code would check that leading >elements were not already zero) >In[1]:= v = {1, 2, 0, 3, 4, 0}; >v1 = MapAt[0 &, v, Position[v, 0] - 1]; >v2 = Select[v1, # != 0 &] > >Out[1]= {1, 3} Even more concise In[15]:= v //. {{a___, _, 0, b___} -> {a, b},{0, b___} -> {b}} Out[15]= {1,3} But perhaps pattern matching isn't considered part of functional programing === Subject: NDSolve and Piecewise Folks, I am having some trouble with getting Piecewise and NDSolve to play nicely together. My problem is to find a solution to the heat flow equation with an arbitrary time-varying upper boundary condition and a Neumann-type lower boundary (steady head flow condition). My code looks like this: NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[t, 0] == Piecewise[{{t/10, 0 <= t < 5}, {(10 - t)/10, 5 <= t < 10}}], u[0, x] == x/5, (D[u[t, x], x] /. x -> 5) == 1/5}, u, {t, 0, 10}, {x, 0, 5}] This returns and NDSolve::ndum error on my system, which past experience tells me is usually me leaving some symbolic value hanging around somewhere it ought not to be. I can't see any such problem this time. I'm pretty sure that I have written similar code in the past (using Piecewise and NDSolve, though it was some time ago and I can't locate the file now) and had it work, and it works if you replace Piecewise with another functional form (like Sin[t]). Am I missing something? Marshall === Subject: Column/Row/Grid bars FrontEnd String formatting in new cells? The last example (#3) in the following sequence puzzles me: EX. 1: CellPrint@hellonworld (* new cell *) hello world EX. 2: CellPrint@List@hellonworld (* new cell *) hello world EX. 3: CellPrint@Column@List@hellonworld (* new cell *) hellonworld In this last case, it appears that 'Column' prevents formatting of the string by the FrontEnd. Could someone offer a better explanation? Is there a way around this, that would produce formatted output identical to the first two examples? Vince Virgilio === Subject: Re: ListContourPlot3D, no output > Indeed,I should explain better what is happening. The table I have is a r= elative large data collection and I am not sure about how to post this here= . > Concerning your examples of code, I would guess all of it should work, si= nce I could run all the examples that are given on the help page of ListCon= toutPlot3D. > In the end, I tried this: I took my table of the form Basbsselect={{x,y= ,z,f}, ...} (again, a regular array with equally spaced x, y, and z values,= and which contains nx x ny x nz values) and made an array using: Babsarray = > Array[Babsselect[[1 + (#1 - 1)*naz*nay + (#2 - 1)*naz + ( #3 - 1), > 4]] &, {nax, nay, naz}]; Then I can plot this using ListContourPlot3D. So this sort of solves my p= roblem. > But I would still be interested to post the original code, it is unfortun= ately a rather big table and I do not know if that is possible. Adi Why don't you just post a little bit of your table? not the whole bunch. Just a subset. Does ListContoutPlot3D work with a subset of your table? === Subject: Re: How to find the best fit for a list {x,y} of data Hi Mathematica gives you the best result given the fitting expression: (1 - k x) (1 - (k x)/q) (1 - (k p x)/q) === Subject: Problem in PL spectrum analysis I now have troubles in the PL(photoluminescence) spectrum analysis. Integration of the PL spectrum is the aim, however these data are dispersed ones. I don't know how to make it by Mathematica. yours gyzhou Below are the useful data. 10099.38062 -0.00000 10097.45215 0.00002 10095.52368 0.00005 10093.59521 0.00009 10091.66675 0.00012 10089.73828 0.00013 10087.80981 0.00014 10085.88135 0.00013 10083.95288 0.00012 10082.02441 0.00011 10080.09595 0.00009 10078.16748 0.00009 10076.23901 0.00009 10074.31055 0.00009 10072.38208 0.00010 10070.45361 0.00011 10068.52515 0.00011 10066.59668 0.00012 10064.66821 0.00013 10062.73975 0.00013 10060.81128 0.00012 10058.88281 0.00011 10056.95435 0.00011 10055.02588 0.00011 10053.09741 0.00011 10051.16895 0.00012 10049.24048 0.00013 10047.31201 0.00013 10045.38354 0.00013 10043.45508 0.00014 10041.52661 0.00015 10039.59814 0.00017 10037.66968 0.00018 10035.74121 0.00020 10033.81274 0.00020 10031.88428 0.00021 10029.95581 0.00021 10028.02734 0.00020 10026.09888 0.00020 10024.17041 0.00019 10022.24194 0.00018 10020.31348 0.00018 10018.38501 0.00018 10016.45654 0.00018 10014.52808 0.00019 10012.59961 0.00019 10010.67114 0.00020 10008.74268 0.00020 10006.81421 0.00022 10004.88574 0.00024 10002.95728 0.00025 10001.02881 0.00027 9999.10034 0.00027 9997.17188 0.00028 9995.24341 0.00028 9993.31494 0.00029 9991.38647 0.00029 9989.45801 0.00029 9987.52954 0.00029 9985.60107 0.00029 9983.67261 0.00029 9981.74414 0.00029 9979.81567 0.00030 9977.88721 0.00031 9975.95874 0.00031 9974.03027 0.00030 9972.10181 0.00029 9970.17334 0.00028 9968.24487 0.00028 9966.31641 0.00029 9964.38794 0.00031 9962.45947 0.00033 9960.53101 0.00034 9958.60254 0.00035 9956.67407 0.00035 9954.74561 0.00035 9952.81714 0.00036 9950.88867 0.00036 9948.96021 0.00037 9947.03174 0.00037 9945.10327 0.00038 9943.17480 0.00039 9941.24634 0.00040 9939.31787 0.00041 9937.38940 0.00041 9935.46094 0.00040 9933.53247 0.00040 9931.60400 0.00040 9929.67554 0.00040 9927.74707 0.00042 9925.81860 0.00043 9923.89014 0.00044 9921.96167 0.00044 9920.03320 0.00046 9918.10474 0.00047 9916.17627 0.00049 9914.24780 0.00050 9912.31934 0.00050 9910.39087 0.00050 9908.46240 0.00050 9906.53394 0.00050 9904.60547 0.00050 9902.67700 0.00051 9900.74854 0.00053 9898.82007 0.00055 9896.89160 0.00058 9894.96313 0.00059 9893.03467 0.00060 9891.10620 0.00061 9889.17773 0.00062 9887.24927 0.00063 9885.32080 0.00064 9883.39233 0.00066 9881.46387 0.00067 9879.53540 0.00069 9877.60693 0.00070 9875.67847 0.00071 9873.75000 0.00072 9871.82153 0.00072 9869.89307 0.00072 9867.96460 0.00072 9866.03613 0.00073 9864.10767 0.00074 9862.17920 0.00075 9860.25073 0.00076 9858.32227 0.00076 9856.39380 0.00077 9854.46533 0.00078 9852.53687 0.00080 9850.60840 0.00081 9848.67993 0.00082 9846.75146 0.00083 9844.82300 0.00084 9842.89453 0.00086 9840.96606 0.00089 9839.03760 0.00092 9837.10913 0.00094 9835.18066 0.00096 9833.25220 0.00098 9831.32373 0.00099 9829.39526 0.00101 9827.46680 0.00104 9825.53833 0.00106 9823.60986 0.00108 9821.68140 0.00109 9819.75293 0.00109 9817.82446 0.00108 9815.89600 0.00107 9813.96753 0.00107 9812.03906 0.00108 9810.11060 0.00110 9808.18213 0.00112 9806.25366 0.00115 9804.32520 0.00118 9802.39673 0.00121 9800.46826 0.00124 9798.53979 0.00126 9796.61133 0.00127 9794.68286 0.00127 9792.75439 0.00127 9790.82593 0.00127 9788.89746 0.00128 9786.96899 0.00130 9785.04053 0.00134 9783.11206 0.00138 9781.18359 0.00142 9779.25513 0.00145 9777.32666 0.00147 9775.39819 0.00147 9773.46973 0.00147 9771.54126 0.00147 9769.61279 0.00149 9767.68433 0.00151 9765.75586 0.00153 9763.82739 0.00155 9761.89893 0.00157 9759.97046 0.00159 9758.04199 0.00160 9756.11353 0.00161 9754.18506 0.00163 9752.25659 0.00166 9750.32813 0.00169 9748.39966 0.00173 9746.47119 0.00177 9744.54272 0.00180 9742.61426 0.00183 9740.68579 0.00185 9738.75732 0.00187 9736.82886 0.00188 9734.90039 0.00189 9732.97192 0.00190 9731.04346 0.00192 9729.11499 0.00195 9727.18652 0.00198 9725.25806 0.00203 9723.32959 0.00207 9721.40112 0.00210 9719.47266 0.00212 9717.54419 0.00214 9715.61572 0.00215 9713.68726 0.00216 9711.75879 0.00217 9709.83032 0.00220 9707.90186 0.00223 9705.97339 0.00227 9704.04492 0.00230 9702.11646 0.00233 9700.18799 0.00235 9698.25952 0.00237 9696.33105 0.00240 9694.40259 0.00243 9692.47412 0.00247 9690.54565 0.00250 9688.61719 0.00252 9686.68872 0.00255 9684.76025 0.00257 9682.83179 0.00259 9680.90332 0.00260 9678.97485 0.00262 9677.04639 0.00263 9675.11792 0.00266 9673.18945 0.00268 9671.26099 0.00272 9669.33252 0.00276 9667.40405 0.00280 9665.47559 0.00283 9663.54712 0.00287 9661.61865 0.00290 9659.69019 0.00294 9657.76172 0.00297 9655.83325 0.00301 9653.90479 0.00304 9651.97632 0.00307 9650.04785 0.00310 9648.11938 0.00313 9646.19092 0.00316 9644.26245 0.00318 9642.33398 0.00321 9640.40552 0.00324 9638.47705 0.00327 9636.54858 0.00330 9634.62012 0.00334 9632.69165 0.00337 9630.76318 0.00340 9628.83472 0.00343 9626.90625 0.00345 9624.97778 0.00348 9623.04932 0.00351 9621.12085 0.00355 9619.19238 0.00360 9617.26392 0.00366 9615.33545 0.00372 9613.40698 0.00377 9611.47852 0.00382 9609.55005 0.00387 9607.62158 0.00391 9605.69312 0.00395 9603.76465 0.00398 9601.83618 0.00400 9599.90771 0.00401 9597.97925 0.00402 9596.05078 0.00405 9594.12231 0.00409 9592.19385 0.00415 9590.26538 0.00420 9588.33691 0.00425 9586.40845 0.00429 9584.47998 0.00433 9582.55151 0.00436 9580.62305 0.00439 9578.69458 0.00442 9576.76611 0.00445 9574.83765 0.00449 9572.90918 0.00453 9570.98071 0.00458 9569.05225 0.00462 9567.12378 0.00467 9565.19531 0.00470 9563.26685 0.00474 9561.33838 0.00478 9559.40991 0.00483 9557.48145 0.00488 9555.55298 0.00493 9553.62451 0.00498 9551.69604 0.00501 9549.76758 0.00504 9547.83911 0.00507 9545.91064 0.00510 9543.98218 0.00515 9542.05371 0.00520 9540.12524 0.00525 9538.19678 0.00531 9536.26831 0.00536 9534.33984 0.00540 9532.41138 0.00545 9530.48291 0.00550 9528.55444 0.00555 9526.62598 0.00561 9524.69751 0.00567 9522.76904 0.00572 9520.84058 0.00577 9518.91211 0.00582 9516.98364 0.00585 9515.05518 0.00589 9513.12671 0.00593 9511.19824 0.00597 9509.26978 0.00602 9507.34131 0.00607 9505.41284 0.00612 9503.48438 0.00617 9501.55591 0.00622 9499.62744 0.00626 9497.69897 0.00630 9495.77051 0.00634 9493.84204 0.00639 9491.91357 0.00645 9489.98511 0.00651 9488.05664 0.00657 9486.12817 0.00664 9484.19971 0.00669 9482.27124 0.00674 9480.34277 0.00679 9478.41431 0.00684 9476.48584 0.00690 9474.55737 0.00696 9472.62891 0.00701 9470.70044 0.00707 9468.77197 0.00712 9466.84351 0.00717 9464.91504 0.00721 9462.98657 0.00725 9461.05811 0.00730 9459.12964 0.00736 9457.20117 0.00743 9455.27271 0.00750 9453.34424 0.00756 9451.41577 0.00761 9449.48730 0.00766 9447.55884 0.00772 9445.63037 0.00778 9443.70190 0.00784 9441.77344 0.00791 9439.84497 0.00797 9437.91650 0.00802 9435.98804 0.00807 9434.05957 0.00813 9432.13110 0.00819 9430.20264 0.00825 9428.27417 0.00832 9426.34570 0.00839 9424.41724 0.00846 9422.48877 0.00852 9420.56030 0.00859 9418.63184 0.00865 9416.70337 0.00872 9414.77490 0.00879 9412.84644 0.00885 9410.91797 0.00892 9408.98950 0.00898 9407.06104 0.00904 9405.13257 0.00910 9403.20410 0.00918 9401.27563 0.00926 9399.34717 0.00935 9397.41870 0.00943 9395.49023 0.00950 9393.56177 0.00956 9391.63330 0.00960 9389.70483 0.00965 9387.77637 0.00970 9385.84790 0.00976 9383.91943 0.00983 9381.99097 0.00990 9380.06250 0.00996 9378.13403 0.01002 9376.20557 0.01007 9374.27710 0.01013 9372.34863 0.01020 9370.42017 0.01029 9368.49170 0.01037 9366.56323 0.01046 9364.63477 0.01054 9362.70630 0.01061 9360.77783 0.01068 9358.84937 0.01076 9356.92090 0.01084 9354.99243 0.01092 9353.06396 0.01100 9351.13550 0.01107 9349.20703 0.01113 9347.27856 0.01120 9345.35010 0.01127 9343.42163 0.01135 9341.49316 0.01142 9339.56470 0.01150 9337.63623 0.01157 9335.70776 0.01164 9333.77930 0.01171 9331.85083 0.01178 9329.92236 0.01186 9327.99390 0.01195 9326.06543 0.01205 9324.13696 0.01215 9322.20850 0.01224 9320.28003 0.01232 9318.35156 0.01239 9316.42310 0.01246 9314.49463 0.01253 9312.56616 0.01261 9310.63770 0.01269 9308.70923 0.01278 9306.78076 0.01287 9304.85229 0.01297 9302.92383 0.01305 9300.99536 0.01313 9299.06689 0.01321 9297.13843 0.01328 9295.20996 0.01334 9293.28149 0.01341 9291.35303 0.01347 9289.42456 0.01354 9287.49609 0.01361 9285.56763 0.01370 9283.63916 0.01379 9281.71069 0.01389 9279.78223 0.01399 9277.85376 0.01409 9275.92529 0.01418 9273.99683 0.01427 9272.06836 0.01436 9270.13989 0.01444 9268.21143 0.01451 9266.28296 0.01459 9264.35449 0.01466 9262.42603 0.01474 9260.49756 0.01483 9258.56909 0.01492 9256.64063 0.01502 9254.71216 0.01511 9252.78369 0.01520 9250.85522 0.01529 9248.92676 0.01538 9246.99829 0.01546 9245.06982 0.01554 9243.14136 0.01560 9241.21289 0.01566 9239.28442 0.01572 9237.35596 0.01579 9235.42749 0.01586 9233.49902 0.01595 9231.57056 0.01606 9229.64209 0.01617 9227.71362 0.01627 9225.78516 0.01636 9223.85669 0.01643 9221.92822 0.01650 9219.99976 0.01656 9218.07129 0.01664 9216.14282 0.01672 9214.21436 0.01680 9212.28589 0.01688 9210.35742 0.01696 9208.42896 0.01704 9206.50049 0.01712 9204.57202 0.01720 9202.64355 0.01728 9200.71509 0.01736 9198.78662 0.01743 9196.85815 0.01750 9194.92969 0.01759 9193.00122 0.01768 9191.07275 0.01777 9189.14429 0.01786 9187.21582 0.01794 9185.28735 0.01800 9183.35889 0.01805 9181.43042 0.01811 9179.50195 0.01817 9177.57349 0.01824 9175.64502 0.01831 9173.71655 0.01838 9171.78809 0.01846 9169.85962 0.01854 9167.93115 0.01863 9166.00269 0.01872 9164.07422 0.01881 9162.14575 0.01890 9160.21729 0.01898 9158.28882 0.01907 9156.36035 0.01914 9154.43188 0.01921 9152.50342 0.01928 9150.57495 0.01935 9148.64648 0.01942 9146.71802 0.01949 9144.78955 0.01957 9142.86108 0.01964 9140.93262 0.01971 9139.00415 0.01979 9137.07568 0.01987 9135.14722 0.01994 9133.21875 0.02001 9131.29028 0.02008 9129.36182 0.02014 9127.43335 0.02021 9125.50488 0.02029 9123.57642 0.02037 9121.64795 0.02044 9119.71948 0.02051 9117.79102 0.02059 9115.86255 0.02066 9113.93408 0.02073 9112.00562 0.02081 9110.07715 0.02090 9108.14868 0.02098 9106.22021 0.02107 9104.29175 0.02115 9102.36328 0.02121 9100.43481 0.02127 9098.50635 0.02132 9096.57788 0.02136 9094.64941 0.02142 9092.72095 0.02147 9090.79248 0.02153 9088.86401 0.02160 9086.93555 0.02168 9085.00708 0.02175 9083.07861 0.02183 9081.15015 0.02191 9079.22168 0.02198 9077.29321 0.02205 9075.36475 0.02212 9073.43628 0.02219 9071.50781 0.02226 9069.57935 0.02233 9067.65088 0.02240 9065.72241 0.02247 9063.79395 0.02253 9061.86548 0.02260 9059.93701 0.02267 9058.00854 0.02275 9056.08008 0.02282 9054.15161 0.02289 9052.22314 0.02295 9050.29468 0.02301 9048.36621 0.02307 9046.43774 0.02313 9044.50928 0.02320 9042.58081 0.02327 9040.65234 0.02335 9038.72388 0.02342 9036.79541 0.02350 9034.86694 0.02357 9032.93848 0.02363 9031.01001 0.02368 9029.08154 0.02374 9027.15308 0.02381 9025.22461 0.02387 9023.29614 0.02394 9021.36768 0.02401 9019.43921 0.02407 9017.51074 0.02413 9015.58228 0.02419 9013.65381 0.02425 9011.72534 0.02431 9009.79688 0.02438 9007.86841 0.02443 9005.93994 0.02449 9004.01147 0.02454 9002.08301 0.02460 9000.15454 0.02466 8998.22607 0.02473 8996.29761 0.02479 8994.36914 0.02485 8992.44067 0.02491 8990.51221 0.02496 8988.58374 0.02502 8986.65527 0.02507 8984.72681 0.02513 8982.79834 0.02518 8980.86987 0.02523 8978.94141 0.02528 8977.01294 0.02533 8975.08447 0.02538 8973.15601 0.02543 8971.22754 0.02548 8969.29907 0.02554 8967.37061 0.02560 8965.44214 0.02565 8963.51367 0.02571 8961.58521 0.02576 8959.65674 0.02580 8957.72827 0.02583 8955.79980 0.02587 8953.87134 0.02592 8951.94287 0.02597 8950.01440 0.02603 8948.08594 0.02608 8946.15747 0.02612 8944.22900 0.02615 8942.30054 0.02618 8940.37207 0.02622 8938.44360 0.02627 8936.51514 0.02632 8934.58667 0.02636 8932.65820 0.02640 8930.72974 0.02644 8928.80127 0.02647 8926.87280 0.02651 8924.94434 0.02655 8923.01587 0.02660 8921.08740 0.02663 8919.15894 0.02665 8917.23047 0.02667 8915.30200 0.02667 8913.37354 0.02668 8911.44507 0.02669 8909.51660 0.02673 8907.58813 0.02678 8905.65967 0.02684 8903.73120 0.02690 8901.80273 0.02694 8899.87427 0.02698 8897.94580 0.02704 8896.01733 0.02710 8894.08887 0.02716 8892.16040 0.02718 8890.23193 0.02717 8888.30347 0.02713 8886.37500 0.02709 8884.44653 0.02710 8882.51807 0.02714 8880.58960 0.02720 8878.66113 0.02727 8876.73267 0.02731 8874.80420 0.02733 8872.87573 0.02732 8870.94727 0.02728 8869.01880 0.02725 8867.09033 0.02723 8865.16187 0.02724 8863.23340 0.02727 8861.30493 0.02731 8859.37646 0.02734 8857.44800 0.02734 8855.51953 0.02732 8853.59106 0.02729 8851.66260 0.02728 8849.73413 0.02728 8847.80566 0.02730 8845.87720 0.02732 8843.94873 0.02733 8842.02026 0.02732 8840.09180 0.02729 8838.16333 0.02726 8836.23486 0.02723 8834.30640 0.02719 8832.37793 0.02716 8830.44946 0.02711 8828.52100 0.02705 8826.59253 0.02698 8824.66406 0.02690 8822.73560 0.02681 8820.80713 0.02670 8818.87866 0.02657 8816.95020 0.02641 8815.02173 0.02626 8813.09326 0.02616 8811.16479 0.02611 8809.23633 0.02612 8807.30786 0.02614 8805.37939 0.02615 8803.45093 0.02613 8801.52246 0.02609 8799.59399 0.02605 8797.66553 0.02601 8795.73706 0.02596 8793.80859 0.02589 8791.88013 0.02581 8789.95166 0.02571 8788.02319 0.02561 8786.09473 0.02550 8784.16626 0.02540 8782.23779 0.02530 8780.30933 0.02520 8778.38086 0.02510 8776.45239 0.02500 8774.52393 0.02490 8772.59546 0.02478 8770.66699 0.02466 8768.73853 0.02454 8766.81006 0.02441 8764.88159 0.02427 8762.95313 0.02415 8761.02466 0.02403 8759.09619 0.02392 8757.16772 0.02381 8755.23926 0.02369 8753.31079 0.02357 8751.38232 0.02345 8749.45386 0.02331 8747.52539 0.02317 8745.59692 0.02302 8743.66846 0.02286 8741.73999 0.02268 8739.81152 0.02251 8737.88306 0.02235 8735.95459 0.02220 8734.02612 0.02205 8732.09766 0.02189 8730.16919 0.02173 8728.24072 0.02156 8726.31226 0.02138 8724.38379 0.02119 8722.45532 0.02100 8720.52686 0.02082 8718.59839 0.02066 8716.66992 0.02051 8714.74146 0.02036 8712.81299 0.02022 8710.88452 0.02007 8708.95605 0.01990 8707.02759 0.01973 8705.09912 0.01956 8703.17065 0.01939 8701.24219 0.01922 8699.31372 0.01905 8697.38525 0.01888 8695.45679 0.01872 8693.52832 0.01855 8691.59985 0.01838 8689.67139 0.01819 8687.74292 0.01799 8685.81445 0.01777 8683.88599 0.01756 8681.95752 0.01734 8680.02905 0.01713 8678.10059 0.01693 8676.17212 0.01674 8674.24365 0.01657 8672.31519 0.01641 8670.38672 0.01626 8668.45825 0.01610 8666.52979 0.01593 8664.60132 0.01576 8662.67285 0.01557 8660.74438 0.01537 8658.81592 0.01515 8656.88745 0.01494 8654.95898 0.01474 8653.03052 0.01454 8651.10205 0.01435 8649.17358 0.01417 8647.24512 0.01398 8645.31665 0.01379 8643.38818 0.01361 8641.45972 0.01343 8639.53125 0.01326 8637.60278 0.01309 8635.67432 0.01292 8633.74585 0.01274 8631.81738 0.01256 8629.88892 0.01238 8627.96045 0.01219 8626.03198 0.01200 8624.10352 0.01182 8622.17505 0.01163 8620.24658 0.01143 8618.31812 0.01124 8616.38965 0.01105 8614.46118 0.01088 8612.53271 0.01071 8610.60425 0.01055 8608.67578 0.01037 8606.74731 0.01020 8604.81885 0.01002 8602.89038 0.00985 8600.96191 0.00969 8599.03345 0.00954 8597.10498 0.00939 8595.17651 0.00924 8593.24805 0.00908 8591.31958 0.00891 8589.39111 0.00874 8587.46265 0.00856 8585.53418 0.00839 8583.60571 0.00823 8581.67725 0.00806 8579.74878 0.00791 8577.82031 0.00775 8575.89185 0.00761 8573.96338 0.00747 8572.03491 0.00734 8570.10645 0.00721 8568.17798 0.00708 8566.24951 0.00695 8564.32104 0.00680 8562.39258 0.00665 8560.46411 0.00650 8558.53564 0.00635 8556.60718 0.00621 8554.67871 0.00608 8552.75024 0.00595 8550.82178 0.00582 8548.89331 0.00569 8546.96484 0.00555 8545.03638 0.00542 8543.10791 0.00528 8541.17944 0.00516 8539.25098 0.00504 8537.32251 0.00494 8535.39404 0.00483 8533.46558 0.00474 8531.53711 0.00464 8529.60864 0.00453 8527.68018 0.00443 8525.75171 0.00432 8523.82324 0.00421 8521.89478 0.00410 8519.96631 0.00399 8518.03784 0.00389 8516.10938 0.00378 8514.18091 0.00368 8512.25244 0.00359 8510.32397 0.00350 8508.39551 0.00342 8506.46704 0.00334 8504.53857 0.00327 8502.61011 0.00319 8500.68164 0.00311 8498.75317 0.00302 8496.82471 0.00293 8494.89624 0.00285 8492.96777 0.00278 8491.03931 0.00271 8489.11084 0.00264 8487.18237 0.00257 8485.25391 0.00251 8483.32544 0.00245 8481.39697 0.00239 8479.46851 0.00234 8477.54004 0.00228 8475.61157 0.00220 8473.68311 0.00212 8471.75464 0.00203 8469.82617 0.00195 8467.89771 0.00189 8465.96924 0.00184 8464.04077 0.00179 8462.11230 0.00175 8460.18384 0.00171 8458.25537 0.00168 8456.32690 0.00165 8454.39844 0.00161 8452.46997 0.00157 8450.54150 0.00151 8448.61304 0.00144 8446.68457 0.00137 8444.75610 0.00131 8442.82764 0.00126 8440.89917 0.00122 8438.97070 0.00118 8437.04224 0.00115 8435.11377 0.00112 8433.18530 0.00110 8431.25684 0.00107 8429.32837 0.00105 8427.39990 0.00102 8425.47144 0.00099 8423.54297 0.00095 8421.61450 0.00091 8419.68604 0.00088 8417.75757 0.00084 8415.82910 0.00082 8413.90063 0.00080 8411.97217 0.00078 8410.04370 0.00076 8408.11523 0.00073 8406.18677 0.00070 8404.25830 0.00067 8402.32983 0.00064 8400.40137 0.00061 8398.47290 0.00058 8396.54443 0.00056 8394.61597 0.00054 8392.68750 0.00051 8390.75903 0.00048 8388.83057 0.00046 8386.90210 0.00045 8384.97363 0.00046 8383.04517 0.00047 8381.11670 0.00047 8379.18823 0.00045 8377.25977 0.00041 8375.33130 0.00038 8373.40283 0.00034 8371.47437 0.00033 8369.54590 0.00032 8367.61743 0.00032 8365.68896 0.00032 8363.76050 0.00032 8361.83203 0.00032 8359.90356 0.00032 8357.97510 0.00031 8356.04663 0.00029 8354.11816 0.00026 8352.18970 0.00025 8350.26123 0.00024 8348.33276 0.00024 8346.40430 0.00024 8344.47583 0.00024 8342.54736 0.00024 8340.61890 0.00023 8338.69043 0.00022 8336.76196 0.00021 8334.83350 0.00019 8332.90503 0.00017 8330.97656 0.00016 8329.04810 0.00016 8327.11963 0.00016 8325.19116 0.00016 8323.26270 0.00016 8321.33423 0.00015 8319.40576 0.00014 8317.47729 0.00013 8315.54883 0.00013 8313.62036 0.00013 8311.69189 0.00012 8309.76343 0.00011 8307.83496 0.00010 8305.90649 0.00008 8303.97803 0.00007 8302.04956 0.00007 8300.12109 0.00007 8298.19263 0.00006 8296.26416 0.00006 8294.33569 0.00007 8292.40723 0.00008 8290.47876 0.00010 8288.55029 0.00011 8286.62183 0.00010 8284.69336 0.00007 8282.76489 0.00005 8280.83643 0.00003 8278.90796 0.00003 8276.97949 0.00004 8275.05103 0.00006 8273.12256 0.00008 8271.19409 0.00010 8269.26563 0.00010 8267.33716 0.00009 8265.40869 0.00009 8263.48022 0.00008 8261.55176 0.00006 8259.62329 0.00004 8257.69482 0.00003 8255.76636 0.00002 8253.83789 0.00001 8251.90942 0.00002 8249.98096 0.00003 8248.05249 0.00004 8246.12402 0.00004 8244.19556 0.00004 8242.26709 0.00003 8240.33862 0.00002 8238.41016 0.00002 8236.48169 0.00003 8234.55322 0.00005 8232.62476 0.00007 8230.69629 0.00007 8228.76782 0.00006 8226.83936 0.00005 8224.91089 0.00003 8222.98242 0.00002 8221.05396 0.00001 === Subject: Re: Problem in PL spectrum analysis assuming your data is in d: Integrate[Interpolation[d][x],{x,8224.91089`,10099.38062`}] hope this helps, Daniel > I now have troubles in the PL(photoluminescence) spectrum analysis. > Integration of the PL spectrum is the aim, however these data are > dispersed ones. > I don't know how to make it by Mathematica. yours gyzhou Below are the useful data. 10099.38062 -0.00000 > 10097.45215 0.00002 > 10095.52368 0.00005 > 10093.59521 0.00009 > 10091.66675 0.00012 > 10089.73828 0.00013 > 10087.80981 0.00014 > 10085.88135 0.00013 > 10083.95288 0.00012 > 10082.02441 0.00011 > 10080.09595 0.00009 > 10078.16748 0.00009 > 10076.23901 0.00009 > 10074.31055 0.00009 > 10072.38208 0.00010 > 10070.45361 0.00011 > 10068.52515 0.00011 > 10066.59668 0.00012 > 10064.66821 0.00013 > 10062.73975 0.00013 > 10060.81128 0.00012 > 10058.88281 0.00011 > 10056.95435 0.00011 > 10055.02588 0.00011 > 10053.09741 0.00011 > 10051.16895 0.00012 > 10049.24048 0.00013 > 10047.31201 0.00013 > 10045.38354 0.00013 > 10043.45508 0.00014 > 10041.52661 0.00015 > 10039.59814 0.00017 > 10037.66968 0.00018 > 10035.74121 0.00020 > 10033.81274 0.00020 > 10031.88428 0.00021 > 10029.95581 0.00021 > 10028.02734 0.00020 > 10026.09888 0.00020 > 10024.17041 0.00019 > 10022.24194 0.00018 > 10020.31348 0.00018 > 10018.38501 0.00018 > 10016.45654 0.00018 > 10014.52808 0.00019 > 10012.59961 0.00019 > 10010.67114 0.00020 > 10008.74268 0.00020 > 10006.81421 0.00022 > 10004.88574 0.00024 > 10002.95728 0.00025 > 10001.02881 0.00027 > 9999.10034 0.00027 > 9997.17188 0.00028 > 9995.24341 0.00028 > 9993.31494 0.00029 > 9991.38647 0.00029 > 9989.45801 0.00029 > 9987.52954 0.00029 > 9985.60107 0.00029 > 9983.67261 0.00029 > 9981.74414 0.00029 > 9979.81567 0.00030 > 9977.88721 0.00031 > 9975.95874 0.00031 > 9974.03027 0.00030 > 9972.10181 0.00029 > 9970.17334 0.00028 > 9968.24487 0.00028 > 9966.31641 0.00029 > 9964.38794 0.00031 > 9962.45947 0.00033 > 9960.53101 0.00034 > 9958.60254 0.00035 > 9956.67407 0.00035 > 9954.74561 0.00035 > 9952.81714 0.00036 > 9950.88867 0.00036 > 9948.96021 0.00037 > 9947.03174 0.00037 > 9945.10327 0.00038 > 9943.17480 0.00039 > 9941.24634 0.00040 > 9939.31787 0.00041 > 9937.38940 0.00041 > 9935.46094 0.00040 > 9933.53247 0.00040 > 9931.60400 0.00040 > 9929.67554 0.00040 > 9927.74707 0.00042 > 9925.81860 0.00043 > 9923.89014 0.00044 > 9921.96167 0.00044 > 9920.03320 0.00046 > 9918.10474 0.00047 > 9916.17627 0.00049 > 9914.24780 0.00050 > 9912.31934 0.00050 > 9910.39087 0.00050 > 9908.46240 0.00050 > 9906.53394 0.00050 > 9904.60547 0.00050 > 9902.67700 0.00051 > 9900.74854 0.00053 > 9898.82007 0.00055 > 9896.89160 0.00058 > 9894.96313 0.00059 > 9893.03467 0.00060 > 9891.10620 0.00061 > 9889.17773 0.00062 > 9887.24927 0.00063 > 9885.32080 0.00064 > 9883.39233 0.00066 > 9881.46387 0.00067 > 9879.53540 0.00069 > 9877.60693 0.00070 > 9875.67847 0.00071 > 9873.75000 0.00072 > 9871.82153 0.00072 > 9869.89307 0.00072 > 9867.96460 0.00072 > 9866.03613 0.00073 > 9864.10767 0.00074 > 9862.17920 0.00075 > 9860.25073 0.00076 > 9858.32227 0.00076 > 9856.39380 0.00077 > 9854.46533 0.00078 > 9852.53687 0.00080 > 9850.60840 0.00081 > 9848.67993 0.00082 > 9846.75146 0.00083 > 9844.82300 0.00084 > 9842.89453 0.00086 > 9840.96606 0.00089 > 9839.03760 0.00092 > 9837.10913 0.00094 > 9835.18066 0.00096 > 9833.25220 0.00098 > 9831.32373 0.00099 > 9829.39526 0.00101 > 9827.46680 0.00104 > 9825.53833 0.00106 > 9823.60986 0.00108 > 9821.68140 0.00109 > 9819.75293 0.00109 > 9817.82446 0.00108 > 9815.89600 0.00107 > 9813.96753 0.00107 > 9812.03906 0.00108 > 9810.11060 0.00110 > 9808.18213 0.00112 > 9806.25366 0.00115 > 9804.32520 0.00118 > 9802.39673 0.00121 > 9800.46826 0.00124 > 9798.53979 0.00126 > 9796.61133 0.00127 > 9794.68286 0.00127 > 9792.75439 0.00127 > 9790.82593 0.00127 > 9788.89746 0.00128 > 9786.96899 0.00130 > 9785.04053 0.00134 > 9783.11206 0.00138 > 9781.18359 0.00142 > 9779.25513 0.00145 > 9777.32666 0.00147 > 9775.39819 0.00147 > 9773.46973 0.00147 > 9771.54126 0.00147 > 9769.61279 0.00149 > 9767.68433 0.00151 > 9765.75586 0.00153 > 9763.82739 0.00155 > 9761.89893 0.00157 > 9759.97046 0.00159 > 9758.04199 0.00160 > 9756.11353 0.00161 > 9754.18506 0.00163 > 9752.25659 0.00166 > 9750.32813 0.00169 > 9748.39966 0.00173 > 9746.47119 0.00177 > 9744.54272 0.00180 > 9742.61426 0.00183 > 9740.68579 0.00185 > 9738.75732 0.00187 > 9736.82886 0.00188 > 9734.90039 0.00189 > 9732.97192 0.00190 > 9731.04346 0.00192 > 9729.11499 0.00195 > 9727.18652 0.00198 > 9725.25806 0.00203 > 9723.32959 0.00207 > 9721.40112 0.00210 > 9719.47266 0.00212 > 9717.54419 0.00214 > 9715.61572 0.00215 > 9713.68726 0.00216 > 9711.75879 0.00217 > 9709.83032 0.00220 > 9707.90186 0.00223 > 9705.97339 0.00227 > 9704.04492 0.00230 > 9702.11646 0.00233 > 9700.18799 0.00235 > 9698.25952 0.00237 > 9696.33105 0.00240 > 9694.40259 0.00243 > 9692.47412 0.00247 > 9690.54565 0.00250 > 9688.61719 0.00252 > 9686.68872 0.00255 > 9684.76025 0.00257 > 9682.83179 0.00259 > 9680.90332 0.00260 > 9678.97485 0.00262 > 9677.04639 0.00263 > 9675.11792 0.00266 > 9673.18945 0.00268 > 9671.26099 0.00272 > 9669.33252 0.00276 > 9667.40405 0.00280 > 9665.47559 0.00283 > 9663.54712 0.00287 > 9661.61865 0.00290 > 9659.69019 0.00294 > 9657.76172 0.00297 > 9655.83325 0.00301 > 9653.90479 0.00304 > 9651.97632 0.00307 > 9650.04785 0.00310 > 9648.11938 0.00313 > 9646.19092 0.00316 > 9644.26245 0.00318 > 9642.33398 0.00321 > 9640.40552 0.00324 > 9638.47705 0.00327 > 9636.54858 0.00330 > 9634.62012 0.00334 > 9632.69165 0.00337 > 9630.76318 0.00340 > 9628.83472 0.00343 > 9626.90625 0.00345 > 9624.97778 0.00348 > 9623.04932 0.00351 > 9621.12085 0.00355 > 9619.19238 0.00360 > 9617.26392 0.00366 > 9615.33545 0.00372 > 9613.40698 0.00377 > 9611.47852 0.00382 > 9609.55005 0.00387 > 9607.62158 0.00391 > 9605.69312 0.00395 > 9603.76465 0.00398 > 9601.83618 0.00400 > 9599.90771 0.00401 > 9597.97925 0.00402 > 9596.05078 0.00405 > 9594.12231 0.00409 > 9592.19385 0.00415 > 9590.26538 0.00420 > 9588.33691 0.00425 > 9586.40845 0.00429 > 9584.47998 0.00433 > 9582.55151 0.00436 > 9580.62305 0.00439 > 9578.69458 0.00442 > 9576.76611 0.00445 > 9574.83765 0.00449 > 9572.90918 0.00453 > 9570.98071 0.00458 > 9569.05225 0.00462 > 9567.12378 0.00467 > 9565.19531 0.00470 > 9563.26685 0.00474 > 9561.33838 0.00478 > 9559.40991 0.00483 > 9557.48145 0.00488 > 9555.55298 0.00493 > 9553.62451 0.00498 > 9551.69604 0.00501 > 9549.76758 0.00504 > 9547.83911 0.00507 > 9545.91064 0.00510 > 9543.98218 0.00515 > 9542.05371 0.00520 > 9540.12524 0.00525 > 9538.19678 0.00531 > 9536.26831 0.00536 > 9534.33984 0.00540 > 9532.41138 0.00545 > 9530.48291 0.00550 > 9528.55444 0.00555 > 9526.62598 0.00561 > 9524.69751 0.00567 > 9522.76904 0.00572 > 9520.84058 0.00577 > 9518.91211 0.00582 > 9516.98364 0.00585 > 9515.05518 0.00589 > 9513.12671 0.00593 > 9511.19824 0.00597 > 9509.26978 0.00602 > 9507.34131 0.00607 > 9505.41284 0.00612 > 9503.48438 0.00617 > 9501.55591 0.00622 > 9499.62744 0.00626 > 9497.69897 0.00630 > 9495.77051 0.00634 > 9493.84204 0.00639 > 9491.91357 0.00645 > 9489.98511 0.00651 > 9488.05664 0.00657 > 9486.12817 0.00664 > 9484.19971 0.00669 > 9482.27124 0.00674 > 9480.34277 0.00679 > 9478.41431 0.00684 > 9476.48584 0.00690 > 9474.55737 0.00696 > 9472.62891 0.00701 > 9470.70044 0.00707 > 9468.77197 0.00712 > 9466.84351 0.00717 > 9464.91504 0.00721 > 9462.98657 0.00725 > 9461.05811 0.00730 > 9459.12964 0.00736 > 9457.20117 0.00743 > 9455.27271 0.00750 > 9453.34424 0.00756 > 9451.41577 0.00761 > 9449.48730 0.00766 > 9447.55884 0.00772 > 9445.63037 0.00778 > 9443.70190 0.00784 > 9441.77344 0.00791 > 9439.84497 0.00797 > 9437.91650 0.00802 > 9435.98804 0.00807 > 9434.05957 0.00813 > 9432.13110 0.00819 > 9430.20264 0.00825 > 9428.27417 0.00832 > 9426.34570 0.00839 > 9424.41724 0.00846 > 9422.48877 0.00852 > 9420.56030 0.00859 > 9418.63184 0.00865 > 9416.70337 0.00872 > 9414.77490 0.00879 > 9412.84644 0.00885 > 9410.91797 0.00892 > 9408.98950 0.00898 > 9407.06104 0.00904 > 9405.13257 0.00910 > 9403.20410 0.00918 > 9401.27563 0.00926 > 9399.34717 0.00935 > 9397.41870 0.00943 > 9395.49023 0.00950 > 9393.56177 0.00956 > 9391.63330 0.00960 > 9389.70483 0.00965 > 9387.77637 0.00970 > 9385.84790 0.00976 > 9383.91943 0.00983 > 9381.99097 0.00990 > 9380.06250 0.00996 > 9378.13403 0.01002 > 9376.20557 0.01007 > 9374.27710 0.01013 > 9372.34863 0.01020 > 9370.42017 0.01029 > 9368.49170 0.01037 > 9366.56323 0.01046 > 9364.63477 0.01054 > 9362.70630 0.01061 > 9360.77783 0.01068 > 9358.84937 0.01076 > 9356.92090 0.01084 > 9354.99243 0.01092 > 9353.06396 0.01100 > 9351.13550 0.01107 > 9349.20703 0.01113 > 9347.27856 0.01120 > 9345.35010 0.01127 > 9343.42163 0.01135 > 9341.49316 0.01142 > 9339.56470 0.01150 > 9337.63623 0.01157 > 9335.70776 0.01164 > 9333.77930 0.01171 > 9331.85083 0.01178 > 9329.92236 0.01186 > 9327.99390 0.01195 > 9326.06543 0.01205 > 9324.13696 0.01215 > 9322.20850 0.01224 > 9320.28003 0.01232 > 9318.35156 0.01239 > 9316.42310 0.01246 > 9314.49463 0.01253 > 9312.56616 0.01261 > 9310.63770 0.01269 > 9308.70923 0.01278 > 9306.78076 0.01287 > 9304.85229 0.01297 > 9302.92383 0.01305 > 9300.99536 0.01313 > 9299.06689 0.01321 > 9297.13843 0.01328 > 9295.20996 0.01334 > 9293.28149 0.01341 > 9291.35303 0.01347 > 9289.42456 0.01354 > 9287.49609 0.01361 > 9285.56763 0.01370 > 9283.63916 0.01379 > 9281.71069 0.01389 > 9279.78223 0.01399 > 9277.85376 0.01409 > 9275.92529 0.01418 > 9273.99683 0.01427 > 9272.06836 0.01436 > 9270.13989 0.01444 > 9268.21143 0.01451 > 9266.28296 0.01459 > 9264.35449 0.01466 > 9262.42603 0.01474 > 9260.49756 0.01483 > 9258.56909 0.01492 > 9256.64063 0.01502 > 9254.71216 0.01511 > 9252.78369 0.01520 > 9250.85522 0.01529 > 9248.92676 0.01538 > 9246.99829 0.01546 > 9245.06982 0.01554 > 9243.14136 0.01560 > 9241.21289 0.01566 > 9239.28442 0.01572 > 9237.35596 0.01579 > 9235.42749 0.01586 > 9233.49902 0.01595 > 9231.57056 0.01606 > 9229.64209 0.01617 > 9227.71362 0.01627 > 9225.78516 0.01636 > 9223.85669 0.01643 > 9221.92822 0.01650 > 9219.99976 0.01656 > 9218.07129 0.01664 > 9216.14282 0.01672 > 9214.21436 0.01680 > 9212.28589 0.01688 > 9210.35742 0.01696 > 9208.42896 0.01704 > 9206.50049 0.01712 > 9204.57202 0.01720 > 9202.64355 0.01728 > 9200.71509 0.01736 > 9198.78662 0.01743 > 9196.85815 0.01750 > 9194.92969 0.01759 > 9193.00122 0.01768 > 9191.07275 0.01777 > 9189.14429 0.01786 > 9187.21582 0.01794 > 9185.28735 0.01800 > 9183.35889 0.01805 > 9181.43042 0.01811 > 9179.50195 0.01817 > 9177.57349 0.01824 > 9175.64502 0.01831 > 9173.71655 0.01838 > 9171.78809 0.01846 > 9169.85962 0.01854 > 9167.93115 0.01863 > 9166.00269 0.01872 > 9164.07422 0.01881 > 9162.14575 0.01890 > 9160.21729 0.01898 > 9158.28882 0.01907 > 9156.36035 0.01914 > 9154.43188 0.01921 > 9152.50342 0.01928 > 9150.57495 0.01935 > 9148.64648 0.01942 > 9146.71802 0.01949 > 9144.78955 0.01957 > 9142.86108 0.01964 > 9140.93262 0.01971 > 9139.00415 0.01979 > 9137.07568 0.01987 > 9135.14722 0.01994 > 9133.21875 0.02001 > 9131.29028 0.02008 > 9129.36182 0.02014 > 9127.43335 0.02021 > 9125.50488 0.02029 > 9123.57642 0.02037 > 9121.64795 0.02044 > 9119.71948 0.02051 > 9117.79102 0.02059 > 9115.86255 0.02066 > 9113.93408 0.02073 > 9112.00562 0.02081 > 9110.07715 0.02090 > 9108.14868 0.02098 > 9106.22021 0.02107 > 9104.29175 0.02115 > 9102.36328 0.02121 > 9100.43481 0.02127 > 9098.50635 0.02132 > 9096.57788 0.02136 > 9094.64941 0.02142 > 9092.72095 0.02147 > 9090.79248 0.02153 > 9088.86401 0.02160 > 9086.93555 0.02168 > 9085.00708 0.02175 > 9083.07861 0.02183 > 9081.15015 0.02191 > 9079.22168 0.02198 > 9077.29321 0.02205 > 9075.36475 0.02212 > 9073.43628 0.02219 > 9071.50781 0.02226 > 9069.57935 0.02233 > 9067.65088 0.02240 > 9065.72241 0.02247 > 9063.79395 0.02253 > 9061.86548 0.02260 > 9059.93701 0.02267 > 9058.00854 0.02275 > 9056.08008 0.02282 > 9054.15161 0.02289 > 9052.22314 0.02295 > 9050.29468 0.02301 > 9048.36621 0.02307 > 9046.43774 0.02313 > 9044.50928 0.02320 > 9042.58081 0.02327 > 9040.65234 0.02335 > 9038.72388 0.02342 > 9036.79541 0.02350 > 9034.86694 0.02357 > 9032.93848 0.02363 > 9031.01001 0.02368 > 9029.08154 0.02374 > 9027.15308 0.02381 > 9025.22461 0.02387 > 9023.29614 0.02394 > 9021.36768 0.02401 > 9019.43921 0.02407 > 9017.51074 0.02413 > 9015.58228 0.02419 > 9013.65381 0.02425 > 9011.72534 0.02431 > 9009.79688 0.02438 > 9007.86841 0.02443 > 9005.93994 0.02449 > 9004.01147 0.02454 > 9002.08301 0.02460 > 9000.15454 0.02466 > 8998.22607 0.02473 > 8996.29761 0.02479 > 8994.36914 0.02485 > 8992.44067 0.02491 > 8990.51221 0.02496 > 8988.58374 0.02502 > 8986.65527 0.02507 > 8984.72681 0.02513 > 8982.79834 0.02518 > 8980.86987 0.02523 > 8978.94141 0.02528 > 8977.01294 0.02533 > 8975.08447 0.02538 > 8973.15601 0.02543 > 8971.22754 0.02548 > 8969.29907 0.02554 > 8967.37061 0.02560 > 8965.44214 0.02565 > 8963.51367 0.02571 > 8961.58521 0.02576 > 8959.65674 0.02580 > 8957.72827 0.02583 > 8955.79980 0.02587 > 8953.87134 0.02592 > 8951.94287 0.02597 > 8950.01440 0.02603 > 8948.08594 0.02608 > 8946.15747 0.02612 > 8944.22900 0.02615 > 8942.30054 0.02618 > 8940.37207 0.02622 > 8938.44360 0.02627 > 8936.51514 0.02632 > 8934.58667 0.02636 > 8932.65820 0.02640 > 8930.72974 0.02644 > 8928.80127 0.02647 > 8926.87280 0.02651 > 8924.94434 0.02655 > 8923.01587 0.02660 > 8921.08740 0.02663 > 8919.15894 0.02665 > 8917.23047 0.02667 > 8915.30200 0.02667 > 8913.37354 0.02668 > 8911.44507 0.02669 > 8909.51660 0.02673 > 8907.58813 0.02678 > 8905.65967 0.02684 > 8903.73120 0.02690 > 8901.80273 0.02694 > 8899.87427 0.02698 > 8897.94580 0.02704 > 8896.01733 0.02710 > 8894.08887 0.02716 > 8892.16040 0.02718 > 8890.23193 0.02717 > 8888.30347 0.02713 > 8886.37500 0.02709 > 8884.44653 0.02710 > 8882.51807 0.02714 > 8880.58960 0.02720 > 8878.66113 0.02727 > 8876.73267 0.02731 > 8874.80420 0.02733 > 8872.87573 0.02732 > 8870.94727 0.02728 > 8869.01880 0.02725 > 8867.09033 0.02723 > 8865.16187 0.02724 > 8863.23340 0.02727 > 8861.30493 0.02731 > 8859.37646 0.02734 > 8857.44800 0.02734 > 8855.51953 0.02732 > 8853.59106 0.02729 > 8851.66260 0.02728 > 8849.73413 0.02728 > 8847.80566 0.02730 > 8845.87720 0.02732 > 8843.94873 0.02733 > 8842.02026 0.02732 > 8840.09180 0.02729 > 8838.16333 0.02726 > 8836.23486 0.02723 > 8834.30640 0.02719 > 8832.37793 0.02716 > 8830.44946 0.02711 > 8828.52100 0.02705 > 8826.59253 0.02698 > 8824.66406 0.02690 > 8822.73560 0.02681 > 8820.80713 0.02670 > 8818.87866 0.02657 > 8816.95020 0.02641 > 8815.02173 0.02626 > 8813.09326 0.02616 > 8811.16479 0.02611 > 8809.23633 0.02612 > 8807.30786 0.02614 > 8805.37939 0.02615 > 8803.45093 0.02613 > 8801.52246 0.02609 > 8799.59399 0.02605 > 8797.66553 0.02601 > 8795.73706 0.02596 > 8793.80859 0.02589 > 8791.88013 0.02581 > 8789.95166 0.02571 > 8788.02319 0.02561 > 8786.09473 0.02550 > 8784.16626 0.02540 > 8782.23779 0.02530 > 8780.30933 0.02520 > 8778.38086 0.02510 > 8776.45239 0.02500 > 8774.52393 0.02490 > 8772.59546 0.02478 > 8770.66699 0.02466 > 8768.73853 0.02454 > 8766.81006 0.02441 > 8764.88159 0.02427 > 8762.95313 0.02415 > 8761.02466 0.02403 > 8759.09619 0.02392 > 8757.16772 0.02381 > 8755.23926 0.02369 > 8753.31079 0.02357 > 8751.38232 0.02345 > 8749.45386 0.02331 > 8747.52539 0.02317 > 8745.59692 0.02302 > 8743.66846 0.02286 > 8741.73999 0.02268 > 8739.81152 0.02251 > 8737.88306 0.02235 > 8735.95459 0.02220 > 8734.02612 0.02205 > 8732.09766 0.02189 > 8730.16919 0.02173 > 8728.24072 0.02156 > 8726.31226 0.02138 > 8724.38379 0.02119 > 8722.45532 0.02100 > 8720.52686 0.02082 > 8718.59839 0.02066 > 8716.66992 0.02051 > 8714.74146 0.02036 > 8712.81299 0.02022 > 8710.88452 0.02007 > 8708.95605 0.01990 > 8707.02759 0.01973 > 8705.09912 0.01956 > 8703.17065 0.01939 > 8701.24219 0.01922 > 8699.31372 0.01905 > 8697.38525 0.01888 > 8695.45679 0.01872 > 8693.52832 0.01855 > 8691.59985 0.01838 > 8689.67139 0.01819 > 8687.74292 0.01799 > 8685.81445 0.01777 > 8683.88599 0.01756 > 8681.95752 0.01734 > 8680.02905 0.01713 > 8678.10059 0.01693 > 8676.17212 0.01674 > 8674.24365 0.01657 > 8672.31519 0.01641 > 8670.38672 0.01626 > 8668.45825 0.01610 > 8666.52979 0.01593 > 8664.60132 0.01576 > 8662.67285 0.01557 > 8660.74438 0.01537 > 8658.81592 0.01515 > 8656.88745 0.01494 > 8654.95898 0.01474 > 8653.03052 0.01454 > 8651.10205 0.01435 > 8649.17358 0.01417 > 8647.24512 0.01398 > 8645.31665 0.01379 > 8643.38818 0.01361 > 8641.45972 0.01343 > 8639.53125 0.01326 > 8637.60278 0.01309 > 8635.67432 0.01292 > 8633.74585 0.01274 > 8631.81738 0.01256 > 8629.88892 0.01238 > 8627.96045 0.01219 > 8626.03198 0.01200 > 8624.10352 0.01182 > 8622.17505 0.01163 > 8620.24658 0.01143 > 8618.31812 0.01124 > 8616.38965 0.01105 > 8614.46118 0.01088 > 8612.53271 0.01071 > 8610.60425 0.01055 > 8608.67578 0.01037 > 8606.74731 0.01020 > 8604.81885 0.01002 > 8602.89038 0.00985 > 8600.96191 0.00969 > 8599.03345 0.00954 > 8597.10498 0.00939 > 8595.17651 0.00924 > 8593.24805 0.00908 > 8591.31958 0.00891 > 8589.39111 0.00874 > 8587.46265 0.00856 > 8585.53418 0.00839 > 8583.60571 0.00823 > 8581.67725 0.00806 > 8579.74878 0.00791 > 8577.82031 0.00775 > 8575.89185 0.00761 > 8573.96338 0.00747 > 8572.03491 0.00734 > 8570.10645 0.00721 > 8568.17798 0.00708 > 8566.24951 0.00695 > 8564.32104 0.00680 > 8562.39258 0.00665 > 8560.46411 0.00650 > 8558.53564 0.00635 > 8556.60718 0.00621 > 8554.67871 0.00608 > 8552.75024 0.00595 > 8550.82178 0.00582 > 8548.89331 0.00569 > 8546.96484 0.00555 > 8545.03638 0.00542 > 8543.10791 0.00528 > 8541.17944 0.00516 > 8539.25098 0.00504 > 8537.32251 0.00494 > 8535.39404 0.00483 > 8533.46558 0.00474 > 8531.53711 0.00464 > 8529.60864 0.00453 > 8527.68018 0.00443 > 8525.75171 0.00432 > 8523.82324 0.00421 > 8521.89478 0.00410 > 8519.96631 0.00399 > 8518.03784 0.00389 > 8516.10938 0.00378 > 8514.18091 0.00368 > 8512.25244 0.00359 > 8510.32397 0.00350 > 8508.39551 0.00342 > 8506.46704 0.00334 > 8504.53857 0.00327 > 8502.61011 0.00319 > 8500.68164 0.00311 > 8498.75317 0.00302 > 8496.82471 0.00293 > 8494.89624 0.00285 > 8492.96777 0.00278 > 8491.03931 0.00271 > 8489.11084 0.00264 > 8487.18237 0.00257 > 8485.25391 0.00251 > 8483.32544 0.00245 > 8481.39697 0.00239 > 8479.46851 0.00234 > 8477.54004 0.00228 > 8475.61157 0.00220 > 8473.68311 0.00212 > 8471.75464 0.00203 > 8469.82617 0.00195 > 8467.89771 0.00189 > 8465.96924 0.00184 > 8464.04077 0.00179 > 8462.11230 0.00175 > 8460.18384 0.00171 > 8458.25537 0.00168 > 8456.32690 0.00165 > 8454.39844 0.00161 > 8452.46997 0.00157 > 8450.54150 0.00151 > 8448.61304 0.00144 > 8446.68457 0.00137 > 8444.75610 0.00131 > 8442.82764 0.00126 > 8440.89917 0.00122 > 8438.97070 0.00118 > 8437.04224 0.00115 > 8435.11377 0.00112 > 8433.18530 0.00110 > 8431.25684 0.00107 > 8429.32837 0.00105 > 8427.39990 0.00102 > 8425.47144 0.00099 > 8423.54297 0.00095 > 8421.61450 0.00091 > 8419.68604 0.00088 > 8417.75757 0.00084 > 8415.82910 0.00082 > 8413.90063 0.00080 > 8411.97217 0.00078 > 8410.04370 0.00076 > 8408.11523 0.00073 > 8406.18677 0.00070 > 8404.25830 0.00067 > 8402.32983 0.00064 > 8400.40137 0.00061 > 8398.47290 0.00058 > 8396.54443 0.00056 > 8394.61597 0.00054 > 8392.68750 0.00051 > 8390.75903 0.00048 > 8388.83057 0.00046 > 8386.90210 0.00045 > 8384.97363 0.00046 > 8383.04517 0.00047 > 8381.11670 0.00047 > 8379.18823 0.00045 > 8377.25977 0.00041 > 8375.33130 0.00038 > 8373.40283 0.00034 > 8371.47437 0.00033 > 8369.54590 0.00032 > 8367.61743 0.00032 > 8365.68896 0.00032 > 8363.76050 0.00032 > 8361.83203 0.00032 > 8359.90356 0.00032 > 8357.97510 0.00031 > 8356.04663 0.00029 > 8354.11816 0.00026 > 8352.18970 0.00025 > 8350.26123 0.00024 > 8348.33276 0.00024 > 8346.40430 0.00024 > 8344.47583 0.00024 > 8342.54736 0.00024 > 8340.61890 0.00023 > 8338.69043 0.00022 > 8336.76196 0.00021 > 8334.83350 0.00019 > 8332.90503 0.00017 > 8330.97656 0.00016 > 8329.04810 0.00016 > 8327.11963 0.00016 > 8325.19116 0.00016 > 8323.26270 0.00016 > 8321.33423 0.00015 > 8319.40576 0.00014 > 8317.47729 0.00013 > 8315.54883 0.00013 > 8313.62036 0.00013 > 8311.69189 0.00012 > 8309.76343 0.00011 > 8307.83496 0.00010 > 8305.90649 0.00008 > 8303.97803 0.00007 > 8302.04956 0.00007 > 8300.12109 0.00007 > 8298.19263 0.00006 > 8296.26416 0.00006 > 8294.33569 0.00007 > 8292.40723 0.00008 > 8290.47876 0.00010 > 8288.55029 0.00011 > 8286.62183 0.00010 > 8284.69336 0.00007 > 8282.76489 0.00005 > 8280.83643 0.00003 > 8278.90796 0.00003 > 8276.97949 0.00004 > 8275.05103 0.00006 > 8273.12256 0.00008 > 8271.19409 0.00010 > 8269.26563 0.00010 > 8267.33716 0.00009 > 8265.40869 0.00009 > 8263.48022 0.00008 > 8261.55176 0.00006 > 8259.62329 0.00004 > 8257.69482 0.00003 > 8255.76636 0.00002 > 8253.83789 0.00001 > 8251.90942 0.00002 > 8249.98096 0.00003 > 8248.05249 0.00004 > 8246.12402 0.00004 > 8244.19556 0.00004 > 8242.26709 0.00003 > 8240.33862 0.00002 > 8238.41016 0.00002 > 8236.48169 0.00003 > 8234.55322 0.00005 > 8232.62476 0.00007 > 8230.69629 0.00007 > 8228.76782 0.00006 > 8226.83936 0.00005 > 8224.91089 0.00003 > 8222.98242 0.00002 > 8221.05396 0.00001 > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Spline`Spline and GraphicsComplex Is there an easy way to have Spline`Spline work inside GraphicsComplex? -- m === Subject: Re: Label style in PieChart? Needs[PieCharts`] pct = 21.7; pieLab = StringJoin[ToString[pct], %]; Format the label directly pc = PieChart[{pct, 100 - pct}, PieLabels -> { Style[pieLab, 14, FontFamily -> Helvetica], }, PieStyle -> { Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, Opacity[0.1]]}, ImageSize -> 200] Or change the BaseStyle pc = PieChart[{pct, 100 - pct}, BaseStyle -> Directive[14, FontFamily -> Helvetica], PieLabels -> {pieLab, }, PieStyle -> { Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, Opacity[0.1]]}, ImageSize -> 200] Bob Hanlon I'm using Mathematica 6.0.3 on OSX 10.5. In a PieChart, is it possible to control the label font size and family? I routinely control this for 'FrameLabel' with ListPLot. But in the following, adding 'LabelStyle -> Directive[12, FontFamily -> Helvetica]', does not change the '21.7%' label, PieLabelStyle is not valid, PieStyle does not accept font information, and I have found nothing information in the Help system or on the web for this. pct = 21.7 pieLab = StringJoin[ToString[pct], %] PieChart[{pct, 100 - pct}, PieLabels -> {pieLab, }, PieStyle -> {Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, Opacity[0.1]]}, ImageSize -> 200] G -- Gordon Robertson B.C. Cancer Agency Genome Sciences Centre Vancouver BC Canada V5Z 4S6 604.707.5900 x5416 www.bcgsc.ca -- Bob Hanlon === Subject: Re: how to test where a list contains constant(s) or not IsConstantsIn[list_] := Or @@ (NumericQ /@ list) IsConstantsIn /@ {{a, b, c, Pi}, {a, b, c, 0.0001}, {a, b, c, 2 + Pi I}, {a, b, c}} {True,True,True,False} Bob Hanlon case1: { a, b, c, Pi } gives true because of Pi case2: { a, b, c, 0.0001} gives true because of 0.0001 case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I case4: { a, b, c} gives false is this function right ? ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], Complex] ) IsConstantsIn[ lstList_ ] := Module[ { intLength }, intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; If[ intLength > 0, Return[ True ], Return[ False ] ]; Return[ False ]; ] -- Bob Hanlon === Subject: Re: Label style in PieChart? Gordon, Use Style on individual items, or BaseStyle for an entire plot. Needs[PieCharts`] pct = 21.7; pieLab = StringJoin[ToString[pct], %]; PieChart[{pct, 100 - pct}, PieLabels -> {Style[pieLab, 14], }, PieStyle -> {Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, Opacity[0.1]]}, ImageSize -> 200] PieChart[{pct, 100 - pct}, PieLabels -> {pieLab, }, PieStyle -> {Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, Opacity[0.1]]}, BaseStyle -> {FontSize -> 14}, ImageSize -> 200] -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ I'm using Mathematica 6.0.3 on OSX 10.5. In a PieChart, is it possible > to control the label font size and family? I routinely control this for > 'FrameLabel' with ListPLot. But in the following, adding > 'LabelStyle -> Directive[12, FontFamily -> Helvetica]', does not > change the '21.7%' label, PieLabelStyle is not valid, PieStyle does > not accept font information, and I have found nothing information in > the Help system or on the web for this. pct = 21.7 pieLab = StringJoin[ToString[pct], %] PieChart[{pct, 100 - pct}, PieLabels -> {pieLab, }, > PieStyle -> {Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, > Opacity[0.1]]}, ImageSize -> 200] > G > -- > Gordon Robertson > B.C. Cancer Agency Genome Sciences Centre > Vancouver BC Canada V5Z 4S6 > 604.707.5900 x5416 > www.bcgsc.ca === Subject: Re: Label style in PieChart? Needs[PieCharts`] pct = 21.7 pieLab = StringJoin[ToString[pct], %]; PieChart[{pct, 100 - pct}, PieLabels -> {pieLab, }, PieStyle -> {Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, Opacity[0.1]]}, ImageSize -> 200, BaseStyle -> {FontSize -> 24, FontFamily -> Brush Script Std}] works on my Windows box. Jens I'm using Mathematica 6.0.3 on OSX 10.5. In a PieChart, is it possible > to control the label font size and family? I routinely control this for > 'FrameLabel' with ListPLot. But in the following, adding > 'LabelStyle -> Directive[12, FontFamily -> Helvetica]', does not > change the '21.7%' label, PieLabelStyle is not valid, PieStyle does > not accept font information, and I have found nothing information in > the Help system or on the web for this. pct = 21.7 pieLab = StringJoin[ToString[pct], %] PieChart[{pct, 100 - pct}, PieLabels -> {pieLab, }, > PieStyle -> {Directive[Darker[Blue], Opacity[0.4]], Directive[Gray, > Opacity[0.1]]}, ImageSize -> 200] > G === Subject: Re: asumming and Exp orthogonality condition On Sep 15, 2:38 am, Jean-Marc Gulliet Element[ 0 , Integers ] evaluates to true, however; > Assuming[ Element[ n , Integers] , Integrate[ Exp [ 2 I Pi n x ] , {x , 0 , 1 } ] ] evaluates to zero. Shouldn't evaluate to KroneckerDelta[ 0 , n ] instead? The following might explain what is going on. Mathematica does not have > any transformation rule for this specific case of this definite integral. So, I guess, what Mathematica computes first is the general formula for > the definite integral (I shall call it int[n]) and then applies the > assumption about n being an integer. (This is conceptually equivalent to > In[1] and In[2].) As it stands, int[n] is defined and equal to 0 for all n in N, n !=0. > (For n == 0 we have a division by zero.) So what Mathematica sees is > that the function is defined for every non-zero integer and its value is > therefore zero. Now, if we extend the domain of definition of int[n] to the whole set of > integers and defined int[0] == 1, (having checked that the limit = of > int[n] as n approaches zero on the left and on the right is equal to > one), only then this extended definition matches KroneckerDelta[0, n]. Thus, Mathematica's behavior seems reasonable since Mathematica is not > going to attempt by itself to check the limits and/or extend the domain > of definition. In[1]:= int[n_] = Integrate[Exp[2 I Pi n x], {x, 0, 1}] Out[1]= -((I (-1 + E^(2 I n [Pi])))/(2 n [Pi])) In[2]:= Assuming[Element[n, Integers], Simplify[int[n]]] Out[2]= 0 In[3]:= Table[int[n], {n, -2, 2}] During evaluation of In[3]:= Power::infy: Infinite expression 1/0 > encountered. > > During evaluation of In[3]:= [Infinity]::indet: Indeterminate > expression (0 ComplexInfinity)/[Pi] encountered. > > Out[3]= {0, 0, Indeterminate, 0, 0} In[4]:= Limit[int[n], n -> 0, Direction -> 1] Out[4]= 1 In[5]:= Limit[int[n], n -> 0, Direction -> -1] Out[5]= 1 -- Jean-Marc I've read that it is possible to unprotect the Integrate function and add/override values with custom functions. Is it possible to override this in this particular case? Charles J. Quarra === Subject: Re: Problem with replacement rules On Sep 11, 12:16 pm, Jens-Peer Kuska makeFunction[expr_, x_] := Module[{var}, > var = Complement[Variables[expr], {x}]; > Function @@ {var, x /. Solve[expr == 0, x][[1]]} > ] and f = makeFunction[2 + x - y^2, x]; Plot[f[z], {z, -2, 2}] ?? Jens This code proposed by Jens-Peer Kuska only works with polynomial equations, because Variables only works correctly with polynomials. For example, makeFunction[Sin[x]-y,x] gives as output: Function[{y, Sin[x]}, ArcSin[y]] which is incorrect and cannot be plotted. A more general code is the following: invFunction[expr_, x_, vars_List] := Function @@ {vars, x /. Solve[expr == 0, x][[1]]} where the argument x is the dependent variable and vars_List is the list of independent variables. Now you have as before: f = invFunction[2 + x - y^2, x, {y}] Plot[f[z], {z, -2, 2}] for your polynomial functions, but also f = invFunction[Sin[x] - y, x, {y}] Plot[f[z], {z, -2, 2}] without a problem. An example with multiple indep. variables: f = invFunction[Sin[x] - y - z, x, {y, z}] Plot3D[f[y, z], {y, -1, 1}, {z, -1, 1}] hth === Subject: Re: One fundamental Gudermannian identity not verified > Since I couldn't find a definition of the Gudermannian fonction among > Mathematica packages I defined it myself : > >> In[9]:= Gd= (2 tan^-1(e^#)-[Pi]/2) & The above expression *cannot* yield the result below for neither lowercase e has any built-in meaning nor tan^-1. However, capital E and ArcTan have the desired meaning. >> Out[9]= 2 ArcTan[[ExponentialE]^#1] - [Pi]/2 & I could verify all the identies with that fonction I thought of , > including one involving half-angles ie > >> In[14]:= FullSimplify[Subtract @@ {#[[1]][Gd[x]/2], #[[2]][x/2]}, >> x[Epsilon] Reals] & /@ {{Tan, Tanh}} Surely you meant Element[x, Reals] and not x times epsilon times Reals? >> Out[14]= {0} but not this last one : > >> In[16]:= FullSimplify[Subtract @@ {#[[1]][x], #[[2]][Tanh x/2]}, What you have written means (Tanh times x) divided by two. >> x[Epsilon] Reals] & /@ {{Gd , 2 ArcTan}} >> Out[16]= {-[Pi]/2 + >> 2 ArcTan[[ExponentialE]^x] - (2 ArcTan)[(Tanh x)/2]} Notice the spurious set of parentheses around two times ArcTan... > Is there another way with Mahematica 6.0 to make this verification? You should post actual code, i.e. the output must be produce by the input, and not a mix of fantasied notation. -- Jean-Marc === Subject: Re: Advanced plotting > I am wondering is there a possibility in Mathematica 6 to use two > different scales on vertical axis- one scale on the left one and the > other on the right one (with a horizontal axis being common for both The Technical Support FAQ titled, Can I create a two-axis graph in Mathematica? should answer your question. See, http://support.wolfram.com/mathematica/graphics/2d/twoaxisgraph.html Note that you must *not* load the packageGraphics`MultipleListPlot` when working with version 6.x. For instance, In[1]:= $Version TwoAxisPlot[{f_, g_}, {x_, min_, max_}, frange_, grange_, (opts___)?OptionQ] := Module[{old, new, scale, pts, gstuff, fstuff}, {fm, fM} = frange; {gm, gM} = grange; scale[var_] = ((var - gm)*(fM - fm))/(gM - gm) + fm; old = AbsoluteOptions[ Plot[g, {x, min, max}, Frame -> True, PlotRange -> grange, DisplayFunction -> Identity], FrameTicks][[1, 2, 2]]; new = (Prepend[Rest[#1], scale[First[#1]]] &) /@ old; Plot[{f, scale[g]}, {x, min, max}, Frame -> True, PlotRange -> frange + {0, .05 (fM - fm)}, FrameTicks -> {Automatic, Automatic, None, new}, PlotStyle -> {{RGBColor[1, 0, 0]}, {RGBColor[0, 0, 1]}}, FrameStyle -> {{}, {RGBColor[1, 0, 0]}, {}, {RGBColor[0, 0, 1]}}, opts]] TwoAxisPlot[{x^3, Sqrt[x]}, {x, 0, 4}, {0, 64}, {0, 2}] TwoAxisPlot[{Sqrt[x], x^3}, {x, 0, 4}, {0, 2}, {0, 70}] Out[1]= 6.0 for Mac OS X x86 (64-bit) (May 21, 2008) [... graphics deleted ...] -- Jean-Marc === Subject: Re: Advanced plotting I have to admit that this was a bit of work because I never tried to make a plot with an x-axis break before, but this can be done with the Presentations package. I plot BesselJ[5,x] and x^2 on the same plot with the y scale on the left going from -0.4 to 0.4 and on the right going from 0 to 2500. The scale on the right was produced with CustomTicks. The x^2 function and scale are shown in Red. The functions are shown in the domain [0,10] and [40,50] with a break, using a dashed line and // in the middle. Since we can't have several partial scales on an axis with Mathematica, I used two XTickLines from Presentations to produce the x scales from 0 to 10 and 40 to 50. This whole process might be automated if we were going to do a lot of it. We have to do a y scaling transformation on the x^2 function in both its plotting and in the CustomTicks. We have to do x domain shifting for both functions in the separated domain [40,50]. The x-axis and its labeling are essentially hand crafter. Needs[Presentations`Master`] yrightticks = CustomTicks[-.4 + .00032 # &, {0, 5200, 500, 5}, CTNumberFunction -> (Style[#, Red] &)]; Draw2D[ {Draw[BesselJ[5, x], {x, 0, 10}], Draw[BesselJ[5, x + 25], {x, 15, 25}], Red, Draw[-0.4` + 0.00032` x^2, {x, 0, 10}], Draw[-0.4` + 0.00032` (x + 25)^2, {x, 15, 25}], (* Draw the x axis in two pieces *) Black, {AbsoluteDashing[{4}], Line[{{10, -.4}, {25, -.4}}]}, Text[Style[//, 12, Bold], {12.5, -.4}], XTickLine[{0, 10, -.4}, {0, 10}, {0, 10, 5}, 5, XLabTickSpecs -> {0.02, 0}, XUnLabTickSpecs -> {.01, 0}], XTickLine[{15, 25, -.4}, {40, 50}, {40, 50, 5}, 5, XLabTickSpecs -> {0.02, 0}, XUnLabTickSpecs -> {.01, 0}], Text[x // TraditionalForm, {12.5, -.45}]}, AspectRatio -> .6, Frame -> {False, True, False, True}, FrameTicks -> {None, Automatic, None, yrightticks}, FrameLabel -> {None, BesselJ[5, x], None, x^2}, RotateLabel -> False, PlotRange -> {{0, 25}, {-.40, .40}}, PlotRangePadding -> 0, PlotRangeClipping -> False, ImagePadding -> {{60, 50}, {30, 10}}, PlotLabel -> Two Scale Plot with x Axis Break, BaseStyle -> {FontSize -> 12}, ImageSize -> 500] -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > I am wondering is there a possibility in Mathematica 6 to use two > different scales on vertical axis- one scale on the left one and the > other on the right one (with a horizontal axis being common for both > the vertical ones). The thing is I would like to plot two functions > that have the same x-domain but completely different y-domain. If > I used the standard plotting procedure then if a first function (with > values about 100) can be easily seen on the plot, the values of the > other are to small (close to zero) to be seen. The solution would be > to set two independent Y axes, however I don't know if there is the > possibility in Mathematica 6 (I have seen such a plots in scientific > papers but maybe done with some other application). > The second question is is there a possibility to make breaks in axes. > What I mean is that I have a plot with let say X domain [0,50], but I > am only interested in two parts of it, say [0,10] and [40,50], so is > it possible to set a kind of an option in Plot command? Such a trick > is also quite common in scientific papers with characteristic on > axis in a place where the break is made (I know for example how to > do it in Origin and there is quite an easy task). > I have been searching for the staff quite long and haven't found any > solution yet so I would be really grateful if someone would help me > with the issue. > Kazik > === Subject: Re: Apparent error integrating product of DiracDelta's How do I get: > Integrate[DiracDelta[z- x] DiracDelta[z- y], {z-Infinity, Infinity}= ] > to give DiracDelta[x-y] as the result? Currently it gives 0. I ha= ve all three variable assumed to be Reals. I am using 6.0.0. > Michael Mandelberg I think you have synatx error in the limit part. I assume you mean to wri= te > {z, -Infinity,Infinity} Given that, I think zero is the correct answer. When you multiply 2 de= ltas > at different positions, you get zero. Integral of zero is zero. Nasser However, I disagree with your conclusion. Who says 'x' and 'y' are different? === Subject: Re: Apparent error integrating product of DiracDelta's How do I get: > Integrate[DiracDelta[z- x] DiracDelta[z- y], {z-Infinity, Infinity}= ] > to give DiracDelta[x-y] as the result? Currently it gives 0. I ha= ve all three variable assumed to be Reals. I am using 6.0.0. > Michael Mandelberg I think you have synatx error in the limit part. I assume you mean to wri= te > {z, -Infinity,Infinity} Given that, I think zero is the correct answer. When you multiply 2 de= ltas > at different positions, you get zero. Integral of zero is zero. Nasser No Nasser, the correct value of the integral should be DiracDelta[x- y], as Michael said. This value is indeed 0 if x != y but it is not 0 if x==y. Mathematica correctly calculates: Integrate[f[z - x] DiracDelta[z - y], {z, -Infinity, Infinity}, Assumptions -> y [Element] Reals] as f[-x + y] However it fails to recognize that if f[z-x] is replaced by DiracDelta[z-x], the result should be DiracDelta[-x + y] or the equivalent DiracDelta[x - y] In the help file, under possible issues it is mentioned that Products of distributions with coinciding singular support cannot be defined: So perhaps at the moment the only way to do the integral is: Integrate[f[z - x] DiracDelta[z - y], {z, -Infinity, Infinity}, Assumptions -> y [Element] Reals] /. f -> DiracDelta hth === Subject: imagesize to full width of current screen greetings, i'm trying to determine the current width of the notebook screen to size graphics and manipulate's to fit the whole width of the window. i've looked at PageWidth, ImageSize->All, ImageSize->Full, ImageSize- >Large, ImageSize->Scaled[s] (ImageSize->Scaled@1 is equivalent to ImageSize->Full), $* variables, ... this is a common feature in other programming languages (javascript in web browsers for example). i've also searched this mailing list without success. any ideas? Mitch === Subject: Re: imagesize to full width of current screen Hi Mitch, the magic word is: FullScreenArea/.SystemInformation[Devices,ScreenInformation] hope this helps, Daniel > greetings, i'm trying to determine the current width of the notebook screen to > size graphics and manipulate's to fit the whole width of the window. > i've looked at PageWidth, ImageSize->All, ImageSize->Full, ImageSize- > >Large, ImageSize->Scaled[s] (ImageSize->Scaled@1 is equivalent to > ImageSize->Full), $* variables, ... this is a common feature in other programming languages (javascript in > web browsers for example). i've also searched this mailing list > without success. any ideas? Mitch > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Re: imagesize to full width of current screen > greetings, i'm trying to determine the current width of the notebook screen to > size graphics and manipulate's to fit the whole width of the window. > i've looked at PageWidth, ImageSize->All, ImageSize->Full, ImageSize- > >Large, ImageSize->Scaled[s] (ImageSize->Scaled@1 is equivalent to > ImageSize->Full), $* variables, ... this is a common feature in other programming languages (javascript in > web browsers for example). i've also searched this mailing list > without success. any ideas? Mitch the information is in the WindowSize option of the corresponding notebook object. This will give you the size of the notebook that evaluates it: WindowSize /. Options[EvaluationNotebook[]] when working with manipulates and palettes you also might want to use ButtonNotebook[] , SelectedNotebook[] and Notebooks[] to get a handle at the notebook you are after. Just in case: You can also get the size of the screen with: ScreenRectangle /. Options[$FrontEnd] which then lets you choose a reasonable size for a new notebook/window. hth, albert === Subject: Re: Advanced plotting >two different scales on vertical axis- one scale on the left one and >the other on the right one (with a horizontal axis being common for >both the vertical ones). Yes, this is possible and has been answered several times before here. >The second question is is there a possibility to make >breaks in axes. What I mean is that I have a plot with let say X >domain [0,50], but I am only interested in two parts of it, say >[0,10] and [40,50], so is it possible to set a kind of an option in >Plot command? Yes, here is one way to do what you've outlined above. Plot[-1, {x, 0, 5}, PlotRange -> {0, 50}, Axes -> None, Epilog -> {Inset[ Plot[45 - 20 ( x - 2)^2 + x, {x, 0, 5}, PlotRange -> {40, 50}, Frame -> {False, True, True, True}, AspectRatio -> 1/5], Scaled@{.06, .5}, {0, 40}, 5], Inset[Plot[45 - 20 ( x - 2)^2 + x, {x, 0, 5}, PlotRange -> {0, 10}, Frame -> {True, True, False, True}, AspectRatio -> 1/5], Scaled@{.06, .1}, {0, 0}, 5]}] Note the same usage of Inset can create a second y-axis. That is modifying this somewhat your first question could be answered by replacing the Plot[-1 ... part with one function using Frame->{True,True,True,False} then using Inset to plot the other function with Frame->{False,False,False,True}. But this approach is more complex than previous suggestions for creating a second y-axis. The simplest way I can think of to create a second y-axis would be to use FrameTicks to specify a custom axis on the right side, i.e., FrameTicks->{Automatic,Automatic,None, customList} === Subject: Re: how to test where a list contains constant(s) or not >case1: { a, b, c, Pi } gives true because of Pi >case2: { a, b, c, 0.0001} gives true because of 0.0001 >case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I >case4: { a, b, c} gives false >is this function right ? >ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], >Complex] ) >IsConstantsIn[ lstList_ ] := >Module[ { intLength }, >intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; >If[ intLength > 0, Return[ True ], Return[ False ] ]; >Return[ False ]; >] > Your function looks overly complex. If I understand correctly what you want to do then constantQ[x_List] := Or @@ (NumericQ /@ x) should work. Using this on your test cases gives In[58]:= constantQ@{a, b, c, Pi} constantQ@{a, b, c, 0.0001} constantQ@{a, b, c, 2 + Pi I} constantQ@{a, b, c} Out[58]= True Out[59]= True Out[60]= True Out[61]= False === Subject: Re: how to test where a list contains constant(s) or not Hi Aya, a complex number is numeric, therefore you only need to test for NumericQ. E.g.: MemberQ[yourList, _?NumericQ] However, there seems to be a problem with what you consider a constant. As Mathematica evaluates the arguments of functions, the following gives True: a=1; MemberQ[{a}, _?NumericQ] Is this what you want??? hope this helps, Daniel > case1: { a, b, c, Pi } gives true because of Pi > case2: { a, b, c, 0.0001} gives true because of 0.0001 > case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I > case4: { a, b, c} gives false is this function right ? ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], > Complex] ) > IsConstantsIn[ lstList_ ] := > Module[ { intLength }, > intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; > If[ intLength > 0, Return[ True ], Return[ False ] ]; > Return[ False ]; > ] > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Re: how to test where a list contains constant(s) or not > case1: { a, b, c, Pi } gives true because of Pi > case2: { a, b, c, 0.0001} gives true because of 0.0001 > case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I > case4: { a, b, c} gives false is this function right ? ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], > Complex] ) > IsConstantsIn[ lstList_ ] := > Module[ { intLength }, > intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; > If[ intLength > 0, Return[ True ], Return[ False ] ]; > Return[ False ]; > ] > As written above, the predicate ComplexQ is equivalent to NumericQ. So you could write your function directly as follows: In[1]:= IsConstantsIn[lstList_] := If[Length@Select[lstList, NumericQ[#] &] > 0, True, False] (* Now, is this what you are looking for? I do no know. You should describe precisely what you intent to do. *) case = {{a, b, c, Pi}, {a, b, c, 0.0001}, {a, b, c, 2 + Pi I}, {a, b, c}}; IsConstantsIn /@ case Out[3]= {True, True, True, False} In[4]:= NumericQ /@ case[[4]] Out[4]= {False, False, False} In[5]:= Head /@ case[[4]] Out[5]= {Symbol, Symbol, Symbol} -- Jean-Marc === Subject: Re: how to test where a list contains constant(s) or not > case1: { a, b, c, Pi } gives true because of Pi > case2: { a, b, c, 0.0001} gives true because of 0.0001 > case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I > case4: { a, b, c} gives false is this function right ? ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], > Complex] ) > IsConstantsIn[ lstList_ ] := > Module[ { intLength }, > intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; > If[ intLength > 0, Return[ True ], Return[ False ] ]; > Return[ False ]; > ] It probably does what you want, but I think it is way too complicated. Note that Complex numbers are Numeric by default, so there is no need for your ComplexQ-definition. If you think about seriously using Mathematica you should get familiar with its pattern matcher, otherwise you are missing its strongest part :-). If I correctly understood what you are after, the following leaves all the work for mathematica: IsConstantsIn[{___, _?NumericQ, ___}] := True IsConstantsIn[___] := False the first definition gives True, if the argument to IsConstantsIn is a list containing at least one numeric element at any position. The second definition ensures that IsConstantsIn will return False in any other case. To handle other cases, e.g. expressions that are not lists you can easily extend by adding additional definitions. Finally I think the name of your function could probably changed to reflect more clearly what exactly it is doing, e.g. IsNumericIn or HasNumericElement. Mathematica has the posibility to define attributes to symbols, among these attributes is Constant, so IsCOnstantsIn would mislead me in thinking it has something to do with that... hth, albert === Subject: Re: how to test where a list contains constant(s) or not > case1: { a, b, c, Pi } gives true because of Pi > case2: { a, b, c, 0.0001} gives true because of 0.0001 > case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I > case4: { a, b, c} gives false is this function right ? > Most of what you've written is completely redundant. > ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], > Complex] ) This ComplexQ function is completely equivalent to NumericQ. p || (p && q) is just p, right? > IsConstantsIn[ lstList_ ] := > Module[ { intLength }, > intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; One could just use ComplexQ instead of ComplexQ[#]&. > If[ intLength > 0, Return[ True ], Return[ False ] ]; > Return[ False ]; > ] > You almost never need to use Return in Mathematica. The above two lines are equivalent to the simple expression intLength > 0 in this context. With all these simplifications your function becomes f[lst_List] := Length@Select[lst, NumericQ] > 0 But the following approach is simpler and more efficient: g[lst_List] := MemberQ[lst, _?NumericQ] === Subject: Re: how to test where a list contains constant(s) or not ?? Jens > case1: { a, b, c, Pi } gives true because of Pi > case2: { a, b, c, 0.0001} gives true because of 0.0001 > case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I > case4: { a, b, c} gives false is this function right ? ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ], > Complex] ) > IsConstantsIn[ lstList_ ] := > Module[ { intLength }, > intLength = Length@Select[ lstList, ComplexQ[ # ]& ]; > If[ intLength > 0, Return[ True ], Return[ False ] ]; > Return[ False ]; > ] > === Subject: Re: A interesting case Hi Miguel, I think Mathematica chooses what it considers the simplest form for an expression. By default the complexity of an expression is judged according to LeafCount, thta is how many leaves there are if the expression is written as tree (by e.g. TreeForm). Now try: LeafCount/@{a^(-2),2/a^2,3/a^2} TreeForm/@{a^(-2),2/a^2,3/a^2} and you will see that a^(-2) has less leaves than 1/a^2 hope this helps, Daniel > I have spent work hours with this case. ToString[#,InputForm]&/@{1/a^2,2/a^2,3/a^2} > {a^(-2),2/a^2,3/a^2} When the numerator of a rational element is 1, the structure string is > diferent. Why? > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Re: A interesting case because 1/a^n is Power[a,-n] and k/a^n is Times[k,Power[a,-n]] it would be nonsense to store Times[1,Power[a,-n]] in the first case and Times[1,q__] simplify to Times[q] Jens > I have spent work hours with this case. ToString[#,InputForm]&/@{1/a^2,2/a^2,3/a^2} > {a^(-2),2/a^2,3/a^2} When the numerator of a rational element is 1, the structure string is > diferent. Why? > === Subject: Functional Programming? John Gray's book Mastering Mathematica has a a chapter on functional programming in Mathematica. For more on fp techniques in the context of longer programs see http://book.realworldhaskell.org/ where there is a preliminary copy of a book, Real World Haskell to be published soon by O'Reilly. Many tutorials and books are to be found at www.haskell.org which can be ordered from http://www.ffconsultancy.com/products/index.html Also at your local bookstore is Harrop's book, F# for Scientists. (I saw a copy at Borders yesterday) F# is Microsoft's adaptation of the ML family of functional programming languages. And I would be remiss if I didn't mention the bible of computer science, Abelson and Sussman, Structure and Interpretation of Computer Programs from the MIT press. This book is to computers what the Feynman Lectures are to physics, and anybody who programs should read it three or four times in their lives. This book is written in the context of the functional programming language Scheme, a dialect of Lisp. Free downloadable videos of the corresponding course are available from the MIT web site. I just watched them this year. BTW, I have been programming for 45 years, so being an old guy shouldn't stop you. It just means that the world offers so many new and intreresting things to learn about as we go along. For example I am learning that the structure of haskell has a number of tie-ins with abstract mathematics such as category theory, and this is rather what I naively imagined computer programming would be like before I took my first computer course in 1963. --Bert Mayo === Subject: Solving algebraic equations with some conditions I am trying to solve a system of 3 PDEs using a Fourier ansatz: nL[x_, t_] = Sum[cn[p, l] Exp[I (p k x + l [Omega] t)], {p, -1, 1}, {l, -1, 1}]; EscL[x_, t_] = Sum[cE[p, l] Exp[I (p k x + l [Omega] t)], {p, -1, 1}, {l, -1, 1}]; iL[t_] = Sum[ci[l] Exp[I l [Omega] t], {l, -1, 1}]; So I have a system of up to 55 algebraic equations (Not every Exp[I (p k x + l [Omega] t)] occures after inserting the ansatz, thus some will be trivial) for the 55 Fourier coefficient. The equations are not linear, but linear in every coefficient. I was told that this would take some time but should be possible. Additionally, I know that the functions are all real, thus I get more equations: K[p,l]=Conjugate[K[p,l]] Unfortunately, I have the impression that Mathematica cannot handle these in Solve[], as simple examples produce things like Conjugate^-1[I]. A possibility I considered is constructing the coefficients with real and imaginary part: iL[t_] = Sum[(ci[l, re] + ci[l, im] I) Exp[I l [Omega] t], {l, -1, 1}]; Then I had to give Mathematica assumtions that these are all real so that an expression like -H Wges+(I cn[0,0,im]+cn[0,0,re])/[Tau]==0 will be correktly solved to {cn[0,0,im] -> 0, cn[0,0,re]->[Tau] H Wges} (also assuming that [Tau], H, Wges are real) I am not sure how to achieve that. Indeed I have another condition for the coefficients: K[p,l][[omega]]=K[p,-l]][-[omega]] In this case, I have completely no idea how to model this in Mathematica. Can anybody give me a hint (on the problem or on literature) how to solve this problem? Kay-Michael Voit === Subject: Re: Solving algebraic equations with some conditions > So I have a system of up to 55 algebraic equations (Not every Exp[I (p k > x + l [Omega] t)] occures after inserting the ansatz, thus some will be > trivial) for the 55 Fourier coefficient. The equations are not linear, Sorry, there are obviously only 21 Fourier coefficients to calculate according to the ansatz. I messed it up. === Subject: Re: eliminate values while caculating Mean[data] data = {1, 2, 3, 4, 5, 0, 0, 0}; {Mean[data] , Mean[data /. 0 :> Sequence[]]} ?? Jens An easy question: > I would like to make an average of a data file.I know that we can use > Mean function for this. However, I want to eliminate some values from my data.For example if I have data={1,2,3,4,5,0,0,0} > Mean[data] would be 15/8 I do not want the zero values in my Mean function (i.e.I want the mean > value to be 3 in the above example) How can I do this? Best, > Pasha === Subject: Re: eliminate values while caculating Mean[data] > Hello Pasha, > I would generally recommend you to write your own functions, it's more > customizable:) The name of your set of data is Data and looks like in your post, > say: Data={1,2,3,4,5}; Value of Summ gives you a sum of all non-zero > elements in Data and NonZeroValuesCounter gives you a number of > non-zero entries in Data. Average is what you want. Just paste the > script below into Mathematica and run: Summ = 0; NonZeroValuesCounter = 0; > For[index = 1, index <= Length[Data], index += 1, > If[Data[[index]] != 0, Summ += Data[[index]]; > NonZeroValuesCounter += 1]; > ]; > Average = Summ/NonZeroValuesCounter; > Print[Summ: , Summ, > NonZeroValuesCounter: , NonZeroValuesCounter, > Average: , Average] Even if you insist in doing things that way, you can do them more Mathematica-ly: For example, myMean[ll_] := Module[{n = 0, s = 0}, Scan[If[# > 0, s += #; n += 1] &, ll]; s/n ]; -- m === Subject: Re: eliminate values while caculating Mean[data] try Mean[Select[data, ! PossibleZeroQ[#] &]] Best, Markus === Subject: Re: eliminate values while caculating Mean[data] Hi Do some list opetations: Mean[DeleteCases[data, 0]] By this 0 is taken away when you make the average. gyzhou === Subject: Re: eliminate values while caculating Mean[data] An easy question: > I would like to make an average of a data file.I know that we can use > Mean function for this. However, I want to eliminate some values from my data.For example if I have data={1,2,3,4,5,0,0,0} > Mean[data] would be 15/8 I do not want the zero values in my Mean function (i.e.I want the mean > value to be 3 in the above example) How can I do this? Best, > Pasha > Mean[DeleteCases[data,0]] Gruss Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de === Subject: Re: Regressions in Mathematica Needs[LinearRegression`] tdata = Append[#, Times @@ #] & /@ Table[RandomReal[], {10}, {2}]; Regress[tdata, {1, x, y, x*y}, {x, y}] ?? Jens > Hello everyone, I'm having trouble understanding the syntax of the Regress command. > If data is an nx2 matrix where the first column is the explanatory > variable and the second is the dependent variable, then either Regress[data, {1, x}, x] or Regress[data, x, x] performs a standard regression of the second column on the first with > a constant thrown in. But how do I write the command for the case of > more than one explanatory variable? Say that my data matrix is now > nx3, so that the first two columns are the explanatory variables and > the last is the dependent variable. Regress[data, {x,x}, x] or Regress[data, {1, x,x}, x] gives the error > message Number of coordinates (2) is not equal to the number of > variables (1). I'm not sure how I'm supposed to identify each > explanatory variable. > Gregory > === Subject: Graphics Issue MacBook Pro & Mathematica 6.0.1.0 I'm running Mathematica 6.0.1.0 on a MacBook Pro (Intel processor) and OS 10.4.11. I am unable to get it to display graphics, e.g., Plot[]. When I load it on a G5 Mac same OS, everything works fine. Has anyone experienced this issue? === Subject: shooting method Using a shooting method, I would like to find the smallest eigenvalue of -y''[x] + 400((1/x)^12 - (1/x)^6) y[x] == E0*y[x] (the quantum-mechanical steady state energy of an anharmonic oscillator with Lennard-Jones potential) with the boundary conditions : y[A]==0 y[B]==0 with A<<1 and B >> 1 Can anyone help about how to implement it ? Luca === Subject: Re: shooting method Hi Luca, there lurk some numerical problems. First note that the equation is homogeneous, the function is only determined up to a constant factor. We may therefore choose the starting slope as we please. As the Potential goes to infinity near zero the function becomes very small there. It is therefore numerical difficult to start the integration there. It is much less problematic to start the integration at the node and integrate towards zero. We therefore set fun[B]==0 and arbitrarily fun'[B]==1. And we take care not to set A too far inside the classical forbidden region, because this is calling for troubles. Here is an example: A=3/4;B=3/2; slope=-1; fun0[E0_]:=Module[{y,x,eq}, eq={-y''[x]+400((1/x)^12-(1/x)^6) y[x]-E0*y[x] ==0, y[B]==0,y' [B]==slope}; y/.NDSolve[eq,y,{x,A,B}][[1]]] fun[E0_?NumericQ]:=fun0[E0][A]; res=FindRoot[fun[E0],{E0,-50}] fun[E0]/.res Plot[fun0[E0/.res][x],{x,A,B}] hope this helps, Daniel Using a shooting method, I would like to find the smallest eigenvalue of -y''[x] + 400((1/x)^12 - (1/x)^6) y[x] == E0*y[x] (the quantum-mechanical steady state energy of an anharmonic oscillator with Lennard-Jones potential) > with the boundary conditions : > y[A]==0 > y[B]==0 > with A<<1 and B >> 1 > Can anyone help about how to implement it ? > Luca > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail: Internet: === Subject: Re: Debugger Hi David, I used your M-Debug for a while with Mathematica 5.x and it was a real pleasure. Easy and well documented. Unfortunately it does not seem to work any longer in Mathematica 6.0 (I tried a couple of times). Would it be possible for you to update it and make it usable with the 6th generation ? I think many Mathematica users would appreciate it. === Subject: integration - Interpolating Function I have two different problems concerning Mathematica: First: to calculate a characteristic function [CurlyPhi][u_] for each u I have to evaluate a solution of a system of ordinary differential equations depending on u: solution[u_] := NDSolve[ {z1'[t] == -[Kappa] [Theta]y y1[ t] - (ly [Mu] (y1[ t] - [Mu] y1[t]^2 - [Mu] y2[t]^2))/((1 - [Mu] y1[ t])^2 + [Mu]^2 y2[t]^2), z2'[t] == -[Kappa] [Theta]y y2[ t] - (ly [Mu] y2[ t])/((1 - [Mu] y1[t])^2 + [Mu]^2 y2[t]^2), y1'[t] == [Kappa] y1[t] - ([Sigma]^2)/2 (y1[t]^2 - y2[t]^2), y2'[t] == [Kappa] y2[t] - [Sigma]^2 y1[t] y2[t] - u, z1[T] == 0, z2[T] == 0, y1[T] == 0, y2[T] == 0}, {z1, z2, y1, y2}, {t, 0, T}] a1[u_] := z1[0] /. solution[u][[1, 1]] a2[u_] := z2[0] /. solution[u][[1, 2]] b1[u_] := y1[0] /. solution[u][[1, 3]] b2[u_] := y2[0] /. solution[u][[1, 4]] [CurlyPhi][u_] := E^(a1[u] + I a2[u] + b1[u] + I b2[u] x0) as a result I get a set of Interpolating Functions, so I can evaluate the characteristic functions in specific points u. Next I have to integrate over this characteristic function: Needs[FourierSeries`]; f[z_]:=NInverseFourierTransform[[CurlyPhi][u_] , u,z,FourierParameters=84_{1,1}] but Mathematica cannot solve this problem. Does anybody know an answer or a way to fix this problem? Second: Can anybody give me advice, how to implement efficiently a recursion, that depends on two variables? (Does Mathematica have another function besides RSolve which solves this kind of problems?) I would be really grateful if someone could help me. Marion === Subject: Using Mathematica with GSL Any there any glue libraries available that implements Glue code, to evaluate C expressions exported by the Mathematica Splice command, in terms of functions provided by the GNU Scientific library (GSL). === Subject: How to separate a sum into terms Hi! I want to separate a Mathematica expression written as a sum into separate terms E.g. for a+b-c+f[1]-g[a]/g[b] I want to get a list {a,b,-c,f[1],-g[a]/g[b]} Is there a simple way to do this? -- Vyacheslav Rychkov https://mail.sns.it/~rychkov Scuola Normale Superiore Tel: +39-050-509068 (office) Classe di Scienze +39-050-3820086 (home) Piazza dei Cavalieri, 7 +39-3403925168 (mobile) 56100 Pisa Fax: +39-050-509045 Italy E-mail: Rychkov@sns.it === Subject: Out[xx] included when saving figures? I recently upgraded to Mathematica v.6, and am encountering a problem. In the session, if I click on the sidebar of a figure generated by GraphicsGrid, and choose save selection as from the menu, then the Out[xx]= in front of the figure is also saved. If instead I click on the figure directly, the save selection as option is grayed out. Is there anyway I could save the figure without being bothered by this Out[xx]=? If I quite the session and restart Mathematica, without doing any cell calculations, then there is not any Out[xx]= (and In[xx]=) so I could save the figure without the need of any post-processing. JT === Subject: Re: Functional programming? > I feel there is another thing to say regarding FP. The fact that FP > performs so well in Mathematica is, in my opinion, something of a > fluke. > The real reason is that because Mathematica is such a high level > language, absolutely every step incurs considerable overhead, that is > not present in languages such as Fortran or Java. Because FP > provides a > way to do a lot in one step, it reduces this overhead. I don't think it is a fluke, but simply a consequence of the fact that Mathematica is or originated as a Computer Algebra System, and there is no doubt that functional programming is the most efficient and natural way to program in a CAS. I don't think there is any point even arguing about this so I just note that the first (at least I think it is the first) genuine CAS system did not even have its own programing language but used LISP (the paradigm of all functional languages), and one of Mathematica's main rivals, which uses a procedural programming language (in my opinion a pretty awful one), had functional constructs belatedly added to it. Andrzej Kozlowski === Subject: Re: Functional programming? I found this excellent resource by Jose Gomez-Munoz below: Peter ---------- Forwarded message ---------- === A small tutorial for going from procedural to functional programming in Mathematica: http://homepage.cem.itesm.mx/lgomez/matecmatica/funcionalprog.nb Here is an html version http://homepage.cem.itesm.mx/lgomez/matecmatica/fp/fp.html I hope is useful Jose Mexico 2008/9/13 AES : > I suggest it might be instructive if some of the functional programming > proponents on this group could provide us DO-looping old timers with a > brief summary or tutorial as to what is really meant by, or involved in, > functional programming? --- especially as this concept might relate to building programs to do > calculations involving multi-stage real-world engineering or technical > problems --- and especially as it might relate to programs that are going to be > developed in an evolutionary process and that in the end, rather than > being built into some long-term library, are maybe only going to be run > or executed a few times before the person involved (e.g., an engineer, > or scientist, or other real-world individual, not a programmer) moves > on to some other totally different task or assignment. -- === Subject: Re: Functional programming? > as an old-timer myself - I'd be very interested in this too, > particularly - as you say - with reference to engineering problems. > I'm afraid my favorite construct was the REPEAT - UNTIL loop, which > should finally ruin any shreds of credibility that I may once have > had... I think it is possible to frighten people off with functional programming. It is true that simple examples of FP can be much shorter than their procedural equivalent, and will almost certainly run much faster, but FP can become very messy for some real world problems, and procedural programming offers a way to 'hack' almost anything. I am tempted to give an example of something that is hard to do by FP, but someone will, of course, provide an answer - but that is not the point, the point is whether users with limited experience of Mathematica would be able to come up with such a solution. There are quite a few While loops in my Super Widget Package! I feel there is another thing to say regarding FP. The fact that FP performs so well in Mathematica is, in my opinion, something of a fluke. The real reason is that because Mathematica is such a high level language, absolutely every step incurs considerable overhead, that is not present in languages such as Fortran or Java. Because FP provides a way to do a lot in one step, it reduces this overhead. Thus, for example, whole array operations (which are somewhat analogous to FP) in Fortran perform little if any better than explicit DO-loops, and re-coding a Fortran application to use whole array operations may reduce its performance because the cache utilisation can suffer. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Functional programming? > as an old-timer myself - I'd be very interested in this too, > particularly - as you say - with reference to engineering problems. > I'm afraid my favorite construct was the REPEAT - UNTIL loop, which > should finally ruin any shreds of credibility that I may once have > had... > Peter 2008/9/13 AES : >> I suggest it might be instructive if some of the functional programming >> proponents on this group could provide us DO-looping old timers with a >> brief summary or tutorial as to what is really meant by, or involved in, >> functional programming? >> --- especially as this concept might relate to building programs to do >> calculations involving multi-stage real-world engineering or technical >> problems >> --- and especially as it might relate to programs that are going to be >> developed in an evolutionary process and that in the end, rather than >> being built into some long-term library, are maybe only going to be run >> or executed a few times before the person involved (e.g., an engineer, >> or scientist, or other real-world individual, not a programmer) moves >> on to some other totally different task or assignment. Say we want to compute the mean (average) of all non-zero values for each row of a two dimensional array. The code must not crash when fed with data of incorrect format as well as it must handle nicely such things like divisions by zero. (* Functional / Pattern matching code *) myMean2[array_?VectorQ] := Mean[Select[array, # != 0 &]] myMean2[array_?MatrixQ] := Map[myMean2, array] (* Procedural code *) myMean1[array_] := Module[{iter, len, cnt, sum, mean}, sum = 0; mean = 0; cnt = 0; len = Length[array]; If[len != 0, For[iter = 1, iter <= len, iter = iter + 1, If[array[[iter]] != 0, sum = sum + array[[iter]]; cnt = cnt + 1]; ]; If[cnt != 0, mean = sum/cnt; , mean = NA; ]; , mean = NA; ]; Return[mean] ] meanArray[array_] := Module[{res, len, dim}, res = {}; len = Length[array]; dim = Depth[array] - 1; If[dim != 2, Return[NA]]; For[iter = 1, iter <= len, iter = iter + 1, AppendTo[res, myMean1[array[[iter]]] ]; ]; Return[res] ] (* Some data and some tests *) data = {{}, {1, 2, 3, 4, 5, 0, 0, 0}, {0, 0, 0}, {1, 2, -10, 3, 4}, {a, b, c}}; meanArray[{1, 2, 3, 4, 5, 0, 0, 0}] meanArray[{{1, 2, 3, 4, 5, 0, 0, 0}}] meanArray[data] meanArray[{{{1, 2, 3, 4}, {5, 0, 0, 0}}}] (* Out[6]= NA Out[7]= {3} Out[8]= {NA, 3, NA, 0, NA} Out[9]= NA *) myMean2[{1, 2, 3, 4, 5, 0, 0, 0}] myMean2[{{1, 2, 3, 4, 5, 0, 0, 0}}] Map[myMean2, data] Map[myMean2, {{{1, 2, 3, 4}, {5, 0, 0, 0}}}] (* Out[10]= 3 Out[11]= {3} Out[12]= {Mean[{}], 3, Mean[{}], 0, Mean[{}]} Out[13]= {{5/2, 5}} *) -- Jean-Marc === Subject: Re: Functional programming? > >> as an old-timer myself - I'd be very interested in this too, >> particularly - as you say - with reference to engineering problems. >> I'm afraid my favorite construct was the REPEAT - UNTIL loop, which >> should finally ruin any shreds of credibility that I may once have >> had... >> Peter >> 2008/9/13 AES : > I suggest it might be instructive if some of the functional programming > proponents on this group could provide us DO-looping old timers with a > brief summary or tutorial as to what is really meant by, or involved in, > functional programming? >> --- especially as this concept might relate to building programs to do > calculations involving multi-stage real-world engineering or technical > problems >> --- and especially as it might relate to programs that are going to be > developed in an evolutionary process and that in the end, rather than > being built into some long-term library, are maybe only going to be run > or executed a few times before the person involved (e.g., an engineer, > or scientist, or other real-world individual, not a programmer) moves > on to some other totally different task or assignment. > Say we want to compute the mean (average) of all non-zero values for > each row of a two dimensional array. The code must not crash when fed > with data of incorrect format as well as it must handle nicely such > things like divisions by zero. (* Functional / Pattern matching code *) myMean2[array_?VectorQ] := Mean[Select[array, # != 0 &]] > myMean2[array_?MatrixQ] := Map[myMean2, array] > (* Procedural code *) myMean1[array_] := > Module[{iter, len, cnt, sum, mean}, > sum = 0; > mean = 0; > cnt = 0; > len = Length[array]; > If[len != 0, > For[iter = 1, iter <= len, iter = iter + 1, > If[array[[iter]] != 0, sum = sum + array[[iter]]; cnt = cnt + 1]; > ]; > If[cnt != 0, > mean = sum/cnt; > , mean = NA; > ]; > , mean = NA; > ]; > Return[mean] > ] meanArray[array_] := > Module[{res, len, dim}, > res = {}; > len = Length[array]; > dim = Depth[array] - 1; > If[dim != 2, > Return[NA]]; > For[iter = 1, iter <= len, iter = iter + 1, > AppendTo[res, myMean1[array[[iter]]] > ]; > ]; > Return[res] > ] > (* Some data and some tests *) data = {{}, {1, 2, 3, 4, 5, 0, 0, 0}, {0, 0, 0}, {1, 2, -10, > 3, 4}, {a, b, c}}; meanArray[{1, 2, 3, 4, 5, 0, 0, 0}] > meanArray[{{1, 2, 3, 4, 5, 0, 0, 0}}] > meanArray[data] > meanArray[{{{1, 2, 3, 4}, {5, 0, 0, 0}}}] (* > Out[6]= NA Out[7]= {3} Out[8]= {NA, 3, NA, 0, NA} Out[9]= NA > *) myMean2[{1, 2, 3, 4, 5, 0, 0, 0}] > myMean2[{{1, 2, 3, 4, 5, 0, 0, 0}}] > Map[myMean2, data] > Map[myMean2, {{{1, 2, 3, 4}, {5, 0, 0, 0}}}] (* > Out[10]= 3 Out[11]= {3} Out[12]= {Mean[{}], 3, Mean[{}], 0, Mean[{}]} Out[13]= {{5/2, 5}} > *) I think you have chosen a rather favourable example here. Suppose instead that you need to remove every zero together with the preceding element (sweeping from left to right). Realistically, you also probably want to do something, rather than output Mean[{}] for myMean2[{0,0,0}]. I would say that users should not be scared away from using procedural code when faced with ad hoc problems of this sort. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: bug... GraphicsGrid ItemAspectRatio Spacings FYI for poor souls that might encounter that same problem i just did. if you use ItemAspectRatio option for GraphicsGrid, you also need to specify the Spacings option. GraphicsGrid[{{foo}, {Graphics@Rectangle[]}}, Frame -> All, ItemAspectRatio -> {.1, 1}] gives errors ... Coordinate {189., {-19.2, -19.2}} should be a pair of numbers, or a Scaled or Offset form. Coordinate {360., {35.99999999999999, 14.399999999999999`}} should be a pair of numbers, or a Scaled or Offset form. Coordinate {189., {-230.4, -230.39999