Subject: Differentiate of Abs[x] ??? If I have a complex-valued funciton Z=Z(x1,x2,y) where x1,x2,y are all real varables. Now I demand that |Z|^2 are local minimums at y=y1 and y=y2 with some choices of x1 and x2. (where |...| denotes absolute value.) My idea is that, I differentiate |Z|^2 w.r.t y, then subtitute y1 and y2 into this equation and demand each equation 0; finally solve the two simultaneous equations. But I found a big problem that Mathematica can't approach the differentiation of absolute values? Another question, is my method right? and is the differentiation of absolute value very hard to approach mathematically? === Subject: Re : NIntegrate a list Hello Aaron, Don't mix up x and theta ! If you want to use NIntegrate, just use Evaluate : In[9]:= Integrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}] Out[9]= {2*Pi, 4*Pi} In[12]:= NIntegrate[Evaluate[x*Sin[x]*{1,2}],{x,-Pi,Pi}] Out[12]= {6.28319,12.5664} F.Jaccard -----Message d'origine----- DeÊ: Aaron Fude [mailto:aaronfude@yahoo.com] ËÊ: mathgroup@smc.vnet.net ObjetÊ: NIntegrate a list I can Integrate this, but apparently not NIntegrate this: Integrate[x*Sin[x]*{1, 2}, {theta, -Pi, Pi}] but not NIntegrate[x*Sin[x]*{1, 2}, {theta, -Pi, Pi}] Is there a good way to do this (w/o writing loops)? Aaron Fude === Subject: creating exact numbers, strange behavior I try to convert machine number into an exact number. I do this the following way: In[] = Quotient[7.*10^30,10^30] Out[] = 7 that is fine. In[] = Quotient[7.*10^99, 10^99] Out[] = 7 still fine. In[] = Quotient[7.*10^100,10^100] Out[] = 6 ????????, I think that is bad. Or am I doing something wrong? -- PD Dr. Matthias Gottschalk GeoForschungsZentrum Projektbereich 4.1 Telegrafenberg 14473 Potsdam Germany tel/fax +49 (0) 331 288-1418/1402 === Subject: Re: please solve Bob, I suggest you look at the formulations for Savitsky-Golay filtering, they should get you there in a nice systematic way, ie you will be able to extend if you wish. Perhaps searching for links more usually associated with signal & image processing might help. Bob I really prefer my full name: Robert === Subject: Re: simply problem (not for me) about axes scale Set the PlotRange and the AspectRatio Off[General::spell1]; xmin=0; xmax=3; ymin=-1/2; ymax=4; Plot[(3x-4)(x-2),{x,0,3}, Bob Hanlon === === Subject: Re: Integrate in version 5.1 The G5 does NOT have the same processor as the G4 :) So it is NOT just the speed. J\.87nos ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice) === Subject: Using NMinimize to solve a system of equations I am trying to use NMinimize to solve a system of equations, but I have been \ plagued with OverFlow, Underflow and division by zero problems when I change \ my F, L and WorkingPrecision. Is there any other method in Mathematica to \ get reliable solutions to my equations ? In[43]:= f[F_, L_] := E^(-((F/a)^b/b)) - E^(-((L/a)^b/b)); NMinimize[{0, f[100, 1000]/f[1000, 2613.01757776] == 2768.91499137093/3351.95653836949 && f[1000, 2613.01757776]/f[5000, 10000] == 3351.95653836949/1680 && f[100, 1000]/f[5000, 10000] == 2768.91499137093/ 1680 && 0. < b < 1. && 10^(-16) < a < 10^11}, Danielle ********************************************************************** Ce message est exclusivement destin\.8e aux personnes dont le nom figure ci-dessus. Il peut contenir des informations confidentielles dont la divulgation est \.88 ce titre rigoureusement interdite. Dans l'hypoth\.8fse o\.9d vous auriez re\.8du ce message par erreur, merci de le renvoyer \.88 l'adresse e-mail ci-dessus. This message is Intended for the above-mentioned addressees only. It may contain confidential information the review, dissemination or disclosure of which is strictly prohibited. Should you receive this message in error, please return it to the e-mail address indicated above. ********************************************************************** === Subject: An argument pattern problem: ranges and lists I am trying to use argument patterns to ensure that my function is only applied onto arguments which have the format pauli [_, _] where the second argument should be an integer between 0 and 4. So I defined a type and declared my function as follows: f [p:pauliT] := DoSomething This works fine, but another function takes a pair of arguments g [p:{pauliT,pauliT}] := DoSomethingElse This is never called, because the pattern cannot be matched. I observed: MatchQ[{pauli[1, 2], pauli[1, 3]}, {pauliT, pauliT}] The problem seems to be that I named the second argument 's', because if I delete this name, it matches: pauliT = HoldPattern [pauli [_, s_Integer]]; MatchQ[{pauli[1, 2], pauli[1, 3]}, {pauliT, pauliT}] pauliT = HoldPattern [pauli [_, _Integer]]; MatchQ[{pauli[1, 2], pauli[1, 3]}, {pauliT, pauliT}] So, how do I specify the range condition correctly? Simon === Subject: Re: slow eigenvectors and eigenvalues The eigenvectors of a Toeplitz matrix (a very large one, so that the edge effects can be ignored) is made up of sine waves. This is because the left hand side of the eigenequation T.x=a x is a convolution, so if you transform \ to Fourier space it is a multiplication (i.e. the convolution theorem), which is a diagonal operation whose eigenvectors are the individual Fourier \ components. Steve Luttrell === Subject: Aliases Using another algebra program I can avoid the input and output of all the arguments of a general function by running Then \h1\ is used in place of \h1(x,X,t,T)\ in both input and output. Is there an analogous command for hiding function arguments in Mathematica? I'm using several arbitrary functions of four variables and some of the output is virtually unreadable due to all the occurences of \[x,X,t,T]\. Please help. === Subject: Re: simply problem (not for me) about axes scale That makes the same scale on both axes so that circles truly come out as circles. you the same scale on each axis. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Hi all I've a problem. I cannot find in the master index which is the built-in function that allow me to plot a curve with the same scale on the Y and X axes. I mean... I want the same subdivisions length on the X and Y axes on a 2D plot! === Subject: Re: simply problem (not for me) about axes scale You can control a lot of things in a plot. A little patience on your part will be needed, though, in order to fully understand how to go about it. Try \ this, for example, In[1]:= {Table[j, {j, -4, 4, 1}], Table[j, Tomas Garza Mexico City ----- Original Message ----- === Subject: simply problem (not for me) about axes scale === Subject: Re: simply problem (not for me) about axes scale The default value of that option is 1/GoldenRatio (which gives allegedly pleasing relative axis lengths). To learn how to do such things, you should consult the Mathematica Book in print or as part of the electronic Help system that is by default installed with Mathematica. (Such options for Plot are discussed in subsection 1.9.2.) The general principle is that modifications to default behavior of a function are typically provided by options, and you can discover all the options for a function by using the Options function, which also shows the default value for each option. Thus: Options[Plot] -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 === Subject: Re : simply problem (not for me) about axes scale Use : Meilleures salutations F.Jaccard -----Message d'origine----- DeÊ: Alessandro M. [mailto:mazuego@virgilio.it] ËÊ: mathgroup@smc.vnet.net ObjetÊ: simply problem (not for me) about axes scale Hi all I've a problem. I cannot find in the master index which is the built-in function that allow me to plot a curve with the same scale on the Y and X axes. I mean... I want the same subdivisions length on the X and Y axes on a 2D plot! === Subject: Re: NIntegrate a list I'm not sure why you want to integrate functions of x with respect to theta, \ but it's easily done symbolically: Integrate[x*Sin[x]*{1, 2}, {theta, -Pi, Pi}] {2*Pi*x*Sin[x], 4*Pi*x*Sin[x]} The same thing with NIntegrate doesn't work because NIntegrate needs an \ integrand that resolves to NUMBERS. If we change theta to x, these work: Integrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}] NIntegrate[x*Sin[x]*{1, 2}//Evaluate, {x, -Pi, Pi}] but this doesn't: NIntegrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}] Bobby -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: NIntegrate a list Aaron, First, I assume, you meant x instead of theta: NIntegrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}] Now, you can, of course, put N[_] around it: N[Integrate[x*Sin[x]*{1, 2}, {x, -Pi, Pi}]] But this might try to do it first analytically, which you do not want. So, use Map: Map [NIntegrate[x*Sin[x]*#, {x, -Pi, Pi}] &, {1, 2}] (In case, you are not too experienced, let me explain: I have written the left argument to 'Map' as \pure function\, i.e. a function where the parameters are referred to not by name but by position, i.e. we write '#1', '#2', '#3' etc. for them, or here, just '#', which is short for '#1', the one and only parameter of the function. The '&' at the end marks the construct before it as pure fucntion. And 'Map' takes the elements of the second parameter, the list, and puts them into the position maked with the '#'. This is, by the way, precisely, what Mathemtica does automatically in the first case (Integrate without N).) HTH, Simon === Subject: Re: NIntegrate a list It's not clear what you are trying to do. The first expression is equivalent to x Sin[x] {1,2} Integrate[1,{theta,-Pi,Pi}] is that really what you meant? Or did you mean Integrate[theta Sin[theta] {1,2},{theta,-Pi,Pi}]? Anyway x Sin[x] is not a numeric expression and NIntegrate works only on numeric expressions. Ssezi === Subject: Re: NIntegrate a list x is not numeric if the variable of integration is theta. Further, you need \ to use Evaluate. Presumably, you meant Integrate[x*Sin[x]*{1,2},{x,-Pi,Pi}] {2*Pi, 4*Pi} NIntegrate[Evaluate[x*Sin[x]*{1,2}],{x,-Pi,Pi}] {6.283185307179588, 12.566370614359176} Bob Hanlon === === Subject: Re: Apart's loss of functionality in 5.1 Try the \Copy as InputForm\ palette: http://eclecticdreams.net/DrBob/copy_as_inputform.htm Bobby -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Mathematica language issues Yikes again!! It's a wonder we get anywhere at all! But we do, so your examples must be perverse in some way. Bobby -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Mathematica language issues Compile[{}, Module[{x = 0}, x++; While[EvenQ[x]]; x]][] x++; EvenQ[x] is CompoundExpression[ x++, EvenQ[ x ] ] While[ test ] needs a test not a CompoundExpression [ ... ] Consider: and but you must: and you should: Out[4]= {{{{{1}}}}} look at the evaluation order. In[5]:= Unevaluated[ 1 + 1 ]*2 // Trace Out[5]= {(1 + 1) 2, 2 (1 + 1), {1 + 1, 2}, 2 2, 4} and In[6]:= 2 * Unevaluated[ 1 + 1 ] // Trace Out[6]= {2 (1 + 1), 2 Unevaluated[1 + 1]} In the first case Unevaluated[ 1 + 1 ] is seen _twice_ by the evaluator. And since Unevaluated[ expr ] give expr unevaluated as an argument to Times and Times reorders its arguments it is seen twice. FullForm[ Unevaluated[ Unevaluated[ 1 + 1 ]*2 ] ] Unevaluated[Times[Unevaluated[Plus[1, 1]], 2]] Hope that helps, Oliver Phone: ++49 +761 203 7385 === Subject: Re: Mathematica language issues This is not a glitch but works exactly as one woudl expect. You can see the difference and the reason by looking at Trace in both cases (although there is no need for that, if you understand Unevaluated you can see it right away). First: 2*Unevaluated[1+1]//Trace {2 (1+1),2 Unevaluated[1+1]} First Unevaluated is stipped away and Mathematica attempts ot evaluate 2*(1+1). Since it knows no rule to apply and the expression has not changed Unevaluated is restored and evaluation is completed with the output you see. Unevaluated[1+1]*2//Trace {(1+1) 2,2 (1+1),{1+1,2},2 2,4} As before, first Unevaluated is stripped away and Mathematica tires to evaluate 2*(1+1). It now knows a rule to apply, which is given by the Orderless attribute and the canonical ordering, so it converts the expression into the form 2 (1+1). But now Unevaluated is not restored because the expression has changed so evaluation continues with 1+1 evaluationg to 2 and finally you obtain 4. Now, I have honstly considered this case only because I could see at once what what was going on. I do not knwo if any of the others are glitches but jusdging by my experience with the past \language glitches\ you have reported (unlike the more serious problems desribed in your last posting) I rather doubt it. However I have no time to spend on this just to prove a point (again). Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ === Subject: Re: Mathematica slows down Does it matter? If we know why Prime is faster in some ranges than others, \ what can we do about it? Still, if you want to speed things up, it's easy to do so. Here's timing for a code similar to yours: NumP=15000; Timing@For[k=1,k