A101 === Subject: Re: Change integral variables > In Mathematica, how can I change integral variables? For example in > integration: Integrate[Sin[Sqrt[x]], x] if I want to use t^2=x to instead x in the > integral, how can I achieve this? PS: Does Mathematica have a inertial form of some symbolic command, > for instance, the above integration, if I only want an integration > form but not an answer, what can I do? I don't know of any inertial form to do this, but there are two possiblities: In= f[x_] := Sin[Sqrt[x]]; Integrate[f[x], x] ii = f[x] dx tRule = {x -> t^2, dx -> 2 t} it = Simplify[(ii /. tRule), t >= 0] Out= ... 2 dt Sin[t] The other possibility is David Park's Presentations package, which includes a StudentsIntegral. You would write then: i1=integrate[Sin[Sqrt[x]],x] it=i1//ChangeIntegralVariable[t->Sqrt[x],x, DirectSubstitution->{x->t^2}] to get the output (I write it in LaTeX notation): int Sin[x] dx Gruss Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de === Subject: Re: Common Multiple Value Question Hi Lea, I am not sure if I understand you correctly. You have two integer sequences, e.g. {a1,a2,a3} and {b1,b2,b3} and you want a sequence {c1,c2,c3} so that ai and bi divide ci, ci need not be the LCM and c1:c2:c3 == a1:a2:a3. This can be done by noting that a possible CM is simply the product. We then only have to deal with c1:c2:c3 == a1:a2:a3. This can be achieved by mutiplying a1 by b2 b3, a2 by b3 b1 .. This finally gives {a1,a2,a3} b1 b2 b3: In mathematica this may be written by: lista={a1,a2,a3}; listb={b1,b2,b3}; listc= lista Times@@ listb For rational number you must first define what a multiple of a number is. For every rational r1 besides zero there is another one r2 so that the product is a given r3. That is every number is a multiple of every number (besides zero). hope this the not right answer to the wrong question, Daniel I am trying to solve this Common Multiple Value Question based on 2 > sequences of values... > This is both a Math question & also a question on how to apply this problem > to Mathematica. > However, please note I am trying to find BOTH Common Multiple Value, of each > element in both lists AND maintaining the same proportion in the first list > of elements. I will pose this problem in 2 ways. > (i) Fractional sequence of values. > (ii) Numerical sequence of values. > Actually they are the same question, but I would like to be able to solve > this in both the fractional & numerical form. > (... And also solving this without using LCM - Lowest Common Multiple > function .... as this is part of a bigger calculation & I will be using > algebra.) (i) Fractional sequence of values - 1 pair. 3 elements in each. > list1={2/3,2/3+1,2/3+2} > list2={3/4,3/4+1,3/4+2} > {2/3,5/3,8/3} > {3/4,7/4,11/4} (ii) Numerical sequence of values - 1 pair. 3 elements in each. > list3={2,5,8} > list4={3,7,11} > {2,5,8} > {3,7,11} ( Apologies if this question is so simple... I have been trying to figure > this out for a number of days ...) > === Subject: How to open a Package What is the syntax of opening a package: < What is the syntax of opening a package: < http://reference.wolfram.com/mathematica/ref/$Path.html === Subject: Re: How to open a Package > What is the syntax of opening a package: < What is the syntax of opening a package: < What is your question? albert === Subject: Re: how to use ones(A)? the syntax is all wrong. What should [..] be? Perhaps you mean {1,2,3} What is ones? Function arguments are [..] not (..) Daniel > v=[1 2 3];a=ones(v) > the result is: > a(:,:,1) = 1 1 > a(:,:,2) = 1 1 > a(:,:,3) = 1 1 > why do it has the above three vectors?What do they mean? > === Subject: Re: how to use ones(A)? What do you wish to do? > v=[1 2 3];a=ones(v) > the result is: > a(:,:,1) = === Subject: Re: how to use ones(A)? > What do you wish to do? > v=[1 2 3];a=ones(v) >> the result is: >> a(:,:,1) = > Are you sure you are using Mathematica? David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Coordinate readout from Graphics3D? try selecting the ViewPoint option in the inspector and clicking the graphics itself. The Option Inspector should then show e.g. something like: NCache[{Pi, Rational[1, 2] Pi, 6}, {3.141592653589793, 1.5707963267948966`, 6}] giving you the accurate view point. hope this helps, Daniel >> I thought I saw somewhere that one could read out coordinates from a >> Graphics plot, according to the mouse position. I can't find it now, >> and I don't see how it would work with Graphics3D. But anything would >> Steve Gray So I have a simpler question. I know I can see the options that are set for a particular 3D object > typing Options[ ] around the object. This is particularly useful > when I have rotated the object with the mouse. But when I right click on the object and then use the object > inspector (ctrl-shift-o) and then choose Formatting, Expression > Formatting, Graphics3D Box Options, a change viewpoint (which has > lots of decimal places) is not completely visible.. Typing Options > when can use the mouse seems clunky, but not if you cannot view the > entire set of options. Any ideas? > === Subject: Re: Coordinate readout from Graphics3D? On Apr 28, 10:40 am, ahallam@iastate.edu So I have a simpler question. I know I can see the options that are set for a particular 3D object > typing Options[ ] around the object. This is particularly useful > when I have rotated the object with the mouse. But when I right click on the object and then use the object > inspector (ctrl-shift-o) and then choose Formatting, Expression > Formatting, Graphics3D Box Options, a change viewpoint (which has > lots of decimal places) is not completely visible.. Typing Options > when can use the mouse seems clunky, but not if you cannot view the > entire set of options. Any ideas? If I understand correctly, you would like to be able to copy the value of the ViewPoint option with as little typing as possible. You could try using one of the ViewPoint selectors posted in this thread: http://tinyurl.com/6n3862 Szabolcs === Subject: Re: Cropping a surface to a sphere (fun Manipulate example) This is nice Craig, but unfortunately ContourPlot3D is not the fastest of routines. So, on my machine at least, the response is quite slow. But, looking at the plot, there is obvious symmetry. There appears to be only one fundamental surface which is present in 12 copies. So would it be possible to use Reduce to obtain a parametrization of one of the surfaces and use rotation/reflection geometric transformations to generate all the other surfaces? This might then be much faster. For those who are experts in group theory, how would one start with the polynomial and then generate the set of transformations to create all the surfaces? I put this forward as a challenge problem for those who might care to take it up. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > HellO Szabolcs, > I liked your surface so much, I thought I might share this fun Manipulate: sphere[ls_] := Function[{x, y, z}, x^2 + y^2 + z^2 < ls^2] Manipulate[ > ContourPlot3D[-x^4*y^2 + x^2*y^4 + x^4*z^2 - y^4*z^2 - x^2*z^4 + > y^2*z^4 == ls, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, > RegionFunction -> sphere[3]], {{ls, 0}, 0, 1/2}] -- > W. Craig Carter > === Subject: Re: Cropping a surface to a sphere (fun Manipulate example) > This is nice Craig, but unfortunately ContourPlot3D is not the fastest of > routines. So, on my machine at least, the response is quite slow. But, looking at the plot, there is obvious symmetry. There appears to be > only one fundamental surface which is present in 12 copies. So would it be > possible to use Reduce to obtain a parametrization of one of the surfaces > and use rotation/reflection geometric transformations to generate all the > other surfaces? This might then be much faster. For those who are experts in > group theory, how would one start with the polynomial and then generate the > set of transformations to create all the surfaces? I put this forward as a challenge problem for those who might care to take > it up. > I don't think that it is possible to construct a formula that represents only one of the 12 surfaces because this is what the polynomial really looks like: poly = -x^4 y^2 + x^2 y^4 + x^4 z^2 - y^4 z^2 - x^2 z^4 + y^2 z^4 Factor[poly] -(x - y) (x + y) (x - z) (y - z) (x + z) (y + z) I tried generating only one surface with Plot3D, and then transforming it, but unfortunately it is still quite slow. I believe that the bottleneck is Plot3D, so if someone could find a better way to generate a single surface, it might be possible to make this run faster. We can rotate the whole thing by Pi/4 (variable change (x,y) -> (a,b)) to make it suitable for plotting with Plot3D: Solve[poly == u && (x - y)/Sqrt[2] == -a && (x + y)/Sqrt[2] == b, z, {x, y}] We shall use the following solution: sol[a_, b_, u_] = Sqrt[a^2/2 + b^2/2 + Sqrt[2 a^4 b^4 + a b u]/(Sqrt[2] a b)] Here's what this surface looks like: Manipulate[ Plot3D[ sol[a, b, u], {a, 0.002, 3 Sqrt[2]}, {b, 0.002, 3 Sqrt[2]}, RegionFunction -> Function[{x, y, z}, x^2 + y^2 + z^2 < 9], PlotRange -> All, BoxRatios -> Automatic], {u, 0, 1}] (This is not a very good way to plot it because it goes to infinity at a == 0 and b == 0. Perhaps it would be better to tilt it before plotting to avoid this.) Let us generate the rotations: cp = Composition; (* I just don't like to type much *) {t1, t2, t3} = Table[RotationTransform[Pi/2, axis], {axis, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}]; (* These transformations will generate the group that we need: *) base = {cp[t2, t1], cp[t3, t2], cp[t1, t3]} (* Generate all rotations with brute-force method: *) group = FixedPoint[Union@Flatten[{#, Outer[cp, base, #]}] &, base] And finally assemble everything: Manipulate[ With[ {gg = GeometricTransformation[ First @ Plot3D[ sol[a, b, u] // Evaluate, {a, 0.002, 3 Sqrt[2]}, {b, 0.002, 3 Sqrt[2]}, PlotRange -> All, Mesh -> False, RegionFunction -> Function[{x, y, z}, x^2 + y^2 + z^2 < 9] (*, PerformanceGoal -> Quality *)], RotationTransform[Pi/4, {0, 0, 1}] ]}, Graphics3D[GeometricTransformation[gg, #] & /@ group, Boxed -> False, SphericalRegion -> True] ], {u, 0, 1}] One might want to uncomment PerformanceGoal -> Quality, but it will be terribly slow. Compare with the original version: Manipulate[ ContourPlot3D[poly == u, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, RegionFunction -> Function[{x, y, z}, x^2 + y^2 + z^2 < 9], Mesh -> False, Axes -> False, Boxed -> False, SphericalRegion -> True], {u, 0, 1}] Szabolcs === Subject: locator snap In the example below the locator can be moved to any position in the graphic. Can the locator be made to snap to multiples of say 0.1? Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, Locator}] Maarten === Subject: Re: locator snap >> In the example below the locator can be moved to any position in the >> graphic. >> Can the locator be made to snap to multiples of say 0.1? >> Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, >> Locator}] Hi Maarten, I am not aware of any way to do this directly with Manipulate. (Of > course this does not mean that there doesn't exist a way!) Here is an example of doing it directly with Dynamic: Graphics[ > Locator[Dynamic[{x, y}, ({x, y} = Round[#, 0.1]) &]], > PlotRange -> 1, Frame -> True, > GridLines -> {#, #} & @ > Table[{x, If[Mod[x, 1/2] == 0, Black, Gray]}, {x, -1, 1, 1/10}] > ] > Sorry, I forgot to mention that x and y must be initialized before this will work: {x, y} = {0, 0} Also, the x in the Table is an unfortunate choice for a local variable name---it has nothing to do with the x in the Dynamic. === Subject: Re: locator snap Hey Szabolcs, This works fine, but I notice that the graph jerks around a lot when you move the locator. I assume that Mathematica is redrawing everything on each move or ...? Anyway, does anyone know why? Kevin In the example below the locator can be moved to any position in the > graphic. > Can the locator be made to snap to multiples of say 0.1? Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, > Locator}] > Hi Maarten, >> I am not aware of any way to do this directly with Manipulate. (Of >> course this does not mean that there doesn't exist a way!) >> Here is an example of doing it directly with Dynamic: >> Graphics[ >> Locator[Dynamic[{x, y}, ({x, y} = Round[#, 0.1]) &]], >> PlotRange -> 1, Frame -> True, >> GridLines -> {#, #} & @ >> Table[{x, If[Mod[x, 1/2] == 0, Black, Gray]}, {x, -1, 1, 1/10}] >> ] Sorry, I forgot to mention that x and y must be initialized before this= > will work: {x, y} = {0, 0} Also, the x in the Table is an unfortunate choice for a local variable > name---it has nothing to do with the x in the Dynamic. > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: locator snap Manipulate[p = Round[10*p]/10.; Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, Locator}] ?? In the example below the locator can be moved to any position in the graphic. > Can the locator be made to snap to multiples of say 0.1? Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, Locator}] > Maarten === Subject: Re: locator snap In the example below the locator can be moved to any position in the graphic. > Can the locator be made to snap to multiples of say 0.1? Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, Locator}] > Hi Maarten, I am not aware of any way to do this directly with Manipulate. (Of course this does not mean that there doesn't exist a way!) Here is an example of doing it directly with Dynamic: Graphics[ Locator[Dynamic[{x, y}, ({x, y} = Round[#, 0.1]) &]], PlotRange -> 1, Frame -> True, GridLines -> {#, #} & @ Table[{x, If[Mod[x, 1/2] == 0, Black, Gray]}, {x, -1, 1, 1/10}] ] Szabolcs P.S. Sorry for the convoluted grid line construction === Subject: Re: locator snap In the example below the locator can be moved to any position in the graphic. > Can the locator be made to snap to multiples of say 0.1? Manipulate[Column@{Graphics[{}, Axes -> True], p}, {{p, {0, 0}}, Locator}] > Maarten This is almost literaly from the documentation of Locator -> Scope -> Locator Control, I just changed the constrain: Deploy[DynamicModule[{p = {1, 0}}, Graphics[{Red, Disk[], Locator[Dynamic[p, (p = Round[#*10]/10.) &]]}, PlotRange -> 1.5, PlotLabel -> Dynamic[p]]]] hth, albert === Subject: Re: Question about OneIdentity Hi Szabolcs, OneIdentity is not easily explained and the writer seems to have taken a shortcut. A good description from Ted Ersek can be found here: Ted Ersek hope this helps, Daniel > (Scroll down for the actual question) I never really understood Flat and OneIdentity, and unfortunately > documentation about them is scarce. OneIdentity is an attribute that can be assigned to a symbol f to > indicate that f[x], f[f[x]], etc. are all equivalent to x for the > purpose of pattern matching. OneIdentity has an effect only if f has attribute Flat. > ** Some comments: There is also an example, listing the Attributes of Times and showing > that Times[a] evaluates to a. However, this is misleading because this > behaviour cannot be caused by Times's attributes: In[1]:= Attributes[f] = Attributes[Times] > Out[1]= {Flat, Listable, NumericFunction, > OneIdentity, Orderless, Protected} In[2]:= f[a] > Out[2]= f[a] If we assign the same attributes to f, f[a] will not evaluate to a. Was > the technical writer also confused, or is the example supposed to > illustrate something different than what I understood? > ** And now the actual question: According to the text in the docs (f[x] is considered equivalent to x in > pattern matching) I would expect MatchQ[1, f[1]] to give True after evaluating SetAttributes[f, {Flat, OneIdentity}]. > But it gives False. > ** The application: This came up in the following application: fun[HoldPattern@Plus[terms__]] := doSomething[{terms}] This function should handle a single term, too. Of course, there are > workarounds, but I couldn't come up with anything as simple as the > pattern above (which unfortunately does not work). > === Subject: Re: Question about OneIdentity You can find a very clear explanation of these matters here: http://hilbert.math.hr/arhive/mathgroup/2000/01/0323.html Note also that, although, as you note: Attributes[f] = Attributes[Times]; MatchQ[1, f[1]] False but MatchQ[f[1], f[f[1]]] True For the explanation see the above link. Andrzej Kozlowski (Scroll down for the actual question) I never really understood Flat and OneIdentity, and unfortunately > documentation about them is scarce. =46rom the docs: > OneIdentity is an attribute that can be assigned to a symbol f to > indicate that f[x], f[f[x]], etc. are all equivalent to x for the > purpose of pattern matching. OneIdentity has an effect only if f has attribute Flat. > ** Some comments: There is also an example, listing the Attributes of Times and showing > that Times[a] evaluates to a. However, this is misleading because > this > behaviour cannot be caused by Times's attributes: In[1]:= Attributes[f] = Attributes[Times] > Out[1]= {Flat, Listable, NumericFunction, > OneIdentity, Orderless, Protected} In[2]:= f[a] > Out[2]= f[a] If we assign the same attributes to f, f[a] will not evaluate to a. = > Was > the technical writer also confused, or is the example supposed to > illustrate something different than what I understood? > ** And now the actual question: According to the text in the docs (f[x] is considered equivalent to = > x in > pattern matching) I would expect MatchQ[1, f[1]] to give True after evaluating SetAttributes[f, {Flat, OneIdentity}]. > But it gives False. > ** The application: This came up in the following application: fun[HoldPattern@Plus[terms__]] := doSomething[{terms}] This function should handle a single term, too. Of course, there are > workarounds, but I couldn't come up with anything as simple as the > pattern above (which unfortunately does not work). > === Subject: Re: Question about OneIdentity the link of my previous post seems to be damaged. here it is again: http://www.verbeia.com/mathematica/tips/HTMLLinks/Tricks_L-O_16.html Daniel > (Scroll down for the actual question) I never really understood Flat and OneIdentity, and unfortunately > documentation about them is scarce. OneIdentity is an attribute that can be assigned to a symbol f to > indicate that f[x], f[f[x]], etc. are all equivalent to x for the > purpose of pattern matching. OneIdentity has an effect only if f has attribute Flat. > ** Some comments: There is also an example, listing the Attributes of Times and showing > that Times[a] evaluates to a. However, this is misleading because this > behaviour cannot be caused by Times's attributes: In[1]:= Attributes[f] = Attributes[Times] > Out[1]= {Flat, Listable, NumericFunction, > OneIdentity, Orderless, Protected} In[2]:= f[a] > Out[2]= f[a] If we assign the same attributes to f, f[a] will not evaluate to a. Was > the technical writer also confused, or is the example supposed to > illustrate something different than what I understood? > ** And now the actual question: According to the text in the docs (f[x] is considered equivalent to x in > pattern matching) I would expect MatchQ[1, f[1]] to give True after evaluating SetAttributes[f, {Flat, OneIdentity}]. > But it gives False. > ** The application: This came up in the following application: fun[HoldPattern@Plus[terms__]] := doSomething[{terms}] This function should handle a single term, too. Of course, there are > workarounds, but I couldn't come up with anything as simple as the > pattern above (which unfortunately does not work). > === Subject: Bug in the front end's parser ( lst[[ ;; , 1 ]] syntax) Suppose that we want to take the third element of every sublist from the following list: lst = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} One way to do this is to use lst[[All, 3]] Another way would be to use the new Span-syntax: lst[[ ;; , 3]] Unfortunately this does not work when evaluated in the front end. It does work when the kernel was started on the command line. (Both of lst[[1;; , 3]] and lst[[;;-1 , 3]] work from the front end.) === Subject: Re: Bug in the front end's parser ( lst[[ ;; , 1 ]] syntax) > Suppose that we want to take the third element of every sublist from th= e > following list: lst = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} One way to do this is to use lst[[All, 3]] Another way would be to use the new Span-syntax: lst[[ ;; , 3]] Unfortunately this does not work when evaluated in the front end. It > does work when the kernel was started on the command line. (Both of lst[[1;; , 3]] and lst[[;;-1 , 3]] work from the front end.) This looks like a bug to me. Note that the following works as expected: Cell[BoxData[ RowBox[{lst, [[, RowBox[{;;, ,, 2}], ]]}]], Input] while the frontend creates this when typing in the expression: Cell[BoxData[ RowBox[{lst, [[, RowBox[{;;, RowBox[{,, 2}]}], ]]}]], Input] which produces the syntax error... hth, albert === Subject: Re: Cropping a surface to a sphere Here is a second version of the surface cropped to a sphere using a number > of options. ContourPlot3D[-x^4 y^2 + x^2 y^4 + x^4 z^2 - y^4 z^2 - x^2 z^4 + > y^2 z^4 == 1, {x, -3, 3}, {y, -3, 3}, {z, -3, 3}, > RegionFunction -> Function[{x, y, z, f}, x^2 + y^2 + z^2 <= 9], > ContourStyle -> {FaceForm[ColorData[Legacy][DarkSeaGreen], > GrayLevel[.7]]}, > PlotPoints -> 25, > Mesh -> False, (* Use white lights instead of colored lights *) > Lighting -> Neutral, > Axes -> False, > Boxed -> False, (* The following options provide a smooth rotation with the mouse *) > SphericalRegion -> True, > RotationAction -> Clip, (* The following option causes the plot to fill the viewing area *) > PlotRegion -> {{-.3, 1.3}, {-.3, 1.3}}, > Background -> ColorData[Legacy][LightBeige], > ImageSize -> 500] It's not clear that we need the bounding box or the axes. We might just say > it is the surface out to a radius of 3. The colored lights add nothing to > the plot. They only introduce confusion so we use Neutral lighting. We then > use the ContourStyle option to give different colors to the inside and > outside of the surface. If you don't like the image jumping around when you > use the mouse to rotate, you can use the SphericalRegion and RotationAction > options. The PlotRegion option gives us an initial view such that the object > fills the viewing area. You can also use the mouse zoom function to control > this. Then we use a Background to tone down the plot and ImageSize to > control the initial size. There are many other options that might be used. I hope you will agree that this is a much better presentation of the surface > than my previous reply without all the options. This looks very nice indeed---thank you for this demonstration of how to make great looking graphics! and sorry for not paying attention to the obviously outstanding option RegionFunction ... === Subject: Re: FEM contourplotter - conversion completed I have been using the great IMS (Imtek Mathematica Supplement) for Finite Element Calculations in Mathematica: http://www.imtek.de/simulation/mathematica/IMSweb/ In case you already know IMS, could you please summarize in some rows what would be the relationship between your work and IMS? Do you know if there are calculations that can be done with your work and cannot be done with IMS? Jose Mexico -----Mensaje original----- De: carlos@Colorado.EDU [mailto:carlos@Colorado.EDU] Enviado el: Domingo, 27 de Abril de 2008 06:01 a.m. Para: mathgroup@smc.vnet.net Asunto: FEM contourplotter - conversion completed The translation of the Fortran IV 1966 finite element contourplot to Mathematica is complete. Those interested in that specialized topic may download a mini test version from http://caswww.colorado.edu/courses.d/IFEM.d/IFEM.Ch27.d/IFEM.Ch27.index.html Click on ContBandPlotterMini.nb link. Download and execute. Self contained data. Tested so far under V4.1, 4.2 & 5.2. Untested under V6.0 as my laptop in Spain lacks it. Test plots take ~0.5 sec on 2.4 GHz MacBook Pro under 5.2. To run under 6.0 set DisplayChannel to Print (see top comment). The original Fortran code was roughly 9000 lines. Code was typical write only thesis spaghetti, with over 1000 GOTOs and (believe it or not) even a PAUSE statement! Mathematica code is about 800 lines. Imperative procedural logic reflects source, but could simplify later conversion to C or assembly. was reduced by deleting 6 element types out of 7, and removing an alternative divide & conquer contourplotting method. (D&C produces higher quality plots but is slower.) Code is slow (about 10K poly/sec) but that is enough for coursework. A C or assembly version will be needed for FEM production work (>=1M poly/sec) at the cost of portability. Worst flaw is the shoddy contour value labeling, done in a hurry. To see what's wrong, try resizing top plot with mouse. Advice on how to fix that mess welcome. === Subject: Re: Transforming a polynomial into a trigonometric format tia sal2 > I'm using mathematica 6 and I have a polynomial and would like to > convert it into > a Trigonometric format. Is this possible? Example: > I have a polynomial > 0.00154991- 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4 How can I transform this into a trigonometric format > Example: > 0.00596679 Cos[6.98132 x] + 0.00358397 Cos[7.21403 x] + > 2.25013 Sin[0.232711 x] - 4.51511 Sin[0.465421 x] Note: these aren't correct answers I just wanted to include and > example Well, as stated, I do not understand what you are trying to do. Fourier Series expansion? But your function must be periodic... Anyway, you should have a look at the FourierSeries` package, it might help clarifying what your goal is. Non linear approximation? You need to specify an interval... Perhaps FindFit is what you are looking for (you may have to try different models and intervals, though). For instance, poly = 0.00154991 - 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4; data = Table[{x, poly}, {x, -1, 1, .1}]; model = a Sin[b + c x] + d Cos[e + f x] + g; params = {a, b, c, d, e, f, g}; vars = x; sol = FindFit[data, model, params, vars] ft = model /. sol Plot[{poly, ft}, {x, -1, 1}] -740.092 + 1176.29 Cos[0.11808- 0.581571 x] - 436.92 Sin[1.36856+ 0.965664 x] -- === Subject: Re: Transforming a polynomial into a trigonometric format tia sal2 > Transforming a polynomial into a trigonometric format tia sal2 > I'm using mathematica 6 and I have a polynomial and would like to > convert it into > a Trigonometric format. Is this possible? Example: > I have a polynomial > 0.00154991- 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4 How can I transform this into a trigonometric format > Example: > 0.00596679 Cos[6.98132 x] + 0.00358397 Cos[7.21403 x] + > 2.25013 Sin[0.232711 x] - 4.51511 Sin[0.465421 x] Note: these aren't correct answers I just wanted to include and > example Hello tia sal2, I am not sure I understand the question ... Is this what you mean? In[175]:= poly = 0.00154991 - 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4 Out[175]= 0.00154991- 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4 In[176]:= TrigReduce[poly /. x -> Cos[y]] Out[176]= -2.59729 + 1.98766 Cos[y] - 3.76711 Cos[2 y] + 2.00046 Cos[3 y] - 1.16828 Cos[4 y] Szabolcs === Subject: Re: Transforming a polynomial into a trigonometric format tia sal2 I do not understand what you mean by: Transforming a polynomial into a trigonometric format Daniel > Transforming a polynomial into a trigonometric format tia sal2 > I'm using mathematica 6 and I have a polynomial and would like to > convert it into > a Trigonometric format. Is this possible? Example: > I have a polynomial > 0.00154991- 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4 How can I transform this into a trigonometric format > Example: > 0.00596679 Cos[6.98132 x] + 0.00358397 Cos[7.21403 x] + > 2.25013 Sin[0.232711 x] - 4.51511 Sin[0.465421 x] Note: these aren't correct answers I just wanted to include and > example tia sal2 > === Subject: Re: Transforming a polynomial into a trigonometric format tia sal2 Hello Tia, I don't think what you are trying to do is possible, but you may be able to find approximation methods to get close. Possible methods include: a) Truncated Fourier Series, (FourierTrigSeries) b) Expanding a trignometric function in a series, and then comparing coefficients (Series, Collect, Solve) c) Fit data generated by your model polynomial to your trigonometric form. (Table, FindFit) Best Wishes, Craig > I'm using mathematica 6 and I have a polynomial and would like to > convert it into > a Trigonometric format. Is this possible? Example: > I have a polynomial > 0.00154991- 4.01371 x + 1.81197 x^2 + 8.00183 x^3 - 9.3462 x^4 How can I transform this into a trigonometric format > Example: > 0.00596679 Cos[6.98132 x] + 0.00358397 Cos[7.21403 x] + > 2.25013 Sin[0.232711 x] - 4.51511 Sin[0.465421 x] === Subject: Re: how to use ones(A)? >v=[1 2 3];a=ones(v) the result is: a(:,:,1) = Nonsense as should be expected when you don't use appropriate syntax. If you type v=[1 2 3] into a new cell and execute it you will get an error. This syntax tells Mathematica to compute the product of 1, 2 and 3 then evaluate a function with no name with an argument equal to 6. I am guessing you want v= {1,2,3 Now after using a correct assignment the syntax you use to get a result isn't meaningful either. The characters ( and ) are used for grouping. The syntax a(stuff) tells Mathematica to multiply the stuff between ( and ) by a. I doubt this is what you wanted. v[x] is a function v to be evaluated at x v[[x]] says return the item x from list v v(x) says multiply x by v v{x} says multiply the list with one element x by v and will return {x v} === Subject: Re: Common Multiple Value Question >I am trying to solve this Common Multiple Value Question based on 2 >sequences of values... This is both a Math question & also a >question on how to apply this problem to Mathematica. However, >please note I am trying to find BOTH Common Multiple Value, of each >element in both lists AND maintaining the same proportion in the >first list of elements. >I will pose this problem in 2 ways. (i) Fractional sequence of >values. (ii) Numerical sequence of values. Actually they are the >same question, but I would like to be able to solve this in both the >fractional & numerical form. (... And also solving this without >using LCM - Lowest Common Multiple function .... as this is part of >a bigger calculation & I will be using algebra.) >(i) Fractional sequence of values - 1 pair. 3 elements in each. >list1={2/3,2/3+1,2/3+2} >list2={3/4,3/4+1,3/4+2} >{2/3,5/3,8/3} >{3/4,7/4,11/4} >(ii) Numerical sequence of values - 1 pair. 3 elements in each. >list3={2,5,8} >list4={3,7,11} >{2,5,8} >{3,7,11} you want. I don't know what you mean by common multiple value. I think what you are asking for is to determine the greatest common divisor and reduce the values by that divisor. If so, the built-in function you want is GCD. But for the particular values you list, the GCD is clearly unity since at least two of the elements in either list3 or list4 are prime. The problem you are calling fractional sequence of values is the same problem you refer to as numerical sequence of values since the list of rational values has a common denonimator and the numerators are the same as your list of integers. I could also read your common multiple value as being the least common multiple of a set of numbers. If this is what you have in mind, the built in function you want is LCM === Subject: Re: Does Mathematica really need more printed, introductory documentation? >In response to Andrzej Kozlowski's comment >>Judging by quite many ordinary users I known, the views you have >>been expressing, particularly those on the need for printed >>software manuals rather make you a memeber of a minority, and >>moreover a rather rapidly declining one. I for one, . . . >Does Mathematica really need printed, more introductory level >documentation (aka books, or manuals) to add to its excellent, but >less readable, online documentation? Given the number of what I believe are reasonably successful third party books on Mathematic, it seems clear there is a need. (12) such introductory books or manuals on Illustrator (list >appended below). All of these books are currently available in stock >on amazon (and three are on my bookshelf) --- as compared to _none_ >(as yet, anyway) for Mathematica 6. Given it has only been a few months since Mathematica 6 was released and the time it takes to write any text and get it published it should not be surprising there are not any third party books on Mathematica yet. But given the number of books published for previous versions, it seems certain there will be books for version 6 in due time. === Subject: Re: Does Mathematica really need more printed, introductory documentation? > Given it has only been a few months since Mathematica 6 was > released and the time it takes to write any text and get it > published it should not be surprising there are not any third > party books on Mathematica yet. But given the number of books > published for previous versions, it seems certain there will be > books for version 6 in due time. Bill, it's been for all practical purposes a _year_ now since Mathematica 6 was released. [Cf., e.g., a sizable story about it in Scientific Computing World dated May 30, 2007: ] And though I don't have a cite at hand, I'm sure I've read about how major software companies, when they have a major emerging project or upgrade under development, will invite a selected author or authors with a good track record to come into their company and give them substantial access to advance knowledge about the developing product --- with appropriate nondisclosure agreements of course --- just so their book or manual can appear on the shelves at the same instant the product is released. A software company may do this because they don't want to divert in-house resources from product development to preparing an book for the emerging product or upgrade --- or they may do this even though they're developing their own manual also, on the grounds that the more, the better so far as manuals go; they're in the software business, not the manual business. To be frank I just cannot imagine Wolfram Research not having done the same. === Subject: Converting Mathematica code to C++ Hi all, I am considering running my research project on a computer cluster on campus. However, the computer cluster requires the programs to be in C++, and I've already coded much of the project in Mathematica. Do converters such as MathCode C++ work well? Or do I need to re-write everything in C++ (not to mention learn how to code in C++)? If it's relevant, my project calculates the Lyapunov exponents of partial differential equations, and the goal is to find the simplest chaotic PDE. I'm considering trying Intel's Compiler 10.1 for MacOSX, but I am very reluctant to abandon Mathematica to learn to use Intel's interface and others' PDE solvers in C++. Charlie Brummitt University of Wisconsin - Madison === Subject: Re: Converting Mathematica code to C++ The company I am currently working for recently asked me to evaluate the transformation of a complex Mathematica code into C++. So I considered using MathCode C++. In short : MathCode C++ is a wonderful tool when you start a project, but when your already written Mathematica code uses mostly all features available in Mathematica, the task of conforming Mathematica code to MathCode C++ (MathCode C++ understands only a subset of Mathematica) is very frustrating ; rewriting all in C++ seems easier, because you can then use all features of C++. Also note that Mathematica code can often be optimized, and that most of numerics in Mathematica hide C/C++ code, so that a gain using efficiency of C++ is not dramatic. Finally, your code must be parallelized if you want it to run on a cluster : the task of parallelizing code is a prerequisite, and certainly not easy. Afterwards, on a cluster, the un-parallelized code is only a kind of glue code, not needing to be fast ; and Mathematica is great for this kind of tasks. In your case, I should have a look on Grid Mathematica. > Hi all, > I am considering running my research project on a computer cluster on > campus. However, the computer cluster requires the programs to be in C++, > and I've already coded much of the project in Mathematica. Do converters > such as MathCode C++ > work > well? Or do I need to re-write everything in C++ (not to mention learn > how to code in C++)? > > If it's relevant, my project calculates the Lyapunov exponents of partial > differential equations, and the goal is to find the simplest chaotic PDE. > > I'm considering trying Intel's Compiler 10.1 for MacOSX, but I am very > reluctant to abandon Mathematica to learn to use Intel's interface and > others' PDE solvers in C++. > > > Charlie Brummitt > University of Wisconsin - Madison -- ---------------------------------------- Informatique technique et scientifique http://www.dxdydz.net Jean-Marie Thomas +33 (0)1 75 57 60 75 +33 (0)6 37 18 86 63 === Subject: Re: Converting Mathematica code to C++ Hi Charlie, I would advice you to request an evaluation copy. Then you can try to translate some code yourself. I think that is the only reliable way to see if it fits your needs or not. I did this myself 2 years ago and at this time I was not satisfied. But 2 year is a long time and it is quit probable that the product matured now. Daniel > Hi all, > I am considering running my research project on a computer cluster on > campus. However, the computer cluster requires the programs to be in C++, > and I've already coded much of the project in Mathematica. Do converters > such as MathCode C++ > work > well? Or do I need to re-write everything in C++ (not to mention learn how > to code in C++)? If it's relevant, my project calculates the Lyapunov exponents of partial > differential equations, and the goal is to find the simplest chaotic PDE. I'm considering trying Intel's Compiler 10.1 for MacOSX, but I am very > reluctant to abandon Mathematica to learn to use Intel's interface and > others' PDE solvers in C++. > Charlie Brummitt > University of Wisconsin - Madison === Subject: Re: Converting Mathematica code to C++ > Hi all, > I am considering running my research project on a computer cluster on > campus. However, the computer cluster requires the programs to be in C++, > and I've already coded much of the project in Mathematica. Do converters > such as MathCode C++ > work > well? Or do I need to re-write everything in C++ (not to mention learn how > to code in C++)? If it's relevant, my project calculates the Lyapunov exponents of partial > differential equations, and the goal is to find the simplest chaotic PDE. I'm considering trying Intel's Compiler 10.1 for MacOSX, but I am very > reluctant to abandon Mathematica to learn to use Intel's interface and > others' PDE solvers in C++. Mathematica will happily generate C code, which C++ compilers will happily compile as is, as C++ is a superset of C. See CForm[]. Mathematica will also generate Fortran, using FortranForm[]. Joe Gwinn === Subject: Re: Notebook[] here is a function that returns the left window margin if given a Notebook as input: (WindowMargins /. Options@#)[[1, 1]] & hope this helps, Daniel > Hi Everyone, > I have a notebook related question. I have about 50 > notebooks open on the screen with different titles. I > want to select the notebooks with certain titles. I do > have this working: Select[Notebooks[], StringMatchQ[(WindowTitle /. > NotebookInformation[#]), temp] &] > However, I want to take this a step further, and > retrieve only those notebooks that are on the left > side of my screen and close them. In other words, I > somehow need to divide my monitor in half and select > all the windows on the left side and close them by > NotebookClose. I know of WindowMargins but I am not sure how to > retrieve information: > Options /@ Select[Notebooks[], > StringMatchQ[(WindowTitle /. > NotebookInformation[#]), temp] &] > _____ _ > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ === Subject: HighlightedEdgeColors with Combinatoric`ShowGraph and AnimateGraph The following works as expected to highlight two of the edges of a graph with a different color each: <{Red,Blue}]] And the docs say that AnimateGraph takes the same options as Highlight. But the following does NOT work -- it uses just the first color, Red, when animating the highlighting of the two edges: AnimateGraph[g, {{1, 2}, {2, 3}}, HighlightedEdgeColors -> {Red, Blue}] What's wrong? (I do know that I used different syntax in the 2nd argument of Highlight, on the one hand, and in the 2nd argument of AnimateGraph, on the other hand. For Highlight to work within ShowGraph so as to animate edges, it is necessary to put the extra level of nesting in each edge specification. But such extra nesting in the case of AnimateGraph would not work: it gives no animation of edges.) -- 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: Mathematica courses and news from the Benelux Due to the support of the Katholieke Universiteit Leuven CANdiensten will be providing Mathematica courses in Belgium. We are aiming at some course dates in June and September. More news about this will follow. Topics of this newsletter __ o International Mathematica Symposium 2008 o Course: Dynamic Interactivity o Course: Introduction to Mathematica o Course: Programming with Mathematica Check out our complete event list at: http://www.can.nl/events/ International Mathematica Symposium __ June 20-24 in Maastricht Celebrate the 20th Mathematica anniversary on the 23rd of June in the heart of Europe. The International Mathematica Symposium 2008 is a 5 day bi-annual event. Many special key note speakers will be present. The event is hosted by the University of Maastricht and the organization is in the hands of the Technical University of Eindhoven. The now bi-annual meeting is an interdisciplinary conference for Mathematica users in mathematics, natural and life sciences, engineering, computer science, education, industry and commerce, social sciences and law, graphics, design and architecture, arts and music. If you use Mathematica in research or teaching, or if you are developing products based on Mathematica, then the Symposium is a unique opportunity to share your results with like-minded colleagues. IMS has a deserved reputation as an exceptionally convivial and friendly gathering. More detailed information is available from the IMS 08 web site: http://www.ims08.org Course: Dynamic Interactivity by Professor Fred Simons __ June 17 and October 28 in Amsterdam The course is meant for those users of Mathematica who want to have a better insight in the new structures and functions in Mathematica, in particular in dynamic objects. But other topics, such as the completely new and innovative documentation system, new features of graphics, the new function Grid and functions for creating buttons and links, will be discussed as well. Participation costs EURO 95,-- per person excluding VAT Registration and more information: http://www.can.nl/events/details.php?id=48 Course: Introduction to Mathematica by Professor Fred Simons __ May 20, October 7 and December 16 in Amsterdam The course offers an overview of Mathematica's many rich features. The broad knowledge you acquire enables you to explore Mathematica after the course at your own pace. Participation costs EURO 95,-- per person excluding VAT Registration and more information: http://www.can.nl/events/details.php?id=6 Course: Programming with Mathematica by Professor Fred Simons September 16 and November 18 in Amsterdam All programming language functionality is available in Mathematica. Programs written in a standard programming language can be translated into a Mathematica program. However, this leads rarely to an efficient program. Often we can improve such a translation by using some more advanced Mathematica commands. Even better is to start from the very beginning and to use the structure of the dataset and the available functions in Mathematica for manipulation to arrive at the desired output. These principles will be demonstrated by many examples. Much attention will be paid to the speed of the programs. Participation costs EURO 250,-- per person excluding VAT Registration and more information: http://www.can.nl/events/details.php?id If you have any questions, please feel free to contact me. Dick Verkerk _ CANdiensten, Nieuwpoortkade 23-25, NL-1055 RX Amsterdam voice: +31 20 5608400 fax: +31 20 5608448 verkerk@can.nl _ Your Partner in Finance, Mathematics and Statistics! === Subject: OpenerView (with cells?) In the Mathematica documentation viewer, it looks as though sections and subsection headers are implemented using an OpenerView that can contain cells. At least when you click on the disclosure triangle next to sections like Examples, More Information, Options, and so on, the view reveals a number of input, output, and text cells. How are those section headers implemented? An ordinary OpenerView, as far as I can tell, cannot contain cells (although you can fake it a little bit using DisplayForm). I looked at the cell expression for one using Show Expression but what I found was just a reference to a stylesheet: Cell[TextData[{ Basic Examples, , Cell[(4), ExampleCount] }], ExampleSection, CellID->454094506] Any ideas on how that effect is achieved? I'd like to use something similar in my own notebooks. Jason -- Dr. J. McKenzie Alexander Department of Philosophy, Logic and Scientific Method London School of Economics and Political Science Houghton Street, London, WC2A 2AE Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm === Subject: 2*m^z - m^z = ? What do you think about this: Table[ {2*m^z - m^z, FullSimplify[2*m^z - m^z]}, {m, 1, 21}] // TableForm The answer is very interesting (only odd numbers are treated well): 1 1 -2^z + 2^(1 + z) 2^z 3^z 3^z 2^(1 + 2*z) - 4^z 4^z 5^z 5^z 2^(1 + z)*3^z - 6^z 2^(1 + z)*3^z - 6^z 7^z 7^z 2^(1 + 3*z) - 8^z 8^z 9^z 9^z 2^(1 + z)*5^z - 10^z 2^(1 + z)*5^z - 10^z 11^z 11^z 2^(1 + 2*z)*3^z - 12^z 2^(1 + 2*z)*3^z - 12^z 13^z 13^z 2^(1 + z)*7^z - 14^z 2^(1 + z)*7^z - 14^z 15^z 15^z 2^(1 + 4*z) - 16^z 16^z 17^z 17^z 2^(1 + z)*9^z - 18^z 2^(1 + z)*9^z - 18^z 19^z 19^z 2^(1 + 2*z)*5^z - 20^z 2^(1 + 2*z)*5^z - 20^z 21^z 21^z Can anyone explain the reason for this behavior? === Subject: ReplacePart and Compile in Mathematica 6.0 the syntax of the function ReplacePart[] changed significantly as compared to earlier versions. While the old syntax is not documented any more, it still seems to work in V6.0.2.1: New syntax: ReplacePart[{1, 2, 3}, 3 -> 1] {1, 2, 1} Old, now undocumented syntax: ReplacePart[{1, 2, 3}, 1, 3] {1, 2, 1} Unfortunately, in compiled functions the new syntax does not seem to work Compile[{}, ReplacePart[{1, 2, 3}, 3 -> 1]] // InputForm During evaluation of In[14]:= ReplacePart::argrx: ReplacePart called with 2 arguments; 3 arguments are expected. >> CompiledFunction[{}, {{2, 1, 1}}, {0, 3, 0, 0, 2}, {{1, 5}, {45, {1, 2, 3}, 2, 3, 0}, {54, Function[{}, 3 -> 1],2,0, 2}, {55, ReplacePart, 2, 1, 0, 2, 0, 2, 2, 1, 1}, {2}}, Function[{}, ReplacePart[{1, 2, 3}, 3 -> 1]], Evaluate] while the old syntax produces nicely compiled code: InputForm[Compile[{}, ReplacePart[{1, 2, 3}, 1, 3]]] CompiledFunction[{}, {{2, 1, 0}}, {0, 2, 0, 0, 1}, {{1, 5}, {45, {1, 2, 3}, 2, 3, 0}, {7, 3, 0}, {7, 1, 1}, {71, 0, 0, 0, 0, 1}, {2}}, Function[{}, ReplacePart[{1, 2, 3}, 1, 3]], Evaluate] This situation is somewhat confusing (the error message seems to be clearly wrong) and either a bug or a misconception on my side? Is it intended that the new ReplacePart cannot be compiled any more? Is the documentation of ReplacePart in V6 incomplete, and should also mention the old syntax? (More generally: Could it be annotated in the documentation, which functions can be compiled and which functions cannot be compiled. For me it is always an adventure to figure out a compiled version of a routine I need, because of this lack of basic information.) Michael Weyrauch === Subject: 3D Arrows Apparently Arrows is only a 2D graphic. Is there a way to make an arrow in 3D? Robert M Lurie === Subject: 3D Arrows Apparently Arrows is only a 2D graphic. Is there a way to make an arrow in 3D? Robert M Lurie === Subject: Re: 3D Arrows > Apparently Arrows is only a 2D graphic. Is there a way to make an arrow > in 3D? > Robert M Lurie Wanted the same thing, made a quick implementation... Between[a_, b_, x_] := b - (b - a)/Norm[b - a]*x; Cone3D[s_, e_, w_] := Module[{v, b, b1, b2, A, r}, v = e - s; A = RotationMatrix[[Pi]/10, v]; b = {v[[2]], -v[[1]], 0}; b = b/Norm[b]*w; r = {}; For[i = 0, i < 20, i++, b1 = RotationMatrix[i*[Pi]/10, v].b; b2 = RotationMatrix[(i + 1)*[Pi]/10, v].b; AppendTo[r, Polygon[{e, s + b1, s + b2}]]; AppendTo[r, Polygon[{s, s + b1, s + b2}]]; ]; r ]; Arrow3D[s_, e_, cw_, aw_, al_] := Module[{m}, m = Between[s, e, al]; {Cylinder[{s, m}, cw], Cone3D[m, e, aw]} ]; Graphics3D[{EdgeForm[], Arrow3D[{2, 0, 0}, {0, 0, 0}, 0.1, 0.3, 0.4]}] === Subject: Re: Wolfram User Interface Research? Is the primary market for Mathematica supposed to be > Mathematica programmers, skilled in the arcana of the > more abstruse parts of Mathematica, or ordinary users > whose primary interests and skills lie in many, many other > fields -- and who want Mathematica to be (for them) just > an easy to learn, easy to use, easy to remember tool? Mathematica could not function the way it does unless it satisfied > both types of users. It has to be powerful enough for professional > programmers if not for other reason than just the fact that a large > part of Mathematica itself (and all add on packages) are written in > the Mathematica programming language. It also has to satisfy enough > ordinary users for even more obvious reasons. In my opinion it has > always performed both functions admirably. Fully and totally agree. > These abstruse parts of Mathematica are not obligatory for ordinary > users but for Mathematica programmers and developers (and many power > users) they make life a lot easier. Also agree -- but my expectation would be that there are (or could be -- and should be) a *great* many more ordinary users than power users. So it's important for both types that *both* markets be well served -- and especially the ordinary users, because there are so many more of them. Getting their $$ is vital to the success of Matheamtica . The power users are savvy enough that if Mathematica is very good -- which it is -- they'll wade through minor difficulties. The ordinary users won't --- they'll go elsewhere. > I believe you are familiar with TeX; at least you mention it often > enough. Do you seriously claim that Mathematica has more of these > abstruse parts than TeX? Have you ever heard words like TeXPert, > TexMaster etc? Are you able to program or even understand a set of I'm quite familiar with TeX and can program in it, though I'm not really a TeXpert. Plain TeX is *much* less complex than Mathematica. Several decades ago, in fact, the lab I was in had several secretaries/technical typists in the so-called Reports Group, several of whom had not finished high school --- but one could hand a hand-written draft of a ms to them, full of complex math -- and they'd turn it into TeX source. TeX is *much* smaller than Mathematica by whatever measure you like (syntax, size of code), and very well documented for ordinary or power users (have a look at Knuth's TeXBook to understand this). LaTeX and other macro packages built on TeX are much more complex than plain TeX; I use them but would never try to dig into their internals. I can, however, go to amazon and buy any of several introductory manuals that tell me in understandable terms how to use them. > Finally, in all your posts you never seem to mention the very essential > (in the case of Mathematica) distinction between the Front End and the > Kernel. The great majority of new functionality in v. 6 concerns the > former. In principle there is no reason why Mathematica should not be > available with alternative Front Ends. It used to be possible to run > later versions with earlier Front Ends. I have not tried this with v. > 6 but that would be one way to do away with most of the new > complexity that you seems to displease you so. If that can be done --- and documented for ordinary users --- have at it! === Subject: Re: Wolfram User Interface Research? Is the primary market for Mathematica supposed to be > Mathematica programmers, skilled in the arcana of the > more abstruse parts of Mathematica, or ordinary users > whose primary interests and skills lie in many, many other > fields -- and who want Mathematica to be (for them) just > an easy to learn, easy to use, easy to remember tool? Mathematica could not function the way it does unless it satisfied > both types of users. It has to be powerful enough for professional > programmers if not for other reason than just the fact that a large > part of Mathematica itself (and all add on packages) are written in > the Mathematica programming language. It also has to satisfy enough > ordinary users for even more obvious reasons. In my opinion it has > always performed both functions admirably. Fully and totally agree. > These abstruse parts of Mathematica are not obligatory for ordinary > users but for Mathematica programmers and developers (and many power > users) they make life a lot easier. Also agree -- but my expectation would be that there are (or could be -- and should be) a *great* many more ordinary users than power users. So it's important for both types that *both* markets be well served -- and especially the ordinary users, because there are so many more of them. Getting their $$ is vital to the success of Matheamtica . The power users are savvy enough that if Mathematica is very good -- which it is -- they'll wade through minor difficulties. The ordinary users won't --- they'll go elsewhere. > I believe you are familiar with TeX; at least you mention it often > enough. Do you seriously claim that Mathematica has more of these > abstruse parts than TeX? Have you ever heard words like TeXPert, > TexMaster etc? Are you able to program or even understand a set of I'm quite familiar with TeX and can program in it, though I'm not really a TeXpert. Plain TeX is *much* less complex than Mathematica. Several decades ago, in fact, the lab I was in had several secretaries/technical typists in the so-called Reports Group, several of whom had not finished high school --- but one could hand a hand-written draft of a ms to them, full of complex math -- and they'd turn it into TeX source. TeX is *much* smaller than Mathematica by whatever measure you like (syntax, size of code), and very well documented for ordinary or power users (have a look at Knuth's TeXBook to understand this). LaTeX and other macro packages built on TeX are much more complex than plain TeX; I use them but would never try to dig into their internals. I can, however, go to amazon and buy any of several introductory manuals that tell me in understandable terms how to use them. > Finally, in all your posts you never seem to mention the very essential > (in the case of Mathematica) distinction between the Front End and the > Kernel. The great majority of new functionality in v. 6 concerns the > former. In principle there is no reason why Mathematica should not be > available with alternative Front Ends. It used to be possible to run > later versions with earlier Front Ends. I have not tried this with v. > 6 but that would be one way to do away with most of the new > complexity that you seems to displease you so. If that can be done --- and documented for ordinary users --- have at it! === Subject: Re: Wolfram User Interface Research? > What I did ask for --- would still ask for --- was, first of all the > proper technical name for this class of non-alphabetical symbols or > commands or operators in Mathematica? -- what they're called as a group, > Second and more important, I asked where, if anywhere, I could find (in > a single place) a short list (like perhaps a half-dozen page or less) > summarizing _all_ of these non-alphabetical operators, with a brief The Mathematica book has a list of such symbols in its table of contents. I don't believe any new symbolic operators were introduced in 6. In Math5's documentation, this list was present in the help browser. I understand that this list will appear again in future versions of the help browser. In any case, I think the book and its TOC is probably the most useful. -- W. Craig Carter === Subject: Re: Wolfram User Interface Research? > What I did ask for --- would still ask for --- was, first of all the > proper technical name for this class of non-alphabetical symbols or > commands or operators in Mathematica? -- what they're called as a group, Second and more important, I asked where, if anywhere, I could find (in > a single place) a short list (like perhaps a half-dozen page or less) > summarizing _all_ of these non-alphabetical operators, with a brief The Mathematica book has a list of such symbols in its table of > contents . . . . . . under the name or title of ??? [The TOC is 6 pages full of quite tiny type] [I think you may perhaps be referring to Appendix A.2.7, Operator Input Forms --- ???] === Subject: Re: Wolfram User Interface Research? On 2008-04-28 18:10:42 +0930, AES said: > What I did ask for --- would still ask for --- was, first of all the > proper technical name for this class of non-alphabetical symbols or > commands or operators in Mathematica? -- what they're called as a group, > to distinguish them from alphabetical symbol names? --- so I could ask > about them properly. I guess I'd call them analphabetic commands. That doesn't look like a word, but it is :) > Second and more important, I asked where, if anywhere, I could find (in > a single place) a short list (like perhaps a half-dozen page or less) > summarizing _all_ of these non-alphabetical operators, with a brief > statement of what each of them does, or what it's good for --- so that I > could identify ones I'd missed and decide which of these I might want to > learn more about. Perhaps we should write a cheat sheet. I'm sure it wouldn't be long. Will === Subject: Mathematica courses and news from the Benelux Due to the support of the Katholieke Universiteit Leuven CANdiensten will be providing Mathematica courses in Belgium. We are aiming at some course dates in June and September. More news about this will follow. Topics of this newsletter __ o International Mathematica Symposium 2008 o Course: Dynamic Interactivity o Course: Introduction to Mathematica o Course: Programming with Mathematica Check out our complete event list at: http://www.can.nl/events/ International Mathematica Symposium __ June 20-24 in Maastricht Celebrate the 20th Mathematica anniversary on the 23rd of June in the heart of Europe. The International Mathematica Symposium 2008 is a 5 day bi-annual event. Many special key note speakers will be present. The event is hosted by the University of Maastricht and the organization is in the hands of the Technical University of Eindhoven. The now bi-annual meeting is an interdisciplinary conference for Mathematica users in mathematics, natural and life sciences, engineering, computer science, education, industry and commerce, social sciences and law, graphics, design and architecture, arts and music. If you use Mathematica in research or teaching, or if you are developing products based on Mathematica, then the Symposium is a unique opportunity to share your results with like-minded colleagues. IMS has a deserved reputation as an exceptionally convivial and friendly gathering. More detailed information is available from the IMS 08 web site: http://www.ims08.org Course: Dynamic Interactivity by Professor Fred Simons __ June 17 and October 28 in Amsterdam The course is meant for those users of Mathematica who want to have a better insight in the new structures and functions in Mathematica, in particular in dynamic objects. But other topics, such as the completely new and innovative documentation system, new features of graphics, the new function Grid and functions for creating buttons and links, will be discussed as well. Participation costs EURO 95,-- per person excluding VAT Registration and more information: http://www.can.nl/events/details.php?id=48 Course: Introduction to Mathematica by Professor Fred Simons __ May 20, October 7 and December 16 in Amsterdam The course offers an overview of Mathematica's many rich features. The broad knowledge you acquire enables you to explore Mathematica after the course at your own pace. Participation costs EURO 95,-- per person excluding VAT Registration and more information: http://www.can.nl/events/details.php?id=6 Course: Programming with Mathematica by Professor Fred Simons September 16 and November 18 in Amsterdam All programming language functionality is available in Mathematica. Programs written in a standard programming language can be translated into a Mathematica program. However, this leads rarely to an efficient program. Often we can improve such a translation by using some more advanced Mathematica commands. Even better is to start from the very beginning and to use the structure of the dataset and the available functions in Mathematica for manipulation to arrive at the desired output. These principles will be demonstrated by many examples. Much attention will be paid to the speed of the programs. Participation costs EURO 250,-- per person excluding VAT Registration and more information: http://www.can.nl/events/details.php?id If you have any questions, please feel free to contact me. Dick Verkerk _ CANdiensten, Nieuwpoortkade 23-25, NL-1055 RX Amsterdam voice: +31 20 5608400 fax: +31 20 5608448 verkerk@can.nl _ Your Partner in Finance, Mathematics and Statistics! === Subject: Re: Exclusions > On Apr 22, 2:39 am, Gulliet pasting. In my notebook, the syntax is correct. I don't expect an automatic exclusion, but I do get an additional > (unwanted) exclusion at y==0 && x<0 when I use the following command: Plot3D[ pdfN[{x, y}], {x, -3, 3}, {y, -3, 3}, PlotRange -> Full, > Mesh -> 30, ColorFunction -> grayColors, PlotPoints -> 50, > ClippingStyle -> None, > Exclusions -> { {ArcTan[x, y] == 0.5, > x > 0 && y > 0}, {ArcTan[x, y] == -Pi + 0.5, x < 0 && y < 0}},= > ExclusionsStyle -> {None, Directive[Thick, Red]}, MaxRecursion -> 0, > AxesLabel -> {x, y}] > Exclusion search effectively works by bracketing the root, so when you have ArcTan jump from -Pi to Pi it will also count as a root, similar to FindRoot[x - Round[x], {x, .25, .75}]. You can try adding a condition that excludes the unwanted region: Plot3D[Arg[((x + I y) E^(-.5 I))], {x, -1, 1}, {y, -1, 1}, Exclusions -> {{Arg[x + I y] == -Pi + 0.5, Abs@ Arg[x + I y] < Pi - .25}}, ExclusionsStyle -> {None, Red}, Method -> {RotationControl -> ArcBall}] Maxim Rytin m.r@inbox.ru === Subject: Re: Exclusions > On Apr 22, 2:39 am, Gulliet pasting. In my notebook, the syntax is correct. I don't expect an automatic exclusion, but I do get an additional > (unwanted) exclusion at y==0 && x<0 when I use the following command: Plot3D[ pdfN[{x, y}], {x, -3, 3}, {y, -3, 3}, PlotRange -> Full, > Mesh -> 30, ColorFunction -> grayColors, PlotPoints -> 50, > ClippingStyle -> None, > Exclusions -> { {ArcTan[x, y] == 0.5, > x > 0 && y > 0}, {ArcTan[x, y] == -Pi + 0.5, x < 0 && y < 0}},= > ExclusionsStyle -> {None, Directive[Thick, Red]}, MaxRecursion -> 0, > AxesLabel -> {x, y}] > Exclusion search effectively works by bracketing the root, so when you have ArcTan jump from -Pi to Pi it will also count as a root, similar to FindRoot[x - Round[x], {x, .25, .75}]. You can try adding a condition that excludes the unwanted region: Plot3D[Arg[((x + I y) E^(-.5 I))], {x, -1, 1}, {y, -1, 1}, Exclusions -> {{Arg[x + I y] == -Pi + 0.5, Abs@ Arg[x + I y] < Pi - .25}}, ExclusionsStyle -> {None, Red}, Method -> {RotationControl -> ArcBall}] Maxim Rytin m.r@inbox.ru === Subject: Re: Dynamic: feature? > I have a cell containing this: > Dynamic[f[a, b]] > Then I do this: > a /: f[a, b] = 12 > and the dynamic cell updates to 12, as I would expect. > When I do this: > b /: f[a, b] = 45 > The dynamic cell does *not* update for some reason. >> It seems as though it does not realize an update has occurred when it >> is associated with b. > Does anyone know why this is? > Chris Weird. I witness the same behavior if the cells are evaluated in the > given order. However, ff one change the order of the assignments (i.e. b > first, then a) Dynamic[] works as expected. Evaluating the following > expressions in that order, Dynamic[f[a, b]] > (* The first output cell is: f[a, b] *) b /: f[a, b] = 45 > (* The first output cell is now: 45 *) a /: f[a, b] = 12 > (* The first output cell is now: 12 *) $Version => 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) I have also recorded the sessions in a PDF file. See http://homepages.nyu.edu/~jmg336/mathematica/weirddynamic.pdf -- A principle rule of debugging Dynamics...consider what Shift-Enter evaluations > do. In this case, exactly the same thing. In fact, Dynamic correctly reflects > what a Shift-Enter evaluation on f[a,b] would do at that very moment. > John Fultz > jfu...@wolfram.com > User Interface Group > Wolfram Research, Inc. It seems that I was creating two separate rules, one associated with a and one associated with b (I had expected the 2nd one to overwrite the 1st). Because a is the first argument, its rule takes precedence. enter does. Chris === Subject: Re: Dynamic: feature? > I have a cell containing this: > Dynamic[f[a, b]] > Then I do this: > a /: f[a, b] = 12 > and the dynamic cell updates to 12, as I would expect. > When I do this: > b /: f[a, b] = 45 > The dynamic cell does *not* update for some reason. >> It seems as though it does not realize an update has occurred when it >> is associated with b. > Does anyone know why this is? > Chris Weird. I witness the same behavior if the cells are evaluated in the > given order. However, ff one change the order of the assignments (i.e. b > first, then a) Dynamic[] works as expected. Evaluating the following > expressions in that order, Dynamic[f[a, b]] > (* The first output cell is: f[a, b] *) b /: f[a, b] = 45 > (* The first output cell is now: 45 *) a /: f[a, b] = 12 > (* The first output cell is now: 12 *) $Version => 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) I have also recorded the sessions in a PDF file. See http://homepages.nyu.edu/~jmg336/mathematica/weirddynamic.pdf -- A principle rule of debugging Dynamics...consider what Shift-Enter evaluations > do. In this case, exactly the same thing. In fact, Dynamic correctly reflects > what a Shift-Enter evaluation on f[a,b] would do at that very moment. > John Fultz > jfu...@wolfram.com > User Interface Group > Wolfram Research, Inc. It seems that I was creating two separate rules, one associated with a and one associated with b (I had expected the 2nd one to overwrite the 1st). Because a is the first argument, its rule takes precedence. enter does. Chris === Subject: Re: installing Playe rPro killed using Mathematica itself: > Such a gross oversight on Wolfram's part is unexpected. I suspect that > unless the problem is fixed in short order that PlayerPro will not make > it for very long. Given all that I have heard, I would not install it on > my system. I am just thankful that my procrastination delayed prevented > this problem for me. I would like to thank all those who quickly alerted > the group. Kevin > I am quite convinced that PlayerPro will be a valuable tool for creating Mathematica applications. The problem discussed is only an inconvenience to the creator of an application, because almost by definition, the recipient will not have Mathematica. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: installing Playe rPro killed using Mathematica itself: > Such a gross oversight on Wolfram's part is unexpected. I suspect that > unless the problem is fixed in short order that PlayerPro will not make > it for very long. Given all that I have heard, I would not install it on > my system. I am just thankful that my procrastination delayed prevented > this problem for me. I would like to thank all those who quickly alerted > the group. Kevin > I am quite convinced that PlayerPro will be a valuable tool for creating Mathematica applications. The problem discussed is only an inconvenience to the creator of an application, because almost by definition, the recipient will not have Mathematica. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: HighlightedEdgeColors with Combinatoric`ShowGraph and AnimateGraph The following works as expected to highlight two of the edges of a graph with a different color each: <{Red,Blue}]] And the docs say that AnimateGraph takes the same options as Highlight. But the following does NOT work -- it uses just the first color, Red, when animating the highlighting of the two edges: AnimateGraph[g, {{1, 2}, {2, 3}}, HighlightedEdgeColors -> {Red, Blue}] What's wrong? (I do know that I used different syntax in the 2nd argument of Highlight, on the one hand, and in the 2nd argument of AnimateGraph, on the other hand. For Highlight to work within ShowGraph so as to animate edges, it is necessary to put the extra level of nesting in each edge specification. But such extra nesting in the case of AnimateGraph would not work: it gives no animation of edges.) -- 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: OpenerView (with cells?) In the Mathematica documentation viewer, it looks as though sections and subsection headers are implemented using an OpenerView that can contain cells. At least when you click on the disclosure triangle next to sections like Examples, More Information, Options, and so on, the view reveals a number of input, output, and text cells. How are those section headers implemented? An ordinary OpenerView, as far as I can tell, cannot contain cells (although you can fake it a little bit using DisplayForm). I looked at the cell expression for one using Show Expression but what I found was just a reference to a stylesheet: Cell[TextData[{ Basic Examples, , Cell[(4), ExampleCount] }], ExampleSection, CellID->454094506] Any ideas on how that effect is achieved? I'd like to use something similar in my own notebooks. Jason -- Dr. J. McKenzie Alexander Department of Philosophy, Logic and Scientific Method London School of Economics and Political Science Houghton Street, London, WC2A 2AE Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm === Subject: Re: OpenerView (with cells?) One other point possible worth making is that a similar effect can be achieved by selecting Mathematica Preferences -> Interface -> Show Open/Close Icons for Cell Groups (on a Mac System). The OpenViewer icon (side-triangle) then appears with the leading cell of all grouped cells in a notebook. Tom Dowling > Put a regular Sectional header in your notebook. Use Ctrl-Shift-E to open > up > the underlying expression. Then add to the cell the option ShowGroupOpenCloseIcon->True. Then, as soon as you have another cell in the section the little triangle > will show and you can use it to open and close the section. These open/close icons are a very nice thing to have and I don't > understand > why they are not present on any of the standard style sheets. This may > seem > like a small thing but some people don't know about the double-clicking on > the brackets, and other people just don't like it. I have a style sheet at > my web site that does have these icons on all sectional groupings - but > not > on anything else. This is similar to the style sheet that comes with > Presentations. This brings up a related question. It would be nice to have some kind of > 'BoxSection' that could contain Text cells and Input/Output cells, but > which > other sections could 'flow around' just like boxes in textbooks or > sidebars > up, and then enter a Text cell after it, the Text cell gets captured by > the > subsection. You can descend in the sectional hierarchy, but you can't get > back up without actually starting a new higher level section. You can't > 'flow around'. It is probably not easy for WRI to implement this. Right now for Presentations I've developed (but haven't included yet) > something called Sidebars that solves this problem. The idea is to have > Sidebar notebooks that are completely contained within a principal > notebook > but display as separate notebook windows. One first uses a MakeSidebar > command to bring up a notebook window with a specified name. One can then > add any desired information to the sidebar notebooks or change its style > sheet just as with an ordinary notebook. But the sidebar notebook is not > savable in the usual manner. Instead, in the principal notebook you can > use > a SaveSidebar command. This creates an initialization Input statement in > the > principal notebook that contains the sidebar notebook, but in skeleton > form > of display. The Sidebars are completely embedded in the principal > notebook. > Then there is a SidebarButton command that creates a distinctive button > that > will launch the Sidebar notebook. A reader can then bring up the Sidebars, > read them, evaluate them and even do their own calculations in them, and > then close them when finished. Sidebars are a very effective method to > provide additional information without disrupting the flow of some > argument, > derivation or proof in a notebook. -- > David Park > djmpark@comcast.net > http://home.comcast.net/~djmpark/ In the Mathematica documentation viewer, it looks as though sections > and subsection headers are implemented using an OpenerView that can > contain cells. At least when you click on the disclosure triangle next > to sections like Examples, More Information, Options, and so on, > the view reveals a number of input, output, and text cells. How are those section headers implemented? An ordinary OpenerView, as > far as I can tell, cannot contain cells (although you can fake it a > little bit using DisplayForm). I looked at the cell expression for > one using Show Expression but what I found was just a reference to a > stylesheet: Cell[TextData[{ > Basic Examples, > , > Cell[(4), ExampleCount] > }], ExampleSection, > CellID->454094506] Any ideas on how that effect is achieved? I'd like to use something > similar in my own notebooks. > Jason -- > Dr. J. McKenzie Alexander > Department of Philosophy, Logic and Scientific Method > London School of Economics and Political Science > Houghton Street, London, WC2A 2AE > === Subject: Re: Fourier transform in arbitrary dimension? Hi Barrow, I think the easiest would be to go to hyperspherical coordinates. Calling theta the angle between Q and x, such that Qcdot x = q*x*cos(theta), the transformation is d^Dq --> P(D) * q^{d-1} * sin(theta)^{d-2} dq dtheta with P(D) = 2 * pi^{(D-1)/2} / Gamma((D-1)/2) In Mathematica writing: substituting d for D because of pre-assigned meaning of D, P[d_] = 2*Pi^((d-1)/2)/Gamma[(d-1)/2]; A[d_] := Integrate[q^(d-1) Sin[th]^(d-2) P[d]/(2 Pi)^d*Exp[- I*q*x*Cos[th]] * 1/q^2, {q, 0, Infinity}, {th, 0, Pi}, Assumptions -> x > 0] Doing the angular integral first, you get A[d_] := Integrate[(q^(d/2)*x^(1-d/2)*BesselJ[d/2-1,q*x])/(2*Pi)^(d/2) * 1/q^2, {q, 0, Infinity}, Assumptions -> x > 0] where your function to be transformed, 1/q^2, is still recognizable. Mathematica cannot do this last step directly; it takes some manual fiddling with intermediate results to see that the angular integral is really just a Bessel function. Assuming that 1/q^2 is really the function you wish to transform, you can simplify by substituting z=q*x, getting A[d_] := (2*Pi)^(-d/2) * x^(2-d) * Integrate[z^(d/2-2)*BesselJ[d/ 2-1,z], {z, 0, Infinity}] This integral does not converge for d>=5. However, it is oscillatory, and by neglecting the oscillating part we can get a decent result: J[d_, Z_] = Integrate[z^(d/2-2)*BesselJ[d/2-1, z], {z, 0, Z}, Assumptions -> {Z > 0, d > 2}]; Series[J[d, Z], {Z, Infinity, 0}] // Normal // Expand You see that the result contains three terms: the first two are oscillatory, and the third one is constant in Z, equal to 2^(d/2-2)*Gamma[d/2-1]. Only the last one is relevant. Putting everything together, the result of the d-dimensional Fourier transform of 1/q^2 is A[d_] = Gamma[d/2-1]/(4*Pi^(d/2)*x^(d-2)) Since you knew this already (up to the prefactor), I hope you are more interested in the general solution. The last step, neglecting the divergent oscillatory terms in the integral for d>=5, is a bit icky, but seems to work. Maybe somebody else has a good explanation of what's happening here? Roman. I would like to calculate a Fourier transform in arbitrary dimension > , say D, of the function 1/q^2, where q denotes the absolute value > of a D dimensional spatial vector. > The integral I have to perform is int frac{d^Dq}{(2pi)^D}exp(-iQcdot x)frac{1}{q^2} where |Q| = q. > But I can't find a way to tell Mathematica to calculate this integral > of dimension D. > PS. The answer is proportional to Gamma(D/2 - 1)(x^2/4)^{1-D/2} Any ideas would be appreciated. === Subject: Re: Fourier transform in arbitrary dimension? Hi Barrow, I think the easiest would be to go to hyperspherical coordinates. Calling theta the angle between Q and x, such that Qcdot x = q*x*cos(theta), the transformation is d^Dq --> P(D) * q^{d-1} * sin(theta)^{d-2} dq dtheta with P(D) = 2 * pi^{(D-1)/2} / Gamma((D-1)/2) In Mathematica writing: substituting d for D because of pre-assigned meaning of D, P[d_] = 2*Pi^((d-1)/2)/Gamma[(d-1)/2]; A[d_] := Integrate[q^(d-1) Sin[th]^(d-2) P[d]/(2 Pi)^d*Exp[- I*q*x*Cos[th]] * 1/q^2, {q, 0, Infinity}, {th, 0, Pi}, Assumptions -> x > 0] Doing the angular integral first, you get A[d_] := Integrate[(q^(d/2)*x^(1-d/2)*BesselJ[d/2-1,q*x])/(2*Pi)^(d/2) * 1/q^2, {q, 0, Infinity}, Assumptions -> x > 0] where your function to be transformed, 1/q^2, is still recognizable. Mathematica cannot do this last step directly; it takes some manual fiddling with intermediate results to see that the angular integral is really just a Bessel function. Assuming that 1/q^2 is really the function you wish to transform, you can simplify by substituting z=q*x, getting A[d_] := (2*Pi)^(-d/2) * x^(2-d) * Integrate[z^(d/2-2)*BesselJ[d/ 2-1,z], {z, 0, Infinity}] This integral does not converge for d>=5. However, it is oscillatory, and by neglecting the oscillating part we can get a decent result: J[d_, Z_] = Integrate[z^(d/2-2)*BesselJ[d/2-1, z], {z, 0, Z}, Assumptions -> {Z > 0, d > 2}]; Series[J[d, Z], {Z, Infinity, 0}] // Normal // Expand You see that the result contains three terms: the first two are oscillatory, and the third one is constant in Z, equal to 2^(d/2-2)*Gamma[d/2-1]. Only the last one is relevant. Putting everything together, the result of the d-dimensional Fourier transform of 1/q^2 is A[d_] = Gamma[d/2-1]/(4*Pi^(d/2)*x^(d-2)) Since you knew this already (up to the prefactor), I hope you are more interested in the general solution. The last step, neglecting the divergent oscillatory terms in the integral for d>=5, is a bit icky, but seems to work. Maybe somebody else has a good explanation of what's happening here? Roman. I would like to calculate a Fourier transform in arbitrary dimension > , say D, of the function 1/q^2, where q denotes the absolute value > of a D dimensional spatial vector. > The integral I have to perform is int frac{d^Dq}{(2pi)^D}exp(-iQcdot x)frac{1}{q^2} where |Q| = q. > But I can't find a way to tell Mathematica to calculate this integral > of dimension D. > PS. The answer is proportional to Gamma(D/2 - 1)(x^2/4)^{1-D/2} Any ideas would be appreciated. === Subject: Re: ? (*now Do and Table*) Craig, Just a (tongue in cheek) reminder that Mathematica is a wonderful all purpose environment in which to do Mathematics. 221 years ago the 10 year old Gauss would have solved the problem by coding:- n = 10000000; Timing[total = n (n + 1)/2] {0.000035, 50000005000000} Which is a whole lot faster! I realize that this is not very helpful in deciding usage of Table vs Do. But the precocious Gauss also might have tried Timing[total = Table[i (i + 1)/2, {i, 10000000}]] {20.46425400000001, {1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, <<9999974>>, 49999885000066, 49999895000055, 49999905000045, 49999915000036, 49999925000028, 49999935000021, 49999945000015, 49999955000010, 49999965000006, 49999975000003, 49999985000001, 49999995000000, 50000005000000}} or better yet Timing[Total[Table[i (i + 1)/2, {i, 10000000}]]] {31.7433, 166666716666670000000} Just to show off ... :) PS Where would we be now if Stephen Wolfram had provided Gauss with a free Mathematica License back then? BTW What a surprising result (1666667)(1666667)(0000000) I wonder if anyone has computed this result before and explained its repetition of the first 7 digits? Syd Geraghty B.Sc, M.Sc. sydgeraghty@mac.com My System Mathematica 6.0.2.1 for Mac OS X x86 (64 - bit) (March 13, 2008) MacOS X V 10.5.2 > This is problem with a known simple result, but it will serve: let's > find the sum of the first 10000000 integers. (*let's use a do loop*) > Timing[ > icount = 0; > Do[icount = icount + i, {i, 1, 10000000, 1}]; > icount > ] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > Total[Table[i, {i, 1, 10000000, 1}]] > ] (*This returns {3.25516, 50000005000000} on my machine*) === Subject: Re: ? (*now Do and Table*) Craig, Just a (tongue in cheek) reminder that Mathematica is a wonderful all purpose environment in which to do Mathematics. 221 years ago the 10 year old Gauss would have solved the problem by coding:- n = 10000000; Timing[total = n (n + 1)/2] {0.000035, 50000005000000} Which is a whole lot faster! I realize that this is not very helpful in deciding usage of Table vs Do. But the precocious Gauss also might have tried Timing[total = Table[i (i + 1)/2, {i, 10000000}]] {20.46425400000001, {1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, <<9999974>>, 49999885000066, 49999895000055, 49999905000045, 49999915000036, 49999925000028, 49999935000021, 49999945000015, 49999955000010, 49999965000006, 49999975000003, 49999985000001, 49999995000000, 50000005000000}} or better yet Timing[Total[Table[i (i + 1)/2, {i, 10000000}]]] {31.7433, 166666716666670000000} Just to show off ... :) PS Where would we be now if Stephen Wolfram had provided Gauss with a free Mathematica License back then? BTW What a surprising result (1666667)(1666667)(0000000) I wonder if anyone has computed this result before and explained its repetition of the first 7 digits? Syd Geraghty B.Sc, M.Sc. sydgeraghty@mac.com My System Mathematica 6.0.2.1 for Mac OS X x86 (64 - bit) (March 13, 2008) MacOS X V 10.5.2 > This is problem with a known simple result, but it will serve: let's > find the sum of the first 10000000 integers. (*let's use a do loop*) > Timing[ > icount = 0; > Do[icount = icount + i, {i, 1, 10000000, 1}]; > icount > ] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > Total[Table[i, {i, 1, 10000000, 1}]] > ] (*This returns {3.25516, 50000005000000} on my machine*) === Subject: ReplacePart and Compile in Mathematica 6.0 the syntax of the function ReplacePart[] changed significantly as compared to earlier versions. While the old syntax is not documented any more, it still seems to work in V6.0.2.1: New syntax: ReplacePart[{1, 2, 3}, 3 -> 1] {1, 2, 1} Old, now undocumented syntax: ReplacePart[{1, 2, 3}, 1, 3] {1, 2, 1} Unfortunately, in compiled functions the new syntax does not seem to work Compile[{}, ReplacePart[{1, 2, 3}, 3 -> 1]] // InputForm During evaluation of In[14]:= ReplacePart::argrx: ReplacePart called with 2 arguments; 3 arguments are expected. >> CompiledFunction[{}, {{2, 1, 1}}, {0, 3, 0, 0, 2}, {{1, 5}, {45, {1, 2, 3}, 2, 3, 0}, {54, Function[{}, 3 -> 1],2,0, 2}, {55, ReplacePart, 2, 1, 0, 2, 0, 2, 2, 1, 1}, {2}}, Function[{}, ReplacePart[{1, 2, 3}, 3 -> 1]], Evaluate] while the old syntax produces nicely compiled code: InputForm[Compile[{}, ReplacePart[{1, 2, 3}, 1, 3]]] CompiledFunction[{}, {{2, 1, 0}}, {0, 2, 0, 0, 1}, {{1, 5}, {45, {1, 2, 3}, 2, 3, 0}, {7, 3, 0}, {7, 1, 1}, {71, 0, 0, 0, 0, 1}, {2}}, Function[{}, ReplacePart[{1, 2, 3}, 1, 3]], Evaluate] This situation is somewhat confusing (the error message seems to be clearly wrong) and either a bug or a misconception on my side? Is it intended that the new ReplacePart cannot be compiled any more? Is the documentation of ReplacePart in V6 incomplete, and should also mention the old syntax? (More generally: Could it be annotated in the documentation, which functions can be compiled and which functions cannot be compiled. For me it is always an adventure to figure out a compiled version of a routine I need, because of this lack of basic information.) Michael Weyrauch === Subject: 2*m^z - m^z = ? What do you think about this: Table[ {2*m^z - m^z, FullSimplify[2*m^z - m^z]}, {m, 1, 21}] // TableForm The answer is very interesting (only odd numbers are treated well): 1 1 -2^z + 2^(1 + z) 2^z 3^z 3^z 2^(1 + 2*z) - 4^z 4^z 5^z 5^z 2^(1 + z)*3^z - 6^z 2^(1 + z)*3^z - 6^z 7^z 7^z 2^(1 + 3*z) - 8^z 8^z 9^z 9^z 2^(1 + z)*5^z - 10^z 2^(1 + z)*5^z - 10^z 11^z 11^z 2^(1 + 2*z)*3^z - 12^z 2^(1 + 2*z)*3^z - 12^z 13^z 13^z 2^(1 + z)*7^z - 14^z 2^(1 + z)*7^z - 14^z 15^z 15^z 2^(1 + 4*z) - 16^z 16^z 17^z 17^z 2^(1 + z)*9^z - 18^z 2^(1 + z)*9^z - 18^z 19^z 19^z 2^(1 + 2*z)*5^z - 20^z 2^(1 + 2*z)*5^z - 20^z 21^z 21^z Can anyone explain the reason for this behavior? === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) And I was surprised much more when I have tried the more simple form of the first expression: Timing[icount = 0; Do[icount += i, {i, 1, 10000000, 1}]; icount] (*this returns {36.042, 50000005000000} on my machine*) It means that using the += operator takes about 50% more time than the usual form icount = icount + i; It is sad and very surprising! Table is usually a better choice than Do, but that is a choice and the= > language is accommodating enough to allow you to make that choice; and= > if you should be curious, to explore. > =9A_Why_ (or, in what circumstances?) would Table be a better choice tha= n Do? =9AI appreciate that their logical behavior is similar, and indeed they = can be > coded very similarly. I am happy to try to answer. I'll take the time to answer at length, because I find that many > people that I try to help out have similar viewpoints as yours. > Perhaps, I may have something useful to contribute. Primarily, it is a matter of choice and familiarity. =9AAnd they (Table > and Do) are just about interchangeable, except in a few unusual (and > technical) cases. =9ATable's advantage is speed and efficiency. (Once I > asked someone at Wolfram how I should explain this to my students, and > the kind answer was because Do has to access the =9Amain kernel's > evaluation loop, and Table doesn't). =9AI'll try to demonstrate this as an example. I'll try to explain my > steps carefully, and I'll avoid the use of #&/.^= syntax. =9AIt took me > a while to cook this up--I hope that my example doesn't go amiss. This is problem with a known simple result, but it will serve: let's > find the sum of the first 10000000 integers. (*let's use a do loop*) > Timing[ > =9Aicount = 0; > =9ADo[icount = icount + i, {i, 1, 10000000, 1}]; > =9Aicount > =9A] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > =9ATotal[Table[i, {i, 1, 10000000, 1}]] > =9A] (*This returns {3.25516, 50000005000000} on my machine*) This is a simple example, but it illustrates the difference nicely. ( > Personally, I've yet to > find a case for which I can replace a Do with a Table or similar list > construct, although I am sure readers of this group could easily > construct one as a challenge.) Another way to think of this is that Mathematica is very good at > operating on lists. =9ATable and Lists work together nicely, and many of > the functions like Total are designed to help you make your > programming easier. Now, if you put yourself =9Ain the mind of a beginner who has neither > seen Do, For, While, or Table. Which style would you recommend based > on speed alone? =9AWhich style would you recommend on readability alone? So, a typical beginning user might find themselves tending to use > Lists. =9AThey are content for a couple years, but soon master the idea > so that begin to do what is natural, abbreviate (ASAP, RJ46, LOL, > AWOL, PM. FM...). =9AThey find shortcuts and optimize their time: First attempt may be something like this: > (*create a list*) Table[i,{i,1,10000000}] (*horrors, the output is too long, and I know what it might look like anyw= ay*) (*they graduate to this*) > mytable= Table[i,{i,1,1000000}]; > Total[mytable] (* soon they get tired of typing and find an abbreviated version *) Total[Table[i,{i,1,1000000}]] (* soon they get tired of moving around the screen to type the two bracket= s,*) > (* so they find another way to do the same thing, no better, arguably > less readable > (*at first*) > Total@Total[Table[i,{i,1,1000000}] > (*or, depending on where your cursor tends to be sitting*) > Table[i, {i, 1, 1000000}] // Total (*thus they learn a semaphore for analogous constructs*) > (*but there's more, with ever more symbols, the efficiency and power goes*= ) > (*up rapidly, but the readability goes down for beginners*) > (*where you find the happy medium is entirely up to you*) In my opinion, this is the fun part of mathematica. I get to decide > how to share the labor with mathematica, and I get to decide how > obscure to make my code. =9ASometimes, for my own pleasure, I write it > as obscurely as possible (and I am no master at this by a long shot). > If I am writing code that I hope someone else will use and modify, or > learn from, I try to write as readable as possible. -- W. Craig Carter === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) I should notice that it is VERY strange behavour that the simplest Do[] loop takes MUCH more time than constructing a list of elements and summing them. I do not understand the reason. It looks like a defect. W_Craig Carter: Table is usually a better choice than Do, but that is a choice and the > language is accommodating enough to allow you to make that choice; and > if you should be curious, to explore. > _Why_ (or, in what circumstances?) would Table be a better choice than Do? I appreciate that their logical behavior is similar, and indeed they can be > coded very similarly. I am happy to try to answer. I'll take the time to answer at length, because I find that many > people that I try to help out have similar viewpoints as yours. > Perhaps, I may have something useful to contribute. Primarily, it is a matter of choice and familiarity. And they (Table > and Do) are just about interchangeable, except in a few unusual (and > technical) cases. Table's advantage is speed and efficiency. (Once I > asked someone at Wolfram how I should explain this to my students, and > the kind answer was because Do has to access the main kernel's > evaluation loop, and Table doesn't). I'll try to demonstrate this as an example. I'll try to explain my > steps carefully, and I'll avoid the use of #&/.^= syntax. It took me > a while to cook this up--I hope that my example doesn't go amiss. This is problem with a known simple result, but it will serve: let's > find the sum of the first 10000000 integers. (*let's use a do loop*) > Timing[ > icount = 0; > Do[icount = icount + i, {i, 1, 10000000, 1}]; > icount > ] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > Total[Table[i, {i, 1, 10000000, 1}]] > ] (*This returns {3.25516, 50000005000000} on my machine*) This is a simple example, but it illustrates the difference nicely. ( > Personally, I've yet to > find a case for which I can replace a Do with a Table or similar list > construct, although I am sure readers of this group could easily > construct one as a challenge.) > Another way to think of this is that Mathematica is very good at > operating on lists. Table and Lists work together nicely, and many of > the functions like Total are designed to help you make your > programming easier. Now, if you put yourself in the mind of a beginner who has neither > seen Do, For, While, or Table. Which style would you recommend based > on speed alone? Which style would you recommend on readability alone? So, a typical beginning user might find themselves tending to use > Lists. They are content for a couple years, but soon master the idea > so that begin to do what is natural, abbreviate (ASAP, RJ46, LOL, > AWOL, PM. FM...). They find shortcuts and optimize their time: First attempt may be something like this: > (*create a list*) Table[i,{i,1,10000000}] (*horrors, the output is too long, and I know what it might look like anyway*) (*they graduate to this*) > mytable= Table[i,{i,1,1000000}]; > Total[mytable] (* soon they get tired of typing and find an abbreviated version *) Total[Table[i,{i,1,1000000}]] (* soon they get tired of moving around the screen to type the two brackets,*) > (* so they find another way to do the same thing, no better, arguably > less readable > (*at first*) > Total@Total[Table[i,{i,1,1000000}] > (*or, depending on where your cursor tends to be sitting*) > Table[i, {i, 1, 1000000}] // Total (*thus they learn a semaphore for analogous constructs*) > (*but there's more, with ever more symbols, the efficiency and power goes*) > (*up rapidly, but the readability goes down for beginners*) > (*where you find the happy medium is entirely up to you*) > In my opinion, this is the fun part of mathematica. I get to decide > how to share the labor with mathematica, and I get to decide how > obscure to make my code. Sometimes, for my own pleasure, I write it > as obscurely as possible (and I am no master at this by a long shot). > If I am writing code that I hope someone else will use and modify, or > learn from, I try to write as readable as possible. > -- W. Craig Carter === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) > (*let's use a do loop*) > Timing[ > =9Aicount = 0; > =9ADo[icount = icount + i, {i, 1, 10000000, 1}]; > =9Aicount > =9A] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > =9ATotal[Table[i, {i, 1, 10000000, 1}]] > =9A] (*This returns {3.25516, 50000005000000} on my machine*) W. Craig Carter Lets try the following: mmu = MaxMemoryUsed[]; Timing[icount = 0; Do[icount = icount + i, {i, 1, 10000000, 1}]; icount] MaxMemoryUsed[] - mmu (*This returns {25.657, 50000005000000} 1118080 on my machine*) mmu = MaxMemoryUsed[]; Timing[Total[Table[i, {i, 1, 10000000, 1}]]] MaxMemoryUsed[] - mmu (*This returns {7.651, 50000005000000} 479959784 on my machine but takes much more time because of using PAGEFILE*) 479959784/1118080=429.271 Constructing Table takes 429 times more memory than using Do[]! === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) And I was surprised much more when I have tried the more simple form of the first expression: Timing[icount = 0; Do[icount += i, {i, 1, 10000000, 1}]; icount] (*this returns {36.042, 50000005000000} on my machine*) It means that using the += operator takes about 50% more time than the usual form icount = icount + i; It is sad and very surprising! Table is usually a better choice than Do, but that is a choice and the= > language is accommodating enough to allow you to make that choice; and= > if you should be curious, to explore. > =9A_Why_ (or, in what circumstances?) would Table be a better choice tha= n Do? =9AI appreciate that their logical behavior is similar, and indeed they = can be > coded very similarly. I am happy to try to answer. I'll take the time to answer at length, because I find that many > people that I try to help out have similar viewpoints as yours. > Perhaps, I may have something useful to contribute. Primarily, it is a matter of choice and familiarity. =9AAnd they (Table > and Do) are just about interchangeable, except in a few unusual (and > technical) cases. =9ATable's advantage is speed and efficiency. (Once I > asked someone at Wolfram how I should explain this to my students, and > the kind answer was because Do has to access the =9Amain kernel's > evaluation loop, and Table doesn't). =9AI'll try to demonstrate this as an example. I'll try to explain my > steps carefully, and I'll avoid the use of #&/.^= syntax. =9AIt took me > a while to cook this up--I hope that my example doesn't go amiss. This is problem with a known simple result, but it will serve: let's > find the sum of the first 10000000 integers. (*let's use a do loop*) > Timing[ > =9Aicount = 0; > =9ADo[icount = icount + i, {i, 1, 10000000, 1}]; > =9Aicount > =9A] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > =9ATotal[Table[i, {i, 1, 10000000, 1}]] > =9A] (*This returns {3.25516, 50000005000000} on my machine*) This is a simple example, but it illustrates the difference nicely. ( > Personally, I've yet to > find a case for which I can replace a Do with a Table or similar list > construct, although I am sure readers of this group could easily > construct one as a challenge.) Another way to think of this is that Mathematica is very good at > operating on lists. =9ATable and Lists work together nicely, and many of > the functions like Total are designed to help you make your > programming easier. Now, if you put yourself =9Ain the mind of a beginner who has neither > seen Do, For, While, or Table. Which style would you recommend based > on speed alone? =9AWhich style would you recommend on readability alone? So, a typical beginning user might find themselves tending to use > Lists. =9AThey are content for a couple years, but soon master the idea > so that begin to do what is natural, abbreviate (ASAP, RJ46, LOL, > AWOL, PM. FM...). =9AThey find shortcuts and optimize their time: First attempt may be something like this: > (*create a list*) Table[i,{i,1,10000000}] (*horrors, the output is too long, and I know what it might look like anyw= ay*) (*they graduate to this*) > mytable= Table[i,{i,1,1000000}]; > Total[mytable] (* soon they get tired of typing and find an abbreviated version *) Total[Table[i,{i,1,1000000}]] (* soon they get tired of moving around the screen to type the two bracket= s,*) > (* so they find another way to do the same thing, no better, arguably > less readable > (*at first*) > Total@Total[Table[i,{i,1,1000000}] > (*or, depending on where your cursor tends to be sitting*) > Table[i, {i, 1, 1000000}] // Total (*thus they learn a semaphore for analogous constructs*) > (*but there's more, with ever more symbols, the efficiency and power goes*= ) > (*up rapidly, but the readability goes down for beginners*) > (*where you find the happy medium is entirely up to you*) In my opinion, this is the fun part of mathematica. I get to decide > how to share the labor with mathematica, and I get to decide how > obscure to make my code. =9ASometimes, for my own pleasure, I write it > as obscurely as possible (and I am no master at this by a long shot). > If I am writing code that I hope someone else will use and modify, or > learn from, I try to write as readable as possible. -- W. Craig Carter === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) I should notice that it is VERY strange behavour that the simplest Do[] loop takes MUCH more time than constructing a list of elements and summing them. I do not understand the reason. It looks like a defect. W_Craig Carter: Table is usually a better choice than Do, but that is a choice and the > language is accommodating enough to allow you to make that choice; and > if you should be curious, to explore. > _Why_ (or, in what circumstances?) would Table be a better choice than Do? I appreciate that their logical behavior is similar, and indeed they can be > coded very similarly. I am happy to try to answer. I'll take the time to answer at length, because I find that many > people that I try to help out have similar viewpoints as yours. > Perhaps, I may have something useful to contribute. Primarily, it is a matter of choice and familiarity. And they (Table > and Do) are just about interchangeable, except in a few unusual (and > technical) cases. Table's advantage is speed and efficiency. (Once I > asked someone at Wolfram how I should explain this to my students, and > the kind answer was because Do has to access the main kernel's > evaluation loop, and Table doesn't). I'll try to demonstrate this as an example. I'll try to explain my > steps carefully, and I'll avoid the use of #&/.^= syntax. It took me > a while to cook this up--I hope that my example doesn't go amiss. This is problem with a known simple result, but it will serve: let's > find the sum of the first 10000000 integers. (*let's use a do loop*) > Timing[ > icount = 0; > Do[icount = icount + i, {i, 1, 10000000, 1}]; > icount > ] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > Total[Table[i, {i, 1, 10000000, 1}]] > ] (*This returns {3.25516, 50000005000000} on my machine*) This is a simple example, but it illustrates the difference nicely. ( > Personally, I've yet to > find a case for which I can replace a Do with a Table or similar list > construct, although I am sure readers of this group could easily > construct one as a challenge.) > Another way to think of this is that Mathematica is very good at > operating on lists. Table and Lists work together nicely, and many of > the functions like Total are designed to help you make your > programming easier. Now, if you put yourself in the mind of a beginner who has neither > seen Do, For, While, or Table. Which style would you recommend based > on speed alone? Which style would you recommend on readability alone? So, a typical beginning user might find themselves tending to use > Lists. They are content for a couple years, but soon master the idea > so that begin to do what is natural, abbreviate (ASAP, RJ46, LOL, > AWOL, PM. FM...). They find shortcuts and optimize their time: First attempt may be something like this: > (*create a list*) Table[i,{i,1,10000000}] (*horrors, the output is too long, and I know what it might look like anyway*) (*they graduate to this*) > mytable= Table[i,{i,1,1000000}]; > Total[mytable] (* soon they get tired of typing and find an abbreviated version *) Total[Table[i,{i,1,1000000}]] (* soon they get tired of moving around the screen to type the two brackets,*) > (* so they find another way to do the same thing, no better, arguably > less readable > (*at first*) > Total@Total[Table[i,{i,1,1000000}] > (*or, depending on where your cursor tends to be sitting*) > Table[i, {i, 1, 1000000}] // Total (*thus they learn a semaphore for analogous constructs*) > (*but there's more, with ever more symbols, the efficiency and power goes*) > (*up rapidly, but the readability goes down for beginners*) > (*where you find the happy medium is entirely up to you*) > In my opinion, this is the fun part of mathematica. I get to decide > how to share the labor with mathematica, and I get to decide how > obscure to make my code. Sometimes, for my own pleasure, I write it > as obscurely as possible (and I am no master at this by a long shot). > If I am writing code that I hope someone else will use and modify, or > learn from, I try to write as readable as possible. > -- W. Craig Carter === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) > (*let's use a do loop*) > Timing[ > =9Aicount = 0; > =9ADo[icount = icount + i, {i, 1, 10000000, 1}]; > =9Aicount > =9A] (*this returns {10.2826, 50000005000000} on my machine.*) > (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) > Timing[ > =9ATotal[Table[i, {i, 1, 10000000, 1}]] > =9A] (*This returns {3.25516, 50000005000000} on my machine*) W. Craig Carter Lets try the following: mmu = MaxMemoryUsed[]; Timing[icount = 0; Do[icount = icount + i, {i, 1, 10000000, 1}]; icount] MaxMemoryUsed[] - mmu (*This returns {25.657, 50000005000000} 1118080 on my machine*) mmu = MaxMemoryUsed[]; Timing[Total[Table[i, {i, 1, 10000000, 1}]]] MaxMemoryUsed[] - mmu (*This returns {7.651, 50000005000000} 479959784 on my machine but takes much more time because of using PAGEFILE*) 479959784/1118080=429.271 Constructing Table takes 429 times more memory than using Do[]! === Subject: Re: Defining output formats Hi Szabolcs, this seems a bug of TeXForm. In other forms it seems to work. If you say: Format[x]:={bf x}; without explizite format, your example seems to work: In[3]:= TeXForm[1+x^2] Out[3]//TeXForm= text{${backslash backslash $bf x$}$}^2+1 hope this helps, Daniel > On the doc page tutorial/DefiningOutputFormats there is an example: > This specifies the TeXForm for the symbol x. In[1]:= Format[x, TeXForm] := {bf x} The output format for x that you specified is now used whenever the TeX > form is needed. In[2]:= TeXForm[1 + x^2] Out[2]//TeXForm= > x^2+1 > Quite obviously, this does not work in the way the documentation > suggests. I would have expected {bf x}^2 + 1. Let's try another example: In[3]:= TeXForm[x] Out[3]//TeXForm= > text{${backslash backslash $bf x$}$} So is there a way to tell Mathematica that x should always be formatted > in bold in TeXForm? > === Subject: Re: Defining output formats Hi Szabolcs, this seems a bug of TeXForm. In other forms it seems to work. If you say: Format[x]:={bf x}; without explizite format, your example seems to work: In[3]:= TeXForm[1+x^2] Out[3]//TeXForm= text{${backslash backslash $bf x$}$}^2+1 hope this helps, Daniel > On the doc page tutorial/DefiningOutputFormats there is an example: > This specifies the TeXForm for the symbol x. In[1]:= Format[x, TeXForm] := {bf x} The output format for x that you specified is now used whenever the TeX > form is needed. In[2]:= TeXForm[1 + x^2] Out[2]//TeXForm= > x^2+1 > Quite obviously, this does not work in the way the documentation > suggests. I would have expected {bf x}^2 + 1. Let's try another example: In[3]:= TeXForm[x] Out[3]//TeXForm= > text{${backslash backslash $bf x$}$} So is there a way to tell Mathematica that x should always be formatted > in bold in TeXForm? > === Subject: Re: Wolfram User Interface Research? >>It's really all a matter of what one has learned, and how well, and >>how accustomed one is to the language. As just one rather >>simple-minded example, suppose you want to form the running >>cumulative sum of a list (in APL-speak, a vector) of numbers. In >>APL, this is given by >>+ vec >But I suspect that most users of Mathematica are mathematicians (or >physicists or engineers or the like) and so come from a background >of standard mathematical notation. Whilst Mathematica does try hard >to stick with this it doesn't always and special symbols (like #, @) >and so on are not transparent to a new user and not something that >you would ordinarily search on. I have the advantage of an old >fashioned thing made of paper, with hard covers (called a book) for >Mathematica 5 and can flick through, see a symbol I don't recognise >and read about it and think there may be better ways of expressing >things than the way I am used to. While I also have the book that came with earlier versions of Mathematica and find it useful, it is very easy to determine what new symbols do without the book. And the documentation in version 6, while harder to browse, is much more efficient for finding information on a known symbol. For example, if I type @@ in a cell, select what I typed and use the keyboard short cut (cmd-shift-f on a Mac) I am almost instantly taken to a page that provides considerable detail as to what this is and how it can be used. >With an online help I don't know that you would ever go and just look >up random symbols unless someone had pointed you in the right direction. The online documentation certainly isn't optimum for say finding all odd symbols used in Mathematica. Browsing the book is better for this. But once you know a symbol is used, the new document center is very efficient for finding information for that symbol. === Subject: 9th International Mathematica Conference 2008 9th International Mathematica Conference 2008 20-24th of June, Maastricht, the Netherlands the International Mathematica Conference is the (bi-)annual event by and for all Mathematica enthusiasts worldwide. Attendants from all continents except Antarctica come to Maastricht this year to exhibit their exciting Mathematica applications, to learn about the latest Mathematica features from key developers, and to celebrate Mathematica's 20th anniversary. The International Mathematica Symposium is a 2-track, 5-day, interdisciplinary conference with topics ranging from theoretical physics, engineering, and education to medicine, art, and law. The common denominator is Mathematica, its core technologies and applied mathematics. You can find more information on our website www.ims08.org. The submission deadline has passed but do not miss the early registration deadline on the 1st of May. You may never discover the full potential of Mathematica if you do not join the global community of Mathematica users! We hope to welcome you in Maastricht, a delightful, medieval city in the heart of Europe, right next to Aachen, Germany. the IMS'08 organizing committee P.S. for budget minded travelers we have compiled a list of cheap but good hotels in Maastricht that are still available: Orangerie, =80 77, www.hotels.nl/maastricht/orangerie/ Hotel Poshoorn, =80 80, (still available, except Saturday) www.poshoorn.nl Hotel Randwyck, =80 60, (only very few rooms) www.hotelrandwyck.nl/en/home/Booking.com StayOkay Maastricht, dorm beds, =80 26, membership HI required: www.stayokay.com/index.php?pageID=3207&hostelID=356047 Hotel Les Charmes, =80 105, 200 meter from conference location: www.hotellescharmes.nl/uk/index.htm WeekendjeWeg, =80 50-90, almost full: www.weekendjeweg.nl/hotels/nl/hotel-maastricht/?mf=9&df=18 === Subject: 9th International Mathematica Conference 2008 9th International Mathematica Conference 2008 20-24th of June, Maastricht, the Netherlands the International Mathematica Conference is the (bi-)annual event by and for all Mathematica enthusiasts worldwide. Attendants from all continents except Antarctica come to Maastricht this year to exhibit their exciting Mathematica applications, to learn about the latest Mathematica features from key developers, and to celebrate Mathematica's 20th anniversary. The International Mathematica Symposium is a 2-track, 5-day, interdisciplinary conference with topics ranging from theoretical physics, engineering, and education to medicine, art, and law. The common denominator is Mathematica, its core technologies and applied mathematics. You can find more information on our website www.ims08.org. The submission deadline has passed but do not miss the early registration deadline on the 1st of May. You may never discover the full potential of Mathematica if you do not join the global community of Mathematica users! We hope to welcome you in Maastricht, a delightful, medieval city in the heart of Europe, right next to Aachen, Germany. the IMS'08 organizing committee P.S. for budget minded travelers we have compiled a list of cheap but good hotels in Maastricht that are still available: Orangerie, =80 77, www.hotels.nl/maastricht/orangerie/ Hotel Poshoorn, =80 80, (still available, except Saturday) www.poshoorn.nl Hotel Randwyck, =80 60, (only very few rooms) www.hotelrandwyck.nl/en/home/Booking.com StayOkay Maastricht, dorm beds, =80 26, membership HI required: www.stayokay.com/index.php?pageID=3207&hostelID=356047 Hotel Les Charmes, =80 105, 200 meter from conference location: www.hotellescharmes.nl/uk/index.htm WeekendjeWeg, =80 50-90, almost full: www.weekendjeweg.nl/hotels/nl/hotel-maastricht/?mf=9&df=18 === Subject: Re: Print[Plot] vs Print[text,Plot]? There are a *lot* of extremely useful things New in 6.0 that are very > much worth the effort to learn. > Yes, I totally agree. So, could you please point me to the well-organized, well-written, well-illustrated introduction to (repeat: Introduction to, not Detailed Reference Documentation for) the most important and useful of these new things (and the ones most changed since 5.n), --that I can order for $20 or $30 from amazon (a very small fraction of the cost of Mathematica itself) (although something that, with more savvy software developers, comes in the box with the product itself) --and can read in the evening, or on my next plane trip, or in the dentist's waiting room, or during a particularly dull meeting --and can thereby get an _overview_ --- a _roadmap_ -- a _preview_ --- of these useful new things, to let me know what I need to dig into further to meet my particular, specific needs as a user (and which of these I won't immediately need and can ignore). What? You want me to go to the Mathematica Documentation Center? Several _hundred_ tersely labeled clickable links just on the initial page? Each of which leads, not to a simple introduction, but to a complex formal documentation page with multiple further links to click? And all of which can only be read and navigated _on screen_? You and I, I'm afraid, just think differently. === Subject: Re: Print[Plot] vs Print[text,Plot]? There are a *lot* of extremely useful things New in 6.0 that are very > much worth the effort to learn. > Yes, I totally agree. So, could you please point me to the well-organized, well-written, well-illustrated introduction to (repeat: Introduction to, not Detailed Reference Documentation for) the most important and useful of these new things (and the ones most changed since 5.n), --that I can order for $20 or $30 from amazon (a very small fraction of the cost of Mathematica itself) (although something that, with more savvy software developers, comes in the box with the product itself) --and can read in the evening, or on my next plane trip, or in the dentist's waiting room, or during a particularly dull meeting --and can thereby get an _overview_ --- a _roadmap_ -- a _preview_ --- of these useful new things, to let me know what I need to dig into further to meet my particular, specific needs as a user (and which of these I won't immediately need and can ignore). What? You want me to go to the Mathematica Documentation Center? Several _hundred_ tersely labeled clickable links just on the initial page? Each of which leads, not to a simple introduction, but to a complex formal documentation page with multiple further links to click? And all of which can only be read and navigated _on screen_? You and I, I'm afraid, just think differently. === Subject: Complex Plot Can anyone tell me how I can re-express this equation in terms of x for plotting? Sin[x^2*y]==Log[x/y] last sighted: http://tinyurl.com/3s4hfd === Subject: Re: Complex Plot I am not sure what you want here. Is there a region of x and y over which you want this? There can be anywhere from 1 solution for small values of y to an infinite number as y gets larger. Just do a plot of the difference of the two sides as a function of x for a fixed y value. Kevin > Can anyone tell me how I can re-express this > equation in terms of x for plotting? Sin[x^2*y]==Log[x/y] last sighted: http://tinyurl.com/3s4hfd > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: Complex Plot > Can anyone tell me how I can re-express this > equation in terms of x for plotting? Sin[x^2*y]==Log[x/y] last sighted: http://tinyurl.com/3s4hfd Hi Chris, If you are interested in the graphical representation of this function, you may want to use *ContourPlot* and experiment with its various options. For instance, ContourPlot[Sin[x^2*y] - Log[x/y], {x, -12, 35}, {y, -8, 23}, ImageSize -> 500] ContourPlot[Sin[x^2*y] - Log[x/y], {x, -12, 35}, {y, -8, 23}, ImageSize -> 500, ColorFunction -> (White &), ContourStyle -> Black, MaxRecursion -> 0, PlotPoints -> 500] You can see the result at http://homepages.nyu.edu/~jmg336/mathematica/chrisdegnencomplexplot.pdf Note that the second plot may take several minutes to complete due to the huge number of sampling points, but it should be very close to what you have seen on the Internet. Hope this helps, -- === Subject: Re: Converting Mathematica code to C++ >Hi all, I am considering running my research project on a computer >cluster on campus. However, the computer cluster requires the >programs to be in C++, and I've already coded much of the project in >Mathematica. Do converters such as MathCode C++ > work well? >Or do I need to re-write everything in C++ (not to mention learn how >to code in C++)? Tools like that work up to a point. How well they work will depend greatly on the Mathematica code you've written. If that code makes extensive use of built-in functions such as say DSolve or NDSolve, these tools won't be very useful too you. Simply put, you cannot expect any of these tools to output C++ code for specialized Mathematica functions. >If it's relevant, my project calculates the Lyapunov exponents of >partial differential equations, and the goal is to find the simplest >chaotic PDE. It isn't the overall application that matters. It is the specifics of what functions you use that matter. >I'm considering trying Intel's Compiler 10.1 for MacOSX, but I am >very reluctant to abandon Mathematica to learn to use Intel's >interface and others' PDE solvers in C++. Understandable since this would not be a trivial undertaking especially if you have to re-implement something equivalent to Mathematica's NDSolve or some other specialized function. === Subject: Re: Does Mathematica really need more printed, introductory documentation? >I have an additional concern regarding current on-line >documentation. Some of it does not have a resizable font. That >makes it difficult for people like me that have glasses and use >portable computers with smaller screens. I hope that can be fixed in >a subsequent release. I don't understand the problem here. The online documentation open up in a window in the front end just like any notebook. If you go to the menu bar and select Window->Magnification you will get a menu list allowing you to select several different magnification levels up to 300%. When you select one of these, all of the text is re-scaled by that factor. Isn't this adequate? === Subject: Re: How to open a Package >What is the syntax of opening a package: ><Is the path able to be added so the package may be accessed. Yes. Add paths you want searched to the list of paths stored in $Path. === Subject: Re: Problems with NSolve >Hi >>Sorry for the fuzziness :) >>chpoly was found by using Det[A - x*IdentityMatrix[dim]] (where A is a >>matrix function of u with alpha etc. being some random parameters). Alpha >>etc are random real numbers between -1 and 1 with working precision 30. Also >>please find attached a notebook of a working sample. >>[contact the sender to get this attachment - moderator] >>So I think the problem seems here, that instead of getting polynomials, I >>am getting rational functions. The thread Carl sent mentions some >>alternatives - I will try them out. >>Kij >> [...] > Without a specific matrix it is still fuzzy. > [....] I guess I should have been more specific. If you provide plain ascii text of your code, you will not require a notebook attachment and can have it directly in the MathGroup post. That way people can try it without needing to contact you off line. > Now to address what I believe is the main bottleneck. You are computing > bivariate determinants, and Det is not using any method adapted to the > specifications of your particular family of matrices. For dimension > higher than 11 or so, it will do some thing that might well create > denominators (at least, if inputs are not exact), and moreover I expect > would be slow. I was probably incorrect in thinking this would be the main bottleneck. Subsequent experimentation indicated that the method Det uses for larger matrices is substantially faster than what I showed for dimension 11 (though still slower than the interpolation-based approach). I did not check with approximate inputs but that could well give rise to problematic denominators. That would more affect the NSolve step than the Det computation speed. > [...] > Next is the issue of finding, or at least counting, the real solutions > to the system that results when we look for multiple eigenvalues. One > approach, as you indicate, is to solve it and count the real solutions. findcrossings1[poly_, u_, t_] := > Cases[{u, t} /. NSolve[{poly, D[poly, t]}, {u, t}], {_Real, _Real}] > [...] > This is a bit slow, and while I expect it to not deteriorate as fast as > CharacteristicPolynomial, it will all the same become problematic as > dimension rises. > [...] When I tried at dimension 16 it took 400 seconds, compated to 10 for the CountRoots[Resultant[...]] approach. At dimension 21 that latter took 40 seconds, and I did not bother trying the NSolve method. In your case, where Det may be giving back expressions with denominators due to not with polynomial expressions), I'd not be surprised if NSolve behavior is substantially worse. One (I hope) final remark. There are other ways to go about counting real roots. I do not have familiarity with the details. I just wanted to mention that if this problem is important to your work, and you cannot make progress with the methods already indicated, then there may still be other avenues to explore. Daniel Lichtblau Wolfram Research === Subject: Re: Problems with NSolve > Hi > Sorry for the fuzziness :) > chpoly was found by using Det[A - x*IdentityMatrix[dim]] (where A is a > matrix function of u with alpha etc. being some random parameters). Alpha > etc are random real numbers between -1 and 1 with working precision 30. Also > please find attached a notebook of a working sample. [contact the sender to get this attachment - moderator] So I think the problem seems here, that instead of getting polynomials, I > am getting rational functions. The thread Carl sent mentions some > alternatives - I will try them out. > Kij Hi all I am trying to find the number of eigenvalue crossings for a matrix as >a function of the parameter 'u', on which the elements of the >(symmetric) matrix depend on linearly. The matrix elements also >involve randomly chosen constants. The plan is to find the >distribution of the crossings of these type of matrices as I scan over >the random numbers. So far I have been using the following : NSolve[{chpoly[u, dim, [Alpha], [Gamma], [Epsilon], x] == 0, > D[chpoly[u, dim, [Alpha], [Gamma], [Epsilon], x], x] == 0}, {x, > u}, WorkingPrecision -> prec] where chpoly is the characteristic polynomial of the matrix (with the >eigenvalue variable being x) and alpha, gamma and epsilon are >constant parameter arrays of random numbers. For a double (or higher) >degeneracy of the eigenvalues both the characteristic equation and its >derivative should be zero. This approach has worked successfully only >upto 12*12 matrices (where one such computation takes 40 secs on my >laptop). For 13*13 my laptop takes 4000 sec. This seems to be somewhat >surprising, because these polynomials are of the order 'n' (where n >is dimension of the matrix) in both u and x - and n=13 does not sound >very computationally unreasonable. So I was wondering if there was a >faster approach I could take. Also, the problem essentially entails me to know the number (not the >values) of the real solutions to this system of polynomials. >CountRoots seemed ideal but it does not work for more than one >equation. So is there any alternative along this route? Any other alternatives are also welcome. >Kij. >>Could you post, please, a *fully working* example of what you are doing? It >>is really hard to optimize fuzzy functions (fuzzy not as in fuzzy logic but >>as in fuzzy definitions or concepts :-) >>-- >> Without a specific matrix it is still fuzzy. I will show an example that should get you going, but it might not behave quite the same with actual parameters in place (due to numerical issues). First some code to generate a matrix of random polynomials, linear in some variable 'u'. I'm working over the integers but I'd guess this will all be fine if I use random reals of precision 30. randomLinearPolynomial[n_, u_] := RandomInteger[{-n,n}.{1,u}] randomMatrix[dim_,max_] := Table[ randomLinearPolynomial[max,u], {dim,dim}] Now to address what I believe is the main bottleneck. You are computing bivariate determinants, and Det is not using any method adapted to the specifications of your particular family of matrices. For dimension higher than 11 or so, it will do some thing that might well create denominators (at least, if inputs are not exact), and moreover I expect would be slow. Given that matrix elements are guaranteed to be linear polynomials in a particular variable, you can get a characteristic polynomial much faster via interpolation. One does this by finding the characteristic polynomial for n+1 specific values of that variable (where n is the dimension), using some other variable which I call 't' in the code below. To recover the correct coefficients in t, each of which is a polynomial of degree up to n in u, we'll use standard polynomial interpolation. myCharacteristicPolynomial[mat_, u_, x_] := Module[{n = Length[mat], polys, coeffs}, polys = Map[CharacteristicPolynomial[mat /. u -> #, x] &, Range[1, n + 1]]; coeffs = Transpose[Map[ PadRight[CoefficientList[#, x], n + 1] &, polys]]; coeffs = Map[Expand[ InterpolatingPolynomial[#, u]] &, coeffs]; Expand[coeffs.x^Range[0, n]] ] Here is an example: In[59]:= myMatrix = randomMatrix[5, 10] Out[59]= {{8 - 8*u, -2 + 10*u, 1 + 2*u, 10 + 5*u, -5*u}, {-3 + 7*u, -9 + 4*u, -1 - 8*u, -4 + 5*u, -6 - 4*u}, {10 - 5*u, -4*u, 6 - 5*u, -9, 9 - 7*u}, {7 + 5*u, 7 + 7*u, 5 - 6*u, -5 + 7*u, -6 - 5*u}, {-2 + u, 2 - 7*u, 1 - 7*u, 7 + 2*u, -6 + 5*u}} In[60]:= Timing[c1 = CharacteristicPolynomial[myMatrix, t]] Out[60]= {0.00399999999999778, -82800 + 14894*t + 2266*t^2 + 71*t^3 - 6*t^4 - t^5 + 260131*u - 14113*t*u - 3792*t^2*u - 129*t^3*u + 3*t^4*u - 184171*u^2 - 33715*t*u^2 + 987*t^2*u^2 + 299*t^3*u^2 + 195079*u^3 + 28987*t*u^3 + 133*t^2*u^3 - 113971*u^4 - 17800*t*u^4 + 15563*u^5} In[61]:= Timing[c2 = myCharacteristicPolynomial[myMatrix, u, t]] Out[61]= {0.00400000000000237, -82800 + 14894*t + 2266*t^2 + 71*t^3 - 6*t^4 - t^5 + 260131*u - 14113*t*u - 3792*t^2*u - 129*t^3*u + 3*t^4*u - 184171*u^2 - 33715*t*u^2 + 987*t^2*u^2 + 299*t^3*u^2 + 195079*u^3 + 28987*t*u^3 + 133*t^2*u^3 - 113971*u^4 - 17800*t*u^4 + 15563*u^5} In[62]:= c1 == c2 Out[62]= True No difference in timings, for dimension of 5. Now we redo at higher dimension. In[63]:= myBiggerMatrix = randomMatrix[11, 10]; In[65]:= Timing[c1 = CharacteristicPolynomial[myBiggerMatrix, t];] Out[65]= {4.38027, Null} In[66]:= Timing[ c2 = myCharacteristicPolynomial[myBiggerMatrix, u, t];] Out[66]= {0.064004, Null} In[67]:= c1 == c2 Out[67]= True So we have made substantial improvement in regard to this bottleneck. Next is the issue of finding, or at least counting, the real solutions to the system that results when we look for multiple eigenvalues. One approach, as you indicate, is to solve it and count the real solutions. findcrossings1[poly_, u_, t_] := Cases[{u, t} /. NSolve[{poly, D[poly, t]}, {u, t}], {_Real, _Real}] In[70]:= Timing[solns = findcrossings1[c1, u, t]] Out[70]= {21.0053, {{-0.301473, 778.797}, {-8.11089, -140.741}, {3.86324, 75.9679}, {7.27872, 80.1776}, {3.77224, 65.1796}, {4.55024, 55.6788}, {-0.740926, 18.6957}, {0.853927, 20.6467}, {-6.79623, 8.78344}, {-0.871391, 13.772}, {0.266494, -14.1587}, {0.135089, -13.0663}, {-0.260045, -13.2098}, {-0.860066, 11.1762}, {0.655937, 9.11692}, {0.967805, -4.66542}, {1.3373, 7.43368}, {0.00336349, -5.3958}, {-0.0986887, -4.9421}, {0.0149776, -3.17222}, {0.18333, -1.30277}, {-0.0141373, 0.155747}}} In[71]:= Length[solns] Out[71]= 22 This is a bit slow, and while I expect it to not deteriorate as fast as CharacteristicPolynomial, it will all the same become problematic as dimension rises. Note that we have two polynomials in two unknowns. A faster, and basically reliable, alternative, is to find the resultant of the these polynomials, and use real root counting on that. In[72]:= findcrossings2[poly_, u_, t_] := CountRoots[Resultant[poly, D[poly, t], t], u] In[73]:= Timing[findcrossings2[c1, u, t]] Out[73]= {0.94806, 22} There is a very small caveat to this. In a nongeneric selection of your parameters [Alpha] et al, you could have a case where a real solution in the linear matrix variable u corresponds to crossings of two (nonreal) complex conjugate pairs of eigenvalues. In this nongeneric case findcrossings2 would not recognize that the real solution in u corresponded to complex crossings in t, hence would overcount. For your purposes of assessing statistics, this probability zero situation matters not at all. Daniel Lichtblau Wolfram Research === Subject: Re: Problems with NSolve Kij I had a similar problem sometime back. When I used NSolve[] to solve a set of simultaneous equations (after representing the differentials of the ODE/PDE in terms of function values - just like finite difference scheme), the NSolve[] took sufficiently longer time. To my surprise, when I used Solve[], I found a big difference in the solution time. Solve[] took me around 30 to 150 seconds (depending on my equations), while for the same set of equations NSolve[] took more than an hour or so to 'running out of memory' error message. I also thought that setting precision level might help in the set up of NSolve[] (just like you did here), but did not help me. I also guess (on the similar lines), DSolve[] could solve in less time than NDSolve[] in case of ODE/PDEs. Gopinath University of Oklahoma === Subject: Re: Enable multicore calculation ? > Hello Szbolcs, I am not competent enough to answer such questions, as I have no > knowledge how the various functions you mention are implemented. It is just my experience that analytic calculations using Map, Apply > Inner and all that never seem to use multicores (in my particular > applications). Up to now I only experienced multicore use in calculations using > NDSolve, where the calculation of the right hand side of a large set > of coupled ordinary differential equations requires the inversion of > matrices. So I must say that I do not even know which part > of the numerical calculation uses multicore, Inverse[] or NDSolve[] > itselve. I just see from the Linux process monitor that CPU usage > is nearly 400% on an eight processor machine, from which I conclude tha= t > my calculation uses 4 processors (hopefully correct). I guess we would need somebody from WRI to enlighten us here... Michael > I run some larger calculations on Linux with Mathematica 6.0.2.1 a= nd > 8 cores essentially using NDSolve, and these calculations definitly u= se > usually 4 cores without any interference from my side. Mathematica > seems to detect the multicore environment automatically and the > software acts then accordingly. In a sense I was (positively) surpris= ed. However, not everything in Mathematica supports multicore, and it = is > my guess and partly my experience that it is mostly (maybe only) > numerical stuff which uses multicores. > I do not have access to any multiprocessor machines which have >> Mathematica. I am curious: do functions like Map or Inner use multip= le >> processors (in principle it is easy to parallellize these)? More >> generally, can those functions that call other Mathematica functions u= se >> more than one processor? Or is this capability restricted to built-in= >> operations that are implemented at a lower level than the Mathematica >> language (such as numerical linear algebra)? >> Is it guaranteed that Map evaluates the elements of a list in order? >> What about misuses such as the following: >> a = 123; >> Map[(a = 100 + Mod[a, #]) &, {5, 6, 7, 8}]; >> a >> (Actually this one must be pretty hard to parallellize even if there a= re >> no guarantees about evaluation order.) >> Szabolcs > Obviously I have no inside knowledge on this, but I would imagine that it would be extremely hard for Mathematica to use multiple cores for anything symbolic. Imagine, for example, code that accessed a function f at the same time as another core was updating the definition of the function f! By the time you had engineered in all the extra checks to avoid a collision, you would have probably wiped out any gain in extra red tape! Possibly compiled code could, in principle, do better because the compiler can note the larger context in which an operation will be executing. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Old Toolbar from 5.2 to 6.0.2 This might sound a bit silly, but I really miss the toolbar that Mathematica 5.2 used to have under the Format > Show Toolbar menu. Now in current 6.0.2 there doesn't seem to be this simple option. However, if I open an old Mathematica notebook which was originally created with 5.2 with a toolbar from within the new 6.0.2, then the toolbar remains. Is that the only way to have it? Must I start every notebook in Mathematica 5.2, assign a toolbar to it, and then open it with Mathematica 6? Surely not! Can someone help? Gideon === Subject: Re: Old Toolbar from 5.2 to 6.0.2 Look under the Window pulldown. Kevin This might sound a bit silly, but I really miss the toolbar that > Mathematica 5.2 used to have under the Format > Show Toolbar menu. > Now in current 6.0.2 there doesn't seem to be this simple option. > However, if I open an old Mathematica notebook which was originally > created with 5.2 with a toolbar from within the new 6.0.2, then the > toolbar remains. > Is that the only way to have it? Must I start every notebook in > Mathematica 5.2, assign a toolbar to it, and then open it with > Mathematica 6? Surely not! Can someone help? > Gideon > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: Old Toolbar from 5.2 to 6.0.2 This might sound a bit silly, but I really miss the toolbar that > Mathematica 5.2 used to have under the Format > Show Toolbar menu. > Now in current 6.0.2 there doesn't seem to be this simple option. > However, if I open an old Mathematica notebook which was originally > created with 5.2 with a toolbar from within the new 6.0.2, then the > toolbar remains. > Is that the only way to have it? Must I start every notebook in > Mathematica 5.2, assign a toolbar to it, and then open it with > Mathematica 6? Surely not! > The Show Toolbar and Show Ruler otpions have been moved to the Window menu. === Subject: LayeredGraphPlot without edge crossing. I have a tree-structure-data which I would like to plot. If I use TreePlot, the plot looks very similar to what I need. However, the plot algorithm does not pay attention on the direction of edges. I would like to have in tree in which elements from the first layer show on the elements of the second layer and so on. I tried to use LayeredGraphPlot. It solves the problem. However, the second problem appears. The elements in every layer are ordered in a way that gives a lot of crossing between edges. So, can I force LayeredGraphPlot to optimize the elements withing a layer in a way that minimize number of edges crossing? Or can I force TreePlot to pay attention on the direction of edges? === Subject: Integral wit Norm function How can I to calculate the integral of an expression which include Norm function?. By example, Let the curve alfa[t_]:={t^2,4t, 8t^3}. Calculate Integral[Norm[alfa[t]],{t,1,a}], where a is Real and >0. === Subject: Re: Integral wit Norm function > How can I to calculate the integral of an expression which include > Norm function?. By example, Let the curve alfa[t_]:={t^2,4t, 8t^3}. Calculate > Integral[Norm[alfa[t]],{t,1,a}], where a is Real and >0. Using the right command, i.e. *Integrate* rather than Integral (which does not exist in Mathematica), with some options such as *Assumptions* should help greatly. alfa[t_] := {t^2, 4 t, 8 t^3} Integrate[Norm[alfa[t]], {t, 1, a}, Assumptions -> Element[a, Reals] && a > 0] [Piecewise] { {(1/16384)(-37152 + 32 Sqrt[16 + a^2 + 64 a^4] + 4096 a^2 Sqrt[16 + a^2 + 64 a^4] + 8190 ArcSinh[(1 + 128 a^2)/(3 Sqrt[455])] - 4095 Log[91/5]), a > 1 || 0 < a < 1} } -- === Subject: Re: Does Mathematica really need more printed, Each Mathematica 6 Documentation Center page is a Mathematica notebook, and when it appears it includes the usual control for magnifying everything, up to 300%. Surely that suffices. And I believe the default is configurable by means of the Options Inspector: you use the Global category; search for Magnification; then change that from the default value 1 to something higher. Unless you need severely compensating assistive technology, that should suffice. > I have an additional concern regarding current on-line documentation. Some > of it does not have a resizable font. That makes it difficult for people > like me that have glasses and use portable computers with smaller screens. > I hope that can be fixed in a subsequent release. > In response to Andrzej Kozlowski's comment > Judging by quite many ordinary users I known, the views you have >> been > expressing, particularly those on the need for printed software >> manuals > rather make you a memeber of a minority, and moreover a rather > rapidly declining one. I for one, . . . >> Does Mathematica really need printed, more introductory level >> documentation (aka books, or manuals) to add to its excellent, but less >> readable, online documentation? >> Let's take an experimental or reality-based approach to this question >> (however much that approach may be out of favor with our current >> administration in Washington . . .) >> Adobe Illustrator is, in my opinion anyway, an excellent piece of >> technical software, comparable in quality and usefulness and at least >> somewhat comparable in technical complexity, to Mathematica. >> There's probably a sizable overlap --- or at very least, a very sizable >> _potential_ market overlap --- between Illustrator and Mathematica users >> (new graphics commands that are very Illustrator-like have in fact been >> added in 6.0). >> Both programs have something of an initial learning curve for ordinary >> users; both have excellent detailed online reference documentation. >> Mathematica is, I would judge, actually substantial more complex and >> requires more learning for an average individual than does Illustrator. >> On my Mac, Illustrator 11 is 75 MB for the app itself, plus another 75 >> MB of supplemental stuff. I didn't try to dig inside the Mathematica >> package, but it's over 1 GB in my Applications folder, plus whatever >> additional material is stuffed away elsewhere on my HD. Illustrator >> manuals tend to be 300 to 500 pages; the Mathematica Book for v5 was >> just under 1500. Mathematica users, especially less experienced ones, >> might need more forms and varieties of documentation, that Illustrator >> users. >> So, to get some idea what sort of introductory printed books and manuals >> might be useful for Mathematica, we might ask: what sort of introductory >> printed books and manuals are readily available, right now, for >> Illustrator? (Noting again that Illustrator also has good, well >> organized, readily accessible online documentation, Help files, and >> tutorials --- along with helpful user forums on its web site.) >> A quick look at amazon.com then brings up a list of at least twelve (12) >> such introductory books or manuals on Illustrator (list appended below). >> All of these books are currently available in stock on amazon (and three >> are on my bookshelf) --- as compared to _none_ (as yet, anyway) for >> Mathematica 6. >> At least half of these Illustrator manuals can be identified as current >> editions of earlier versions that were published for earlier versions of >> Illustrator. In other words, earlier versions apparently sold well >> enough that authors were willing to write and publishers were willing to >> bring out 2nd, 3rd, even 4th editions of these manuals, updated for the >> current version of Illustrator. >> Or in other words, for me anyway: The experimental evidence is that >> these books _clearly meet user needs_, sufficiently so that authors are >> willing to invest their energies in writing them; publishers publish >> them; and users buy them, including more than once; >> Should Wolfram maybe recognize this point? >> * Adobe Illustrator CS3 Classroom in a Book by Adobe Creative Team >> (2007) $35 >> * The Adobe Illustrator CS3 Wow! Book by Sharon Steuer (2007) $24 >> * Adobe Illustrator CS3 How-Tos: 100 Essential Techniques by Karlins >> and Hopkins (2007) $10 >> * Real World Adobe Illustrator CS3 by Mordy Golding (2007) $20 >> * Illustrator CS3 Bible by Ted Alspach ( 2007) $25 >> * Adobe Illustrator for Fashion Design by Susan Lazear (2008) $35 >> * Fashion Designer's Handbook for Adobe Illustrator by Centner and >> Vereker (2007) $50 >> * Illustrator CS3 for Windows and Macintosh (Visual QuickStart Guide) >> by Weinmann and Lourekas (2007) $20 >> * Adobe Illustrator CS3 Revealed by Chris Botello (Aug 31, 2007) $45 >> * Best Practice: The Pros On Adobe Illustrator by Toni Toland (Aug 16, >> 2006) $35 >> * Adobe Illustrator CS2 Revealed, Education Edition by Chris Botello >> (2005) $40 -- 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: Does Mathematica really need more printed, >I have an additional concern regarding current on-line >documentation. Some of it does not have a resizable font. That >makes it difficult for people like me that have glasses and use >portable computers with smaller screens. I hope that can be fixed >in a subsequent release. To voice the same limitation in another way: Most if not all the online documentation opens by default in a single-page width window at 100% magnification, which is at best marginally readable on a laptop screen; and with many of the subsections closed by default. Increasing the document magnification, opening all the closed subsections, and enlarging the window if you wish to do that, involves a substantial amount of delicate mousing around, all of which has to be re-done for each new window. Being able to change the defaults for this would be very handy. === Subject: Re: Does Mathematica really need more printed, introductory documentation? I have an additional concern regarding current on-line documentation. Some of it does not have a resizable font. That makes it difficult for people like me that have glasses and use portable computers with smaller screens. I hope that can be fixed in a subsequent release. In response to Andrzej Kozlowski's comment Judging by quite many ordinary users I known, the views you have > been > expressing, particularly those on the need for printed software > manuals > rather make you a memeber of a minority, and moreover a rather > rapidly declining one. I for one, . . . > Does Mathematica really need printed, more introductory level > documentation (aka books, or manuals) to add to its excellent, but less > readable, online documentation? Let's take an experimental or reality-based approach to this question > (however much that approach may be out of favor with our current > administration in Washington . . .) Adobe Illustrator is, in my opinion anyway, an excellent piece of > technical software, comparable in quality and usefulness and at least > somewhat comparable in technical complexity, to Mathematica. There's probably a sizable overlap --- or at very least, a very sizable > _potential_ market overlap --- between Illustrator and Mathematica users > (new graphics commands that are very Illustrator-like have in fact been > added in 6.0). Both programs have something of an initial learning curve for ordinary > users; both have excellent detailed online reference documentation. Mathematica is, I would judge, actually substantial more complex and > requires more learning for an average individual than does Illustrator. > On my Mac, Illustrator 11 is 75 MB for the app itself, plus another 75 > MB of supplemental stuff. I didn't try to dig inside the Mathematica > package, but it's over 1 GB in my Applications folder, plus whatever > additional material is stuffed away elsewhere on my HD. Illustrator > manuals tend to be 300 to 500 pages; the Mathematica Book for v5 was > just under 1500. Mathematica users, especially less experienced ones, > might need more forms and varieties of documentation, that Illustrator > users. So, to get some idea what sort of introductory printed books and manuals > might be useful for Mathematica, we might ask: what sort of introductory > printed books and manuals are readily available, right now, for > Illustrator? (Noting again that Illustrator also has good, well > organized, readily accessible online documentation, Help files, and > tutorials --- along with helpful user forums on its web site.) A quick look at amazon.com then brings up a list of at least twelve (12) > such introductory books or manuals on Illustrator (list appended below). > All of these books are currently available in stock on amazon (and three > are on my bookshelf) --- as compared to _none_ (as yet, anyway) for > Mathematica 6. At least half of these Illustrator manuals can be identified as current > editions of earlier versions that were published for earlier versions of > Illustrator. In other words, earlier versions apparently sold well > enough that authors were willing to write and publishers were willing to > bring out 2nd, 3rd, even 4th editions of these manuals, updated for the > current version of Illustrator. Or in other words, for me anyway: The experimental evidence is that > these books _clearly meet user needs_, sufficiently so that authors are > willing to invest their energies in writing them; publishers publish > them; and users buy them, including more than once; Should Wolfram maybe recognize this point? > * Adobe Illustrator CS3 Classroom in a Book by Adobe Creative Team > (2007) $35 * The Adobe Illustrator CS3 Wow! Book by Sharon Steuer (2007) $24 * Adobe Illustrator CS3 How-Tos: 100 Essential Techniques by Karlins > and Hopkins (2007) $10 * Real World Adobe Illustrator CS3 by Mordy Golding (2007) $20 * Illustrator CS3 Bible by Ted Alspach ( 2007) $25 * Adobe Illustrator for Fashion Design by Susan Lazear (2008) $35 * Fashion Designer's Handbook for Adobe Illustrator by Centner and > Vereker (2007) $50 * Illustrator CS3 for Windows and Macintosh (Visual QuickStart Guide) > by Weinmann and Lourekas (2007) $20 * Adobe Illustrator CS3 Revealed by Chris Botello (Aug 31, 2007) $45 * Best Practice: The Pros On Adobe Illustrator by Toni Toland (Aug 16, > 2006) $35 * Adobe Illustrator CS2 Revealed, Education Edition by Chris Botello > (2005) $40 -- Richard Palmer === Subject: Re: Does Mathematica really need more printed, introductory documentation? > I have an additional concern regarding current on-line documentation. Some > of it does not have a resizable font. That makes it difficult for people > like me that have glasses and use portable computers with smaller screens. > I hope that can be fixed in a subsequent release. > Have you noticed the small 100% field at the bottom right of the documentation center window? You can click on it and choose another magnification which increases the size of everything, not only the fonts. This is for the windows version, but I am quite sure a similar functionality is there for the mac and unix versions, too... You can also make another magnification the default by choosing e.g. 1.25 for the option Notebook Options -> Display Options -> Magnification in the Option Inspector. This will affect all notebooks and dialogs, not only the documentation center, though... hth, albert === Subject: Re: Does Mathematica really need more printed, introductory documentation? Is it really reality based to be comparing books about Adobe about version 6 of Mathematica ? Sounds to me more like a reflection in a distorting mirror masquerading as reality (something unfortunately very common these days in the media and in large sections of the Academia). Why don't you perform a search for books about Mathematica (all versions) and compare your findings with your list of books about Illustrator? The picture will become very different and much closer to reality. The fact is, that the vast majority of essential features of Mathematica are described in these earlier versions and that any one who has mastered them should be able to update his knowledge to version 6 without a huge extra effort. As I already expained earlier: I would not buy any printed manual style book about Mathematica and I remain highly skeptical that such a book would be successful enough to justify the effort of writing it. However, this only one person's view based on mere speculation. However, I am (of course) very interested in any books *applying* the new features of Mathematica 6, but that is an entirely different matter. Andrzej Kozlowski > In response to Andrzej Kozlowski's comment > Judging by quite many ordinary users I known, the views you >> have been >> expressing, particularly those on the need for printed software >> manuals >> rather make you a memeber of a minority, and moreover a rather >> rapidly declining one. I for one, . . . > Does Mathematica really need printed, more introductory level > documentation (aka books, or manuals) to add to its excellent, but > less > readable, online documentation? Let's take an experimental or reality-based approach to this > question > (however much that approach may be out of favor with our current > administration in Washington . . .) Adobe Illustrator is, in my opinion anyway, an excellent piece of > technical software, comparable in quality and usefulness and at least > somewhat comparable in technical complexity, to Mathematica. There's probably a sizable overlap --- or at very least, a very > sizable > _potential_ market overlap --- between Illustrator and Mathematica > users > (new graphics commands that are very Illustrator-like have in fact > been > added in 6.0). Both programs have something of an initial learning curve for > ordinary > users; both have excellent detailed online reference documentation. Mathematica is, I would judge, actually substantial more complex and > requires more learning for an average individual than does > Illustrator. > On my Mac, Illustrator 11 is 75 MB for the app itself, plus another 75 > MB of supplemental stuff. I didn't try to dig inside the Mathematica > package, but it's over 1 GB in my Applications folder, plus whatever > additional material is stuffed away elsewhere on my HD. Illustrator > manuals tend to be 300 to 500 pages; the Mathematica Book for v5 was > just under 1500. Mathematica users, especially less experienced ones, > might need more forms and varieties of documentation, that Illustrator > users. So, to get some idea what sort of introductory printed books and > manuals > might be useful for Mathematica, we might ask: what sort of > introductory > printed books and manuals are readily available, right now, for > Illustrator? (Noting again that Illustrator also has good, well > organized, readily accessible online documentation, Help files, and > tutorials --- along with helpful user forums on its web site.) A quick look at amazon.com then brings up a list of at least twelve > (12) > such introductory books or manuals on Illustrator (list appended > below). > All of these books are currently available in stock on amazon (and > three > are on my bookshelf) --- as compared to _none_ (as yet, anyway) for > Mathematica 6. At least half of these Illustrator manuals can be identified as > current > editions of earlier versions that were published for earlier > versions of > Illustrator. In other words, earlier versions apparently sold well > enough that authors were willing to write and publishers were > willing to > bring out 2nd, 3rd, even 4th editions of these manuals, updated for > the > current version of Illustrator. Or in other words, for me anyway: The experimental evidence is that > these books _clearly meet user needs_, sufficiently so that authors > are > willing to invest their energies in writing them; publishers publish > them; and users buy them, including more than once; Should Wolfram maybe recognize this point? > * Adobe Illustrator CS3 Classroom in a Book by Adobe Creative Team > (2007) $35 * The Adobe Illustrator CS3 Wow! Book by Sharon Steuer (2007) $24 * Adobe Illustrator CS3 How-Tos: 100 Essential Techniques by Karlins > and Hopkins (2007) $10 * Real World Adobe Illustrator CS3 by Mordy Golding (2007) $20 * Illustrator CS3 Bible by Ted Alspach ( 2007) $25 * Adobe Illustrator for Fashion Design by Susan Lazear (2008) $35 * Fashion Designer's Handbook for Adobe Illustrator by Centner and > Vereker (2007) $50 * Illustrator CS3 for Windows and Macintosh (Visual QuickStart Guide) > by Weinmann and Lourekas (2007) $20 * Adobe Illustrator CS3 Revealed by Chris Botello (Aug 31, 2007) $45 * Best Practice: The Pros On Adobe Illustrator by Toni Toland (Aug > 16, > 2006) $35 * Adobe Illustrator CS2 Revealed, Education Edition by Chris Botello > (2005) $40 > === Subject: Re: Does Mathematica really need more printed, introductory documentation? > Is it really reality based to be comparing books about Adobe > about version 6 of Mathematica ? Sounds to me more like a reflection > in a distorting mirror masquerading as reality (something > unfortunately very common these days in the media and in large > sections of the Academia). Andrzej, it's Wolfram itself has portrayed version 6 as a massive and major upgrade --- Wolfram reinvents Mathematica! --- 500 major new features --- a revolutionary new version --- which also involves significant features of previous versions being removed, replaced, or changed in major ways. And of the 12 Illustrator manuals I listed, nine of them have publication dates in 2007 and are (or at least claim to be) updated for Illustrator's current versions as of those dates --- for a product whose upgrades have been, I think it's fair to say, much more gradual and evolutionary in character than Mathematica's v5 to v6 upgrade. for historical interest, since they apparently hadn't --- yet, anyway --- been updated. I think my amazon search on the string Adobe Illustrator actually brought up something over 2000 hits (though of course there have nowhere that many actual earlier books). Beyond these facts, I think I'll let the remainder of your comments speak for themselves. > Why don't you perform a search for books about Mathematica (all > versions) and compare your findings with your list of books about > Illustrator? The picture will become very different and much closer to > reality. The fact is, that the vast majority of essential features > of Mathematica are described in these earlier versions and that any > one who has mastered them should be able to update his knowledge to > version 6 without a huge extra effort. As I already expained earlier: I would not buy any printed manual > style book about Mathematica and I remain highly skeptical that such > a book would be successful enough to justify the effort of writing it. > However, this only one person's view based on mere speculation. > However, I am (of course) very interested in any books *applying* the > new features of Mathematica 6, but that is an entirely different matter. Andrzej Kozlowski === Subject: ChebyshevT command syntax and polynomial question using mathematica 6 I execute the command and get the following output: In[83] := FunctionExpand[1/2 Cos[2 ArcCos[x]] + 43/2 - 10 x] // Expand Out[83]:= 21 - 10 x + x^2 What would be the proper format to execute the polynomial using ChebyshevT to do it in reverse order? Example: I would input In[83] := FunctionExpand[ChebyshevT[n, x]] and it gives me Out[83]:= Cos[n ArcCos[x]] How can I do a In[83] := FunctionExpand[ChebyshevT[n, x]] and it would give me Out[83]:= 1/2 Cos[2 ArcCos[x]] + 43/2 - 10 x Is this the best way to go about this? tia sal2 === Subject: Re: ChebyshevT command syntax and polynomial question using mathematica I execute the command and get the following output: In[83] := FunctionExpand[1/2 Cos[2 ArcCos[x]] + 43/2 - 10 x] // Expand > Out[83]:= 21 - 10 x + x^2 What would be the proper format to execute the polynomial using > ChebyshevT to do it in reverse order? Example: > I would input > In[83] := FunctionExpand[ChebyshevT[n, x]] > and it gives me > Out[83]:= Cos[n ArcCos[x]] How can I do a > In[83] := FunctionExpand[ChebyshevT[n, x]] > and it would give me > Out[83]:= 1/2 Cos[2 ArcCos[x]] + 43/2 - 10 x Use TrigReduce: 21 - 10 x + x^2 /. x -> Cos[y] // TrigReduce === Subject: Assigning multiple variables within a Block[] statement (e.g. {a,b} = {c,d}) What I'm trying to do: I have a list of parameters that I am using across several functions. I am trying to come up with a good way to avoid copying/pasting these parameter assignments everywhere. Here is an example code that sort of accomplishes this goal: (Suppose my parameters are a,b, and c) paramlist = {a -> 1, b -> 4, c -> 8}; paramlistnames = First /@ paramlist; foobar2[x_] := Block[Evaluate[Flatten[{paramlistnames, {d, e, f}}]], {a, b, c} = paramlistnames /. paramlist; {d,e,f} = {1,1,1}; x*a*b*c*d*e*f ] The line {a, b, c} = paramlistnames /. paramlist; effectively sets a, b, and c to their values, at which point I can proceed with the rest of the function. Questions: 1. Is this the most effective way to accomplish the task at hand? If no, what is? 2. Note that I still have to explicitly use {a, b, c} = paramlistnames /. paramlist; something like Hold[paramlistnames] = paramlistnames /. paramlist; results in an error message. Is there a way to do the assignment but use the paramlistnames somehow so that I don't have to name the variables explicitly? --Leo === Subject: ContourPlot3D and positive contours Hello everyone :) Using the ContourPlot3D, how can I plot only the positive contours (or only the negative ones for that matter=85) I would imagine an option like this : ContourPlot3D[f,Contours->{#>0&,10}] which would plot the first 10 positive contours. But that does not exist=85 Right now, I'm plotting the contours of the positive part of my function like this : ContourPlot3D[1/2*(f+Abs[f]),Contours->{10}] but that's not pretty=85 Is there a better way to do this ? === Subject: Re: can anybody help me the superfluous part is commented in the code below: Manipulate[ points=points//.{left___,{x1_,y1_},middle___,{x1_,y2_},right___}:>{left,midd le,{x1,y2},right}; points=points//.{left___,{0.001,y1_},right___}:>{left,right}; points=points//.{left___,{1-0.001,y1_},right___}:>{left,right}; ptsrt=Union[{{10^(-8),0}},points,{{1,0}}]; ptsrt2={{{0},0,ptsrt[[2,2]]/ptsrt[[2,1]]}}~Join~Table[{{ptsrt[[i+1,1]]},ptsr t[[i+1,2]],(ptsrt[[i+2,2]]-ptsrt[[i,2]])/(ptsrt[[i+2,1]]-ptsrt[[i,1]])},{i,Le ngth[ptsrt]-2}]~Join~{{{1},0,-ptsrt[[Length[ptsrt]-1,2]]/(1-ptsrt[[Length[pts rt]-1,1]])}};Bn=Table[NIntegrate[2 FB[ptsrt,ptsrt2,x,idpolynom]*Sin[m Pi x],{x,0,1}, AccuracyGoal->6],{m,3}]; Plot[{If[id,F[ptsrt,ptsrt2,x,idpolynom]],If[string,F[ptsrt,ptsrt2,x-c*t,idpo lynom]/2+F[ptsrt,ptsrt2,x+c*t,idpolynom]/2],If[ltw,F[ptsrt,ptsrt2,x+c*t,idpol ynom]/2],If[rtw,F[ptsrt,ptsrt2,x-c*t,idpolynom]/2]},{x,-a,1+a},PlotRange->{{- a,1+a},{-2,2}},ImageSize->{400,300}], {{idpolynom,1,initial data},{1->piecewise polynomial(*,2->piecewise linear*)}}, {{c,0.5,velocity},0,3,Appearance->Labeled}, {{a,0,x interval},0,2,1,Appearance->Labeled}, {{points,{{1/2,1}}},{0.001,-2},{1-.001,2},Locator,LocatorAutoCreate->{All,{1 ,10}}}, {{id,True,initial string},{False,True}}, {{string,True,evolving string},{False,True}}, (*{{ltw,False,left wave},{False,True}}, {{rtw,False,right wave},{False,True}},*) {{t,0,run},0,Infinity,ControlType->Trigger}, {{modedisp,False,display modes},{False,True}}, Dynamic[If[modedisp,GraphicsGrid[{{Plot[Bn[[1]] Sin[Pi x] Cos[t Pi c],{x,0,1},Frame->True,Axes->False,ImageSize->{160},PlotRange->{{0,1},{-2,2} },PlotLabel->First mode]}, {Plot[Bn[[2]] Sin[2 Pi x] Cos[t c Pi 2],{x,0,1},Frame->True,Axes->False,PlotRange->{{0,1},{-2,2}},PlotLabel->Se cond mode]}, {Plot[Bn[[3]] Sin[3Pi x] Cos[t c Pi 3],{x,0,1},Frame->True,Axes->False,PlotRange->{{0,1},{-2,2}},PlotLabel->Th ird mode] }}], ]], ControlPlacement->{Top,Top,Top,Left,Left,Left,Left,Left,Left,Left,Left}, Initialization:>{MyPiecewise[P_,x_]:=Module[{i},Piecewise[Table[{(P[[i+1,2]] -P[[i,2]])/(P[[i+1,1]]-P[[i,1]]) (x-P[[i,1]])+P[[i,2]],P[[i,1]]=0,g[x],-g[-x]], F[pts_,pts2_,x_,idpolynom_]:=PeriodicExtension[Function[ss,OddExtension[Func tion[s, If[idpolynom==2,MyPiecewise[pts,s],Interpolation[pts2][s]] ],ss]],x], FB[pts_,pts2_,x_,idpolynom_]:= If[idpolynom==2,MyPiecewise[pts,x],Interpolation[pts2][x]] },TrackedSymbols:>Manipulate,AutorunSequencing->{1,3,4,7,9},ControllerLinkin g->False ] Daniel > http://rapidshare.com/files/109739889/sdads.nb.html in these nb file.i want to remove left wave , right wave , and > piecewise linear but i can't succeed it. > === Subject: Re: need help with Plot I got your idea to work for my specific situation. === Subject: Re: Problem with RegionFunction I understand that the case where x=0 and y=0 is undefined, but I don't understand why does Mathematica compute this case when ranges are given explicitely to avoid such situations? Why do I have to define the regionfunction to exclude x=0 and y=0 (as Fred suggested it)? Is it not trivial to exclude these as the PlotRange dictates it? Why is it that the problem does not surface when I omit the Manipulate[...] wrap? Istvan On Apr 23, 10:10 am, -Peer Kuska try Manipulate[ > Plot3D[Sin[x]*Cos[y], {x, 1, 10}, {y, 2, 10}, > RegionFunction -> Function[{x, y}, 45 <= (y^x)], > Exclusions -> x == 0], {dummy, {True, False}}] because y^x for x==0 and y==0 is undefined. === Subject: Re: Timing > I was execute these on my computer and received follwing Timing > Table[f[n], {n, 2, 20}] // Timing = 0.071 > Table[f[n], {n, 2, 21}] // Timing = 0.089 > Table[f[n], {n, 2, 22}] // Timing = 525.756 > but increasing limit of n to 23 was catastrophe on my computer (probably Could help me sombody with big memory size computer check these > procedure for n=23 (next true should occured for n=31) > Or sombody can explained this catastrophe in relation hardware-software > relation or estimated how increased time if increased n (is this time > polynomial time or not) Best wishes > Artur Apparently you wish to replicate http://www.research.att.com/~njas/sequences/?q=3%2C5%2C7%2C13%2C17%2C19%2C31 %2C61%2C89&language=english&go=Search First, the way you are going about this is hopeless. You are generating huge integers, on the order of many millions of bits, just to see if they are divisible by much smaller integers on the order of perhaps dozens of bits. This catastrophe is entirely self inflicted; you simply MUST avoid the huge numbers in the first place. Functions like Mod can be real helpful, in such circumstances. So you can tackle it as follows. Treat Sqrt[2] as a variable, that is, use polynomials in x, reduced by x^2-2. Also you want to do reduction modulo 2^n-1, since all you care about is whether the remainder is zero. This can be interleaved with powering, for efficiency (avoids huge numbers/expressions). Back before version 6 there was an add-on package PolynomialPowerMod that handled such things, but (I think) was restricted to prime number moduli. Anyway, I got a bit frustrated trying to figure out how to do this efficiently using built-in functions in version 6. This is an admission that either the documentation was lacking, or I was too tired. Also, I ran afoul of a difficult-to-track crash bug in our development do what we need here. ppMod[poly_, n_, {p2_,m_}] := Module[ {bits=Reverse[IntegerDigits[n,2]], pj=poly, oldpj, res=1}, If [bits[[1]]==1, res = pj]; Do[ pj = PolynomialMod[pj^2, {p2,m}]; If [bits[[j]]==1, res = PolynomialMod[res*pj,{p2,m}]], {j, 2, Length[bits]}]; res ] Timing[Map[First,Select[Table[{n, PolynomialMod[ (ppMod[3+2*x,2^(n-1)-1,{x^2-2,2^n-1}] - ppMod[3-2*x,2^(n-1)-1,{x^2-2,2^n-1}])*(x/8), Out[10]= {158.978, {1, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607}} Daniel Lichtblau Wolfram Research === Subject: Re: Dynamic: feature? No, in my opinion is UpValues feature I believe the behavior that you report is Not a Dynamic feature, I think it is an UpValues feature, and I am Not surprised it happened, let me explain. (If there is in this forum any expert in DownValues, OwnValues and UpValues, please correct me if I make any mistake in the following:) First a simpler example: If I write the following two different rules for the same expression foo[a], which one will Mathematica obey? foo /: foo[a]=400; a /: foo[a]=12; The answer is that Mathematica will always say foo[a] is 12, it does Not matter which definition was evaluated before, because the rule a/:foo[a]=12 is an UpValue (definition assigned to an argument, similar to some aspects of object oriented programming) while foo /: foo[a]=400 is a DownValue (definition assigned to a Head, this are the normal definitions) And Mathematica will always try UpValues first, and if there is no UpValue that can be applied, then it will try DownValues. The reason for this behavior is that we can create specific rules with UpValues and general rules with DownValues that coexist. For example the following command will create a specific rule for the addition of a plus anything, without disturbing the behavior of addition in other situations: a /: a + x_ := myplus[a, x] This specific rule will always be used before the general rules of addition when the addition includes a. For example evaluate x+y+a+z and you will obtain myplus[a,x+y+z]. On the other hand, if you evaluate 3+4 you will obtain 7, no problem because you did not overwrite the general rules addition, you just added a specific rule for a special case, which coexist with the general rules. However, in the example above, the rule foo /: foo[a]=400 will never be used, because the rule a /: foo[a]=12 will always win. Then the code above (definitions of foo) is in some sense bad programming, yet the output is predictable. Now the case that we are interested, What do you think it must happen if you have the following definitions for goo? What do you think Mathematica should do in this case? a /: goo[a,b]=400; b /: goo[a,b]=12; First, we can say that this definitions of goo are at least as bad programming as the example above with foo, because two different rules should apply to the same expression. Maybe you were expecting that the last rule evaluated will replace the first rule, but this does Not happen because the rules are assigned to different objects, a and b. You can verify that the two rules exist at the same time by evaluating ?a And evaluating ?b So, the second rule does not overwrite the first rule, the two conflicting rules coexist, BECAUSE they are assigned to different objects, a and b. In order to have the second (last) rule to overwrite the first rule both rules must be assigned to the same object, for example a. I think this bad programming (two different rules of the same hierarchy that should be applied to the same expression coexist), therefore we can expect the behavior of Mathematica to be unpredictable. If the two conflicting rules coexist, which one should Mathematica obey? I am Not surprise that Mathematica behavior is different if in different situations, for example, if one rule is evaluated first or second. Also it could happen that Mathematica 5.2 and Mathematica 6.0 could have (I do Not know if they do) different behavior in this bad programming example (goo). But those are my thoughts, Is there in the forum any expert in DownValues, OwnValues and UpValues that can tell us if my ideas are correct? Jose Mexico -----Mensaje original----- De: Gulliet [mailto:jeanmarc.gulliet@gmail.com] Enviado el: Mi=E9rcoles, 23 de Abril de 2008 03:10 a.m. Para: mathgroup@smc.vnet.net Asunto: Re: Dynamic: feature? > I have a cell containing this: Dynamic[f[a, b]] Then I do this: a /: f[a, b] = 12 and the dynamic cell updates to 12, as I would expect. When I do this: b /: f[a, b] = 45 The dynamic cell does *not* update for some reason. > It seems as though it does not realize an update has occurred when it > is associated with b. Does anyone know why this is? Chris Weird. I witness the same behavior if the cells are evaluated in the given order. However, ff one change the order of the assignments (i.e. b first, then a) Dynamic[] works as expected. Evaluating the following expressions in that order, Dynamic[f[a, b]] (* The first output cell is: f[a, b] *) b /: f[a, b] = 45 (* The first output cell is now: 45 *) a /: f[a, b] = 12 (* The first output cell is now: 12 *) $Version => 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) I have also recorded the sessions in a PDF file. See http://homepages.nyu.edu/~jmg336/mathematica/weirddynamic.pdf -- === Subject: Re: A Problem with Simplify >And even in the purely algebraic cases Reduce can easily take for >>ever. Or consider this: >> Reduce[x^3 + Sin[x] == 0, x] >>During evaluation of In[34]:= Reduce::nsmet : This system cannot >>be solved with the methods available to Reduce >>even though anyone can easily see that 0 is a solution (but Reduce is >>not allowed to return an incomplete solution). >>Adnrzej Kozlowski I was surprised a bit. It is sad that even if I specify the Real > domain I may not give the only possible answer x=0: > Reduce[x + Sin[x] == 0, x, Reals] > Solve[x + Sin[x] == 0, x, Reals] Now I understand the depth of the problem. But speaking about Integrate, is it really necessarily to perform > Reduce[] on each step? The problem is to find the singularities on the > parameters of the argument function (I mean such values of the > parameters those degenerate the argument function). Both integrand and indefinite integral might pose issues. > After this we > should keep track on arising new conditions on each step. It does not > mean to use Reduce. How else do you propose this might be done? > We need only understand what we really do and know > about limitations. Here is a limitation. How does one figure out when, or where, a branch cut is crossed, if teh functions involved contain parameters? > As I think this is not so much complicated task and > may be fully implemented in Mathematica (if it is not implemented > already). Umm, not to put too fine a point on things, but quite clearly you have no experience with this. Suffice it to say that full analysis of parametrized singularities for definite integrals is not implemented in Mathematica already. Nor anywhere else. I suspect partial analysisof such to be better developed in Mathematica than in other software, but I cannot state that as a fact. > On the final result we may need perform searching for the > singularities again - but only for checking the result! But as I see first of all Wolfram Research should extend Reduce[] for > working with trigonometric functions. Reduce[] handles trigs (alone) just fine. The example above mixes polynomial with trigonometric functions, of the same variable. handling this is quite nontrivial. > This is that we should wait for > nearest-future version of Mathematica. If we can not expect this - > what for we should pay money? I am not aware of any existing software that does what I believe you are requesting. That might give an indication that the algorithmic technology required is not yet out there. Daniel Lichtblau Wolfram Research === Subject: Re: Print[Plot] vs Print[text,Plot]? (*now Do and Table*) Table is usually a better choice than Do, but that is a choice and the > language is accommodating enough to allow you to make that choice; and > if you should be curious, to explore. > _Why_ (or, in what circumstances?) would Table be a better choice than Do? I appreciate that their logical behavior is similar, and indeed they can be > coded very similarly. I am happy to try to answer. I'll take the time to answer at length, because I find that many people that I try to help out have similar viewpoints as yours. Perhaps, I may have something useful to contribute. Primarily, it is a matter of choice and familiarity. And they (Table and Do) are just about interchangeable, except in a few unusual (and technical) cases. Table's advantage is speed and efficiency. (Once I asked someone at Wolfram how I should explain this to my students, and the kind answer was because Do has to access the main kernel's evaluation loop, and Table doesn't). I'll try to demonstrate this as an example. I'll try to explain my steps carefully, and I'll avoid the use of #&/.^= syntax. It took me a while to cook this up--I hope that my example doesn't go amiss. This is problem with a known simple result, but it will serve: let's find the sum of the first 10000000 integers. (*let's use a do loop*) Timing[ icount = 0; Do[icount = icount + i, {i, 1, 10000000, 1}]; icount ] (*this returns {10.2826, 50000005000000} on my machine.*) (*10.28 being a measure of how long the computation took to run*) (*lets try a table*) Timing[ Total[Table[i, {i, 1, 10000000, 1}]] ] (*This returns {3.25516, 50000005000000} on my machine*) This is a simple example, but it illustrates the difference nicely. ( Personally, I've yet to find a case for which I can replace a Do with a Table or similar list construct, although I am sure readers of this group could easily construct one as a challenge.) Another way to think of this is that Mathematica is very good at operating on lists. Table and Lists work together nicely, and many of the functions like Total are designed to help you make your programming easier. Now, if you put yourself in the mind of a beginner who has neither seen Do, For, While, or Table. Which style would you recommend based on speed alone? Which style would you recommend on readability alone? So, a typical beginning user might find themselves tending to use Lists. They are content for a couple years, but soon master the idea so that begin to do what is natural, abbreviate (ASAP, RJ46, LOL, AWOL, PM. FM...). They find shortcuts and optimize their time: First attempt may be something like this: (*create a list*) Table[i,{i,1,10000000}] (*horrors, the output is too long, and I know what it might look like anyway*) (*they graduate to this*) mytable= Table[i,{i,1,1000000}]; Total[mytable] (* soon they get tired of typing and find an abbreviated version *) Total[Table[i,{i,1,1000000}]] (* soon they get tired of moving around the screen to type the two brackets,*) (* so they find another way to do the same thing, no better, arguably less readable (*at first*) Total@Total[Table[i,{i,1,1000000}] (*or, depending on where your cursor tends to be sitting*) Table[i, {i, 1, 1000000}] // Total (*thus they learn a semaphore for analogous constructs*) (*but there's more, with ever more symbols, the efficiency and power goes*) (*up rapidly, but the readability goes down for beginners*) (*where you find the happy medium is entirely up to you*) In my opinion, this is the fun part of mathematica. I get to decide how to share the labor with mathematica, and I get to decide how obscure to make my code. Sometimes, for my own pleasure, I write it as obscurely as possible (and I am no master at this by a long shot). If I am writing code that I hope someone else will use and modify, or learn from, I try to write as readable as possible. -- W. Craig Carter === Subject: Re: Probably memory problem _ > Question: > Do anyone knows if using the palletes (Alebraic Manipulation, > BasicMathInput, > BasicTypesetting) in Mathematica 6 needs more stack memory that writing > algebra in full form? > __ > Problem: I am interested in check an equality: Side 1= Side 2 of the form: 24*n*y*y=-4*b+2*v*z-v*v/k*e^z With y,b,v,z,k,n variables which all but n > are veeeeeery long expressions of the form: > y:= > b:= > etc... > and to make them look shorter I defined other > expressions, so that y, b, v, etc, need > other expressions to be complete. I know that the equality is analitically true, but > I get using TrueQ(side 1, side2), PossibleZeroQ, > that the equality is False. > Options: > So, I think that the problem could be in: > - Lack of memory, because Mathematica stops evaluating > the notebook after the 16th definition, > although I asked Mathematica about the memory used: > MemoryInUse= 6,314,760 bites just before it stopped > evaluating the notebook but I think Mathematica=B4s limit > is about 19,654,528 bites. > -Maybe I do not have enough computer memory, but > -Maybe I did not write well the definitions. > _ > Any comments or suggestions will be very appreciated, :) > thank you very much in advance, Alejandra Lozada It really doesn't sound as though this is a memory problem, perhaps you should post a link to a copy of the notebook and let someone look at it. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Dynamic: feature? > I have a cell containing this: >> Dynamic[f[a, b]] >> Then I do this: >> a /: f[a, b] = 12 >> and the dynamic cell updates to 12, as I would expect. >> When I do this: >> b /: f[a, b] = 45 >> The dynamic cell does *not* update for some reason. >> It seems as though it does not realize an update has occurred when it >> is associated with b. >> Does anyone know why this is? >> Chris > Weird. I witness the same behavior if the cells are evaluated in the > given order. However, ff one change the order of the assignments (i.e. b > first, then a) Dynamic[] works as expected. Evaluating the following > expressions in that order, Dynamic[f[a, b]] > (* The first output cell is: f[a, b] *) b /: f[a, b] = 45 > (* The first output cell is now: 45 *) a /: f[a, b] = 12 > (* The first output cell is now: 12 *) $Version => 6.0 for Mac OS X x86 (64-bit) (February 7, 2008) I have also recorded the sessions in a PDF file. See http://homepages.nyu.edu/~jmg336/mathematica/weirddynamic.pdf -- A principle rule of debugging Dynamics...consider what Shift-Enter evaluations do. In this case, exactly the same thing. In fact, Dynamic correctly reflects what a Shift-Enter evaluation on f[a,b] would do at that very moment. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. === Subject: Re: Column Product of a Matrix of zeros and 1's myM2 = {{1, 1, 0, 0, 0, 0, 1, 0, 0}, {1, 1, 0, 0, 0, 0, 1, 1, 0}, {1, 1, 1, 0, 0, 0, 1, 1, 0}, {1, 0, 1, 0, 0, 0, 1, 1, 1}, {1, 1, 0, 1, 0, 1, 0, 0, 0}, {1, 1, 1, 1, 0, 1, 0, 0, 0}, {1, 0, 1, 1, 1, 0, 0, 0, 0}, {1, 0, 1, 1, 0, 1, 0, 0, 0}}; thisSet = {1, 2}; Flatten[Position[Times @@ Transpose[myM2][[thisSet]], 1]] {1,2,3,5,6} Intersection @@ (Flatten[Position[#, 1]] & /@ Transpose[myM2][[thisSet]]) {1,2,3,5,6} Bob Hanlon > Hello Bill, > myM2 = { > {1, 1, 0, 0, 0, 0, 1, 0, 0}, > {1, 1, 0, 0, 0, 0, 1, 1, 0}, > {1, 1, 1, 0, 0, 0, 1, 1, 0}, > {1, 0, 1, 0, 0, 0, 1, 1, 1}, > {1, 1, 0, 1, 0, 1, 0, 0, 0}, > {1, 1, 1, 1, 0, 1, 0, 0, 0}, > {1, 0, 1, 1, 1, 0, 0, 0, 0}, > {1, 0, 1, 1, 0, 1, 0, 0, 0} > }; > I take the product of colomn 1 and 2 as an example: > {1,1,1,0,1,1,0,0} (thisSet= {1,2}) > The positions of the 1's are: {1,2,3,5,6} (with Flatten) > I solved how to do this for thisSet etc. But I did not use the property that myGlobalMatrix (myM2)is 1's and 0's. with friendly greetings, > P_ter > === Subject: Re: installing Playe rPro killed using Mathematica itself: Such a gross oversight on Wolfram's part is unexpected. I suspect that unless the problem is fixed in short order that PlayerPro will not make it for very long. Given all that I have heard, I would not install it on my system. I am just thankful that my procrastination delayed prevented this problem for me. I would like to thank all those who quickly alerted the group. Kevin > Yes, this fixes the problem with the mathpass for Player Pro under my > configuration effectively killing the mathpass for Mathematica itself. Of course the problem should have been avoidable by the installer > program, or at least by installation directions, in the first place. > Yes, this is because of the overlapping use of MATHEMATICA_USERBASE. Anybody >> who does not set this variable will not see the problem. To work around this... >> * Take your current mathpass file and move it into Mathematica's installation >> directory in ConfigurationLicensing. >> * Start Player Pro and enter your password. >> * Take the newly generated mathpass file and move it into Player Pro's >> installation directory in ConfigurationLicensing. >> >> John Fultz >> jfultz@wolfram.com >> User Interface Group >> Wolfram Research, Inc. > With an existing installation of Mathematica 6.0.2 under Windows, I just > installed Player Pro. The result: if I start Mathematica itself and > open a new notebook there, I am prohibited from typing any and all input. This sort of thing is intolerable! An utterly time-frittering > aggravation. I suspect that the scenario involved here was not tested by WRI: My > mathpass for Mathematica itself is in the Licensing subdirectory of my > USERBASE directory, which is the same as my BASE directory (both set by > Windows environment variables MATHEMATICA_BASE and MATHEMATICA_USERBASE). This is hardly the first time I have run into trouble with multiple > passwords from multiple Wolfram Research products. It is something they > have just not yet gotten right. Beware! What I did as a temporary fix was to use my Windows backup program to > restore my pre-existing mathpass file. Now regular Mathematica works. > But of course Player Pro does not. > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Re: Print[Plot] vs Print[text,Plot]? > My original post said: I've just executed a test cell containing Print[Plot[---]]; > Print[Some textn, Plot[---]]; Result from first line is expected plot; result from second line is a > miniaturized plot about 1/4 the size of the first one. ****** This is sensible or useful? ****** In response to various replies: > 6) And did anyone notice that the majority of the alternative > approaches suggested in most replies (Column[], etc) were things that > are new in 6.0? Must everyone take a week off from their real life to > trudge (tediously) thru What's New in 6.0, on screen? There are a *lot* of extremely useful things New in 6.0 that are very much worth the effort to learn. -- Helen Read University of Vermont === Subject: Re: Print[Plot] vs Print[text,Plot]? I don't think many of your questions will be answered in a way that satisfies you. However, as a statement of fact > 7) And also, that the widely used older approach that I might have used > to get my desired 3-plots-in-one=cell result, namely GraphicsArray[ > {{plot1}, {plot2}, {plot3}}] is now gone? > instead a _design choice_, and one that required some coding to > implement -- and it was a poor design choice IMHO. This construction construction was available in early versions of Mathematica: ?Graphics* It shows that GraphicsArray is still present, as are GraphicsGrid and GraphicsRow which may be more helpful, but not necessary, for your stated purpose. Table is usually a better choice than Do, but that is a choice and the language is accommodating enough to allow you to make that choice; and if you should be curious, to explore. WCC -- W. Craig Carter === Subject: Eigenvalues Okay, Eigenvectors Fail I seek the eigenvectors and corresponding eigenvalues of a large matrix of real values, m, such that, Union[Head /@ Flatten[m]]] = {Real}. So far I have no trouble with this for matrices up to n x n, n > 1300 using the function Eigensystem with very fast results. But, sometimes, when I analyze transformed submatrices (mSub) of my original matrix, where n' < 1300, the function, Eigensystem, fails to produce output. Further, Eigenvalues[mSub], quickly produces a valid list of n' eigenvalues, but, Eigenvectors[mSub] fails to complete. Therefore I ask, What is happening such that I can calculate a complete list of n' eigenvalues for a real matrix, mSub, but I cannot calculate the corresponding eigenvectors? I appreciate any thoughts on this. I use Mathematica 5.1.0.0 on MacOS X 10.5.2. === Subject: Re: installing Playe rPro killed using Mathematica itself: BEWARE! Is this a Windows-only problem? george > Yes, this is because of the overlapping use of MATHEMATICA_USERBASE. > Anybody > who does not set this variable will not see the problem. To work > around this... * Take your current mathpass file and move it into Mathematica's > installation > directory in ConfigurationLicensing. > * Start Player Pro and enter your password. > * Take the newly generated mathpass file and move it into Player Pro's > installation directory in ConfigurationLicensing. > John Fultz > jfultz@wolfram.com > User Interface Group > Wolfram Research, Inc. > With an existing installation of Mathematica 6.0.2 under Windows, I >> just >> installed Player Pro. The result: if I start Mathematica itself and >> open a new notebook there, I am prohibited from typing any and all >> input. >> This sort of thing is intolerable! An utterly time-frittering >> aggravation. >> I suspect that the scenario involved here was not tested by WRI: My >> mathpass for Mathematica itself is in the Licensing subdirectory of >> my >> USERBASE directory, which is the same as my BASE directory (both >> set by >> Windows environment variables MATHEMATICA_BASE and >> MATHEMATICA_USERBASE). >> This is hardly the first time I have run into trouble with multiple >> passwords from multiple Wolfram Research products. It is something >> they >> have just not yet gotten right. Beware! >> What I did as a temporary fix was to use my Windows backup program to >> restore my pre-existing mathpass file. Now regular Mathematica >> works. >> But of course Player Pro does not. > === Subject: Re: installing Playe rPro killed using Mathematica itself: BEWARE! No, but it's a problem which only arises with the usage of the environment variable. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. > Is this a Windows-only problem? george >> Yes, this is because of the overlapping use of MATHEMATICA_USERBASE. >> Anybody >> who does not set this variable will not see the problem. To work >> around this... >> * Take your current mathpass file and move it into Mathematica's >> installation >> directory in ConfigurationLicensing. >> * Start Player Pro and enter your password. >> * Take the newly generated mathpass file and move it into Player Pro's >> installation directory in ConfigurationLicensing. >> John Fultz >> jfultz@wolfram.com >> User Interface Group >> Wolfram Research, Inc. > With an existing installation of Mathematica 6.0.2 under Windows, I > just > installed Player Pro. The result: if I start Mathematica itself and > open a new notebook there, I am prohibited from typing any and all > input. This sort of thing is intolerable! An utterly time-frittering > aggravation. I suspect that the scenario involved here was not tested by WRI: My > mathpass for Mathematica itself is in the Licensing subdirectory of > my > USERBASE directory, which is the same as my BASE directory (both > set by > Windows environment variables MATHEMATICA_BASE and > MATHEMATICA_USERBASE). This is hardly the first time I have run into trouble with multiple > passwords from multiple Wolfram Research products. It is something > they > have just not yet gotten right. Beware! What I did as a temporary fix was to use my Windows backup program to > restore my pre-existing mathpass file. Now regular Mathematica > works. > But of course Player Pro does not. === Subject: Re: When Find finds something - Yes, I often get the same behavior. I don't know what the 'trick' is to have the found text highlighted. It would be nice if Find had better behavior. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > - it sometimes highlights the thing and sometimes puts a > little dotted box around it. What's the difference? It's very hard to > see the dotted box sometimes and I have to Find it visually! Is there > a way to change this found indicator to make it more conspicuous? Steve Gray > === Subject: Re: When Find finds something - > - it sometimes highlights the thing and sometimes puts a > little dotted box around it. What's the difference? It's very hard to > see the dotted box sometimes and I have to Find it visually! Is there > a way to change this found indicator to make it more conspicuous? Steve Gray I've noticed that if you first click on Find All then each subsequent Find Next puts the found text in reverse video rather than a hollow box otherwise. -Bob === Subject: Re: Wolfram User Interface Research? [off-topic!] Responses interleaved below. > This comment about APL is quite wrong: nothing compelled you to write >> inscrutable single line programs. I'll totally concede your point here. But I don't think it makes > my original comment quite wrong, or even wrong at all. And I'm not attacking APL at all -- a great (if arcane) > intellectual achievement in computer science, and maybe > a great (if still arcane) tool for certain types of computation. > > But nonetheless, the arcane symbolic notation used in APL > tends to make even multi-line APL programs nearly as > inscrutable for all but APL experts. Yes, and my experience with students and colleagues is that long (lr not so long) Mathematica programs, especially those that involve functional programming and patter-matching, are just as inscrutable to the non-initiate or non-expert. > ...But, there aren't really a lot of > APL programmers around, right? -- and I'd bet that > they tend to be programmers employed as such, rather > than ordinary users from many other fields, who just > want to be get some computational task done in the > field where their skills primarily lie. Right, there are far fewer APL programmers today. To some extent this is because the stables of such employed by time-sharing services or the several large APL implementation houses disappeared as time-sharing services disappeared and as the APL implementation business consolidated (and as, e.g., CDC, which was a big APL backer, went belly-up). My experience is to the contrary, namely, that plain APL programmers became a disappearing breed, but scientists and financial analysts and actuaries who were not at all primarily programmers use(d) APL. >> The delight of APL was, and is, that many very complicated things can, >> in fact, be expressed quite concisely, in a way that the suggestive >> graphic symbols of APL help one understand. Yes, and that's absolutely fine. But is Mathematica supposed to be a $1000 gaming > platform for most powerful but also most abstruse > one-liner competitions? Or a useful tool that can be quickly and easily learned (and > remembered between intermittent uses!) by ordinary > _non-programmer_ users, who just want to get work > done using it in _their_ field of expertise. You'd be surprised (or perhaps not) at how many mathematicians, scientists, and engineers I know say about Mathematica something that many have said about APL: that it's too hard to learn and too strange and unfamiliar, i.e., either unlike traditional mathematical notation or unlike FORTRAN and a certain CAS that's a glorified, enhanced FORTRAN. >> I cannot speak knowledgeably of the current situation with APL2, but for >> many years APL programmers were incredibly productive compared with >> those programming in just about all other standard computer languages. >> It's not for no good reason that, for example, major financial analysis >> systems and reservations systems were written in APL (and some still >> are, or at least in offshoots from the APL trunk). I suspect that one large part of the good reasons for this > situation (if not the primary reason) was that every type of > computer resource -... were all > _immensely_ more limited and more expensive 20 years ago, So far as I am aware, the primary reason for APL's success was that those who programmed in it were (and are!) so much more productive than those who programed (and program) in other languages. Even back then, it was programmers who were the limiting factor, not computer resources. -- 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: Wolfram User Interface Research? > Is the primary market for Mathematica supposed to be > Mathematica programmers, skilled in the arcana of the > more abstruse parts of Mathematica, or ordinary users > whose primary interests and skills lie in many, many other > fields -- and who want Mathematica to be (for them) just > an easy to learn, easy to use, easy to remember tool? Mathematica could not function the way it does unless it satisfied both types of users. It has to be powerful enough for professional programmers if not for other reason than just the fact that a large part of Mathematica itself (and all add on packages) are written in the Mathematica programming language. It also has to satisfy enough ordinary users for even more obvious reasons. In my opinion it has always performed both functions admirably. These abstruse parts of Mathematica are not obligatory for ordinary users but for Mathematica programmers and developers (and many power users) they make life a lot easier. I believe you are familiar with TeX; at least you mention it often enough. Do you seriously claim that Mathematica has more of these abstruse parts than TeX? Have you ever heard words like TeXPert, TexMaster etc? Are you able to program or even understand a set of Finally, in all your posts you never seem to mention the very essential (in the case of Mathematica) distinction between the Front End and the Kernel. The great majority of new functionality in v. 6 concerns the former. In principle there is no reason why Mathematica should not be available with alternative Front Ends. It used to be possible to run later versions with earlier Front Ends. I have not tried this with v. 6 but that would be one way to do away with most of the new complexity that you seems to displease you so. Andrzej Kozlowski === Subject: Re: Create array of data files > Hi there, does anyone know how to write standard multicolumn numerical data > sets generated by a for loop into an array of data files with > names dataset%.txt, where % is iteratively given by the value of For[Export[dataset<>ToString[i]<>.txt,(*your data set here)],{i, (*number of data sets here*)}] Ssezi === Subject: Re: Player Pro and Packages Player Pro is, in my opinion, a very good start. The capability, where it works, does exactly the right thing to replace old fashioned powerpoint presentations for technical talks. It's a huge market. Here is what needs to be fixed: 1. Every copy of player pro contains a copy of math reader If people are forced to go to wolfram to fill out forms to get math reader, most of the effectiveness of the approach is gone. 2. Player Pro needs to work with Add On Packages. otherwise, the usability of these packages is limited. I think that the only limits that might be placed on the code should be something like the limits that are on the JAVA virtual machine. 3. Player Pro needs to be absolutely Free. This may be effectively true already. If it isn't, any price barrier to using it needs to be removed. The additional Mathematica Licenses will more than make up for any forgone revenue on Player Pro Licenses. What I meant was that it is very difficult to protect and claim > ownership > for clear text file formats, like the Mathematica notebook format or the > PDF > format. This raises an interesting intellectual property (IP) question > which I'm not qualified to answer, namely can one obtain some > form of legally enforceable IP protection on a _format_? > --- especially one which is expressed in such a simple and > clear text form that it's easy to reverse engineer? If so, this format may not be protected by obscurity, > but may still be protect-able against unlicensed use > by taking legal action against unauthorized users. [My understanding is that Adobe retains some rights over > modifications, extensions, variations on PDF, while allowing > anyone to use it without a license (?); and Don Knuth certainly > did this with TeX. Maybe it's only the _name_ of the format > that is legally protected? --- If you modify the format itself > in any way, you can't call or refer to the result as PDF or > as TeX???] > Hopefully Wolfram finds some new business concept to make the money roll > in. I would fully share this hope -- provided that it means that * The primary or core part of Mathematica itself remains primarily a > very powerful _computational_ tool, and secondarily an adequately > powerful _display_ tool for outputting or displaying the results of > those computations. * And that this primary or core part is not further encumbered by > adding separable additional tasks -- e.g., typesetting, more complex > formatting capabilities, attempting to make it also a primary > _publication_ tool -- and trying to embed them directly in the core. * With the reason for this being that the core, and its documentation, > should remain as lean as possible, within the already large requirements > of those two tasks --- which are, in reality, going to make this core, > and its documentation, very large _just_ with those two primary tasks. * And with the further proviso that this Mathematica core uses, or > requires, for its generalized file and data input and output functions > _only_ open, widely used, widely available, preferably even ISO > standardized formats. So, my 'Silicon-Valley-style' entrepreneurial vision for Mathematica > would be that: * IF Wolfram can provide and maintain this kind of core tool --- > repeat, a _core tool_ --- that is readily usable by ordinary users, and > has good but simplified documentation for those users, but also has lots > of much more sophisticated aspects for more sophisticated users and > experts --- about what v6 provides today, or a bit trimmed back -- for a > 'street price' of, let's say, not more than $300 (in current dollars) to > all purchasers; and * IF they can build around this core various profitable product lines > of specialized packages (or plug-ins?) for many specialized fields, > and specialized data services at various levels and in various fields, > and various types of Player products of varying cost and degree of > sophistication (from free upward); and * IF they can maintain a little better backward capability and avoid > the really destructive disruption of the v5 to v6 transition in the > future; and * IF they can _greatly_ improve their 'ordinary user' documentation for > their core product; then I think they'd have a quite good chance to build the kind of very > widespread, world-wide, innumerable-fields-of-study-wide Mathematica > ecosystem that someone referred to in another post --- and, hopefully, > make a lot of money, and beat down their major competitors, in the > process. But if they just continue making their base (core) product ever more > complex, ever more confusing, ever more obese --- the v5 to v6 > trajectory extrapolated --- well, I suspect that I, and a lot of other > users, will sooner or later be gone --- even if I don't know where to. Over and out . . . AES -- Richard Palmer Home 508 877-3862 Cell 508 982-7266 === Subject: Re: Hamiltonian System Hi Alex, you have branch cuts in the differential equation as well as in the energy expression. To deal with the first branch cut in the DE we may define a power function with a different branch cut: E.g. To integrate over the first branch cut at approx. t=2, we may define myPow[x_]:= (Exp[-I Pi/4]Sqrt[Exp[+I Pi/2]I x])^3 this has a branch cut along the line trough I instead of -1. This line is not cut by I x[t] if we integrate from 0..3. We may therefore use myPow in place of (I x[t])^(1+1/2). With myPow we get a smooth curve, but still the energy is not constant near t=2. This comes from the energy term: (I*x[t]/.solution)^(2+1/2) that has a cut near t=2. hope this helps, Daniel > So I'm trying to solve the following Hamiltonian system using Mathematica. I posted this earlier, but I wanted to make sure it's not skipped over. solution = NDSolve[{x'[t] == 2p[t], x[0] == 2, > p'[t] == I*(2 + 1/2)(I*x[t])^(1 + 1/2), p[0] == 1-2*I}, {x, p}, {t,0,10}, MaxSteps -> Infinity][[1]]; I'm letting E=1, so at all points t, it should be that > (p[t]/.solution)^2-(I*x[t]/.solution)^(2+1/2)=1. That is the case until the function crosses a branch cut on the complex x-plane that runs from 0 to i*(Infinity). Once the function crosses the branch cut, the system no longer preserves E and the value changes to something around 1.3. How can I go about fixing this problem? I've already tried working with the precision and accuracy goals, and that didn't work. I also tried the SymplecticPartitionedRungeKutta method, but that didn't work either. I'm not sure what else to consider. Any help would be appreciated. Alex > === Subject: Re: Differential Equation You don't have an equation. Was the S supposed to be where the Equal goes? DSolve[(x2 - 1)*D[y[x], {x, 2}] == D[y[x], x] - x2*y[x], y[x], x] {{y[x] -> E^((x*(1 - Sqrt[-4*x2^2 + 4*x2 + 1]))/(2*(x2 - 1)))*C[1] + E^((x*(Sqrt[-4*x2^2 + 4*x2 + 1] + 1))/(2*(x2 - 1)))*C[2]}} Bob Hanlon I was trying to solve the following second order linear differential equation and got no result from Mathematica. DSolve[(x2-1)*D[y[x],{x,2}]SD[y[x],x]-x2*y[x],y[x],x] Any ideas? > Sergio Terrazas This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. > === Subject: Re: Automatic Differentiation in Mathematica Hi marco, can you please explain what you mean by: Differentiation of an algorithm Usually we differentiate functions. For symbolic differentiation there is D and Dt. For numeric differentiation there is ND sincerely, Daniel I was wondering if any of you know about packages in Mathematica implementing > Automatic Differentiation of algorithms like ADOL-C in C++ or MAD in another system. > marco Ing. Marco Gabiccini, PhD > Assistant Professor of Applied Mechanics > Dept. of Mechanical, Nuclear and Production Engineering > University of Pisa > Via Diotisalvi, 2, 56126 Pisa (PI) - Italy > Phone: +39-050-836.676 > E-mail: m.gabiccini@ing.unipi.it === Subject: Re: Automatic Differentiation in Mathematica Hi Marco, now that I have understood what Automatic Differentiation means, I can give an answer. To implement the 2 dimensional numbers we may define a new typ with head e.g. aD (automatic Diff, it is custom to begin user specific stuff with lowercase). We then define rules for our data. E.g.: Clear[aD]; aD/: aD[x1_,y1_]+ aD[x2_,y2_]= aD[x1+x2,y1+y2]; aD/: aD[x1_,y1_]- aD[x2_,y2_]= aD[x1-x2,y1-y2]; aD/: aD[x1_,y1_]* aD[x2_,y2_]= aD[x1*x2,x1*y2+y1*x2]; aD/: aD[x1_,y1_]^n_/;n!=0= aD[x1^n,n x1^(n-1) y1]; with this defined we may say: aD[x1,1]+aD[x1,1]^-1 what yields: aD[1/x1+x1,1-1/x1^2] hope this helps, Daniel > Hi marco, > can you please explain what you mean by: > Differentiation of an algorithm > Usually we differentiate functions. For symbolic differentiation there > is D and Dt. For numeric differentiation there is ND > sincerely, Daniel > I was wondering if any of you know about packages in Mathematica implementing >> Automatic Differentiation of algorithms like ADOL-C in C++ or MAD in another system. >> marco >> Ing. Marco Gabiccini, PhD >> Assistant Professor of Applied Mechanics >> Dept. of Mechanical, Nuclear and Production Engineering >> University of Pisa >> Via Diotisalvi, 2, 56126 Pisa (PI) - Italy >> Phone: +39-050-836.676 >> E-mail: m.gabiccini@ing.unipi.it > === Subject: Re: Automatic Differentiation in Mathematica suppose you have a function of several hundred or thousend variables but less that a million. And you want to minimize it. You have written a FORTRAN or C function that compute this function with everything you can do in FORTRAN, i.e., DO-loops, IF ... To minimize the function you need the gradient, but the computation of the gradient numerical is to error sensitive and take too long. Automatic Differntation take you FORTRAN or C function and generate a FORTRAN or C function that compute the gradient. And yes it compute the derivative of a DO-loop and nested IF statements. AFAIK there is no Mathematica package that does this. > Hi marco, > can you please explain what you mean by: > Differentiation of an algorithm > Usually we differentiate functions. For symbolic differentiation there > is D and Dt. For numeric differentiation there is ND > sincerely, Daniel > I was wondering if any of you know about packages in Mathematica implementing >> Automatic Differentiation of algorithms like ADOL-C in C++ or MAD in another system. >> marco >> Ing. Marco Gabiccini, PhD >> Assistant Professor of Applied Mechanics >> Dept. of Mechanical, Nuclear and Production Engineering >> University of Pisa >> Via Diotisalvi, 2, 56126 Pisa (PI) - Italy >> Phone: +39-050-836.676 >> E-mail: m.gabiccini@ing.unipi.it > === Nese === Subject: Re: problem with Inset moving text Manipulate[ Graphics[{Circle[], Inset[Style[ StringJoin[value:, ToString[ NumberForm[N[c], {16, 8}, NumberPadding -> { , 0}, NumberSigns -> {-, }]]], Blue, 20, FontFamily -> Courier]]}], {{c, (2 [Pi])/3, Value c}, -1, 2 Pi, 0.001}] you should use a mono spaced font > from negative to positive or vise versa > Any idea how to solve it? === Subject: Re: White on white font You're using SUSE, so it's probably a compositing problem. Try exporting XLIB_SKIP_ARGB_VISUALS=1 before running Mathematica. I (and other users) have run into this before: http://forums.wolfram.com/mathgroup/archive/2007/Feb/msg00110.html Best wishes, C.O. I'm having a weird problem with Mathematica 6. Suddenly, the text in > notebooks is unreadable, it appears as white on white. See > http://www.physik.fu-berlin.de/~goerz/download/mathematica.png. The same effect is also in the preferences (Appearance) The text there > is white as well: > http://www.physik.fu-berlin.de/~goerz/download/mathematica.png. Any way to solve this problem? I'm not aware of any specific change > having caused this problem, as I don't start mathematica that regularly, > but in case it has to do something with the the video settings, here's > my xorg.conf: > http://www.physik.fu-berlin.de/~goerz/download/xorg.conf Michale -- Curtis Osterhoudt cfo@remove_this.lanl.and_this.gov PGP Key ID: 0x4DCA2A10 Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html === Subject: RE: [ Spam ] Re: Differential Equation to the email message. The command was correctly formed. The x2 is supposed to be x-squared (Power[x,2]) and the S was the double equal sign. I retype the command here: DSolve[(Power[x,2]-1)*D[y[x],{x,2}]==D[y[x],x]-Power[x,2]*y[x],y[x],x] -----Original Message----- === Subject: [ Spam ] Re: Differential Equation Importance: Low and what is SD[] ?? and is x2 eventual x^2 Can you please post valid Mathematica syntax or did you expect you find an analytical solution with DSolve[] to an ode with an unknown functional SD[y[x],x] ?? And posting to a public news group with This email and any files transmitted with it are confidential is nonsense. I was trying to solve the following second order linear differential equation and got no result from Mathematica. DSolve[(x2-1)*D[y[x],{x,2}]SD[y[x],x]-x2*y[x],y[x],x] Any ideas? > Sergio Terrazas This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. === Subject: Re: Re: mathematica 64-bit for ms windows > But be aware that if you are buying a new computer, from Dell at > least, and > you specify a 64 bit microprocessor, you will not necessarily get a > 64 bit > operating system, and may not even be able to install a 64-bit > operating > system. So if you are looking to use 64-bit Mathematica check out very > carefully before purchase that you will indeed have a 64-bit operating > system. As I understand it, the main advantage of a 64-bit operating system > is that > you can address more memory, beyond 2GB, but that it is not > significantly > faster - and may even be slower. (Others may correct me or expand > on this.) -- > David Park > djmpark@comcast.net > http://home.comcast.net/~djmpark/ >> hi >> while browsing about the mathematica products i have noticed that >> there >> is no something stated lucidly like: >> mathematica 64-bit for windows >> while there is such a statement (64-bit) regarding mathematica >> for Linux >> does that mean that there is a one package for windows in which the >> installer will detect whether the windows OS is 32 bit or 64 bit >> and will >> install accordingly ?? >> peter > My understanding is if the machine is truly 64-bit and the OS is 64- bit in all aspect, then operation at the same Hertz should be twice as fast, because of the bus. Unfortunately there are 64-bit machine that are not really 64-bit all the way, and there are OSs that also not 64-bit and sometimes not even 32-bit. J=E1nos -------------------------------------------------------- The more money has to be spent to fix a problem, the more likely it is that the people with the money will agree to fix it. /Alex Satrapa/ === Subject: Re: Local variable in ToExpression? > How can I create a local variable from text in ToExpression? test[] := Module[{result = 0}, > ToExpression[result=1]; result] test[] will return 0 > How can I make it return 1? > (here ToExpression is creating a global variable; result=1, even though it is placed inside the Module) Karl Daggfeldt > You have got to create a string from the local variable (this will have a name like result$3): Module[{result = 0}, ToExpression[ToString[Unevaluated[result]] <> =1]; result] Note the use of Unevaluated to prevent the variable being evaluated to the original value - 0. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Defining functions in mathematica I am trying to maximize an interpolated function without success Here is what I have tried: first I defined the interpolated function f= FunctionInterpolation[profit1[p1,p2,ab],{p1,0,2},{p2,0,2},{ab,0,2}] To test this definition I try and see that f[.1,.3,.4] is evaluated properly. It is properly evaluated as a real number. Then I try to find the x that Maximizes f Maximize[{ f[x, .2, .1], 0=98x=982] }, x] but what comes out is Maximize[{InterpolatingFunction[{{0,2}{0,2},{0,2), etc. Further when I try x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] what comes out is x/.x What am I doing wrong? Also, I eventually want to define a function G[p2,ab] that takes on the value of the maximizing x for these values. that is G[p2_,ab_]=x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] How can I do this? Phil === Subject: Re: Defining functions in mathematica try NMaximize. I think Maximize expects a symbolic expression in some variable. hope this helps, Daniel > I am trying to maximize an interpolated function without success Here is what I have tried: first I defined the interpolated function f= FunctionInterpolation[profit1[p1,p2,ab],{p1,0,2},{p2,0,2},{ab,0,2}] To test this definition I try and see that f[.1,.3,.4] is evaluated > properly. It is properly evaluated as a real number. Then I try to find the x that Maximizes f > Maximize[{ f[x, .2, .1], 0=98x=982] }, x] > but what comes out is Maximize[{InterpolatingFunction[{{0,2}{0,2},{0,2), etc. Further when I try x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] what comes out is x/.x What am I doing wrong? Also, I eventually want to define a function G[p2,ab] that takes on > the value of the maximizing x for these values. > that is G[p2_,ab_]=x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] How can I do this? Phil === Subject: Re: Defining functions in mathematica since I have no profit, and also no profit1 I make f instead of profit f = FunctionInterpolation[(x - 1/4)^2 + y^2, {x, -2, 2}, {y, -2, 2}]; NMinimize[f[x, y], {x, y}] and got the result. > I am trying to maximize an interpolated function without success Here is what I have tried: first I defined the interpolated function f= FunctionInterpolation[profit1[p1,p2,ab],{p1,0,2},{p2,0,2},{ab,0,2}] To test this definition I try and see that f[.1,.3,.4] is evaluated > properly. It is properly evaluated as a real number. Then I try to find the x that Maximizes f > Maximize[{ f[x, .2, .1], 0=98x=982] }, x] > but what comes out is Maximize[{InterpolatingFunction[{{0,2}{0,2},{0,2), etc. Further when I try x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] what comes out is x/.x What am I doing wrong? Also, I eventually want to define a function G[p2,ab] that takes on > the value of the maximizing x for these values. > that is G[p2_,ab_]=x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] How can I do this? Phil === Subject: Find smallest eigenvalues in mathematica Eigenvalues[m, -k] gives the k that are smallest in absolute value,Here m is large sparse matrix. But I want to get the smallest eigenvalues,not in the meaning of absolute value,how can I achieve this aim directly,excluding the method that find the smallest eigenvalues in absolute value and select out the smallest values,for the method would waste many computational cost.How could we use Lanczos method according to Mathematica? === Subject: Re: Find smallest eigenvalues in mathematica Mathematica has the ARPACK library built in (Arnoldi and Lanczos are somewhat synonymous), and all (?) the options for that library apply. If your matrix is Hermitian, so that you know that the eigenvalues are all real, then you can use the real part as a criterion for computing the smallest one. Let A be your sparse matrix, containing only machine-precision real numbers. Then calling -Eigenvalues[-A, 1, Method -> {Arnoldi, MaxIterations -> 10^5, Criteria -> RealPart}] will compute the largest eigenvalue of -A (by real part), which is the smallest eigenvalue of A. Unfortunately, the Mathematica documentation on the subject of sparse-matrix diagonalization is very sparse. Roman. === Subject: Re: Find smallest eigenvalues in mathematica imagine that you subtract asome number from your eigenvalues so that all Eigenvalues are negative. Then you can use Eigenvalues[..,1] to get the smallest. This can be achieved by subtracting n IdentityMatrix from your matrix, where n is larger than you largest positive eigenvalue. Therefore, the following gives you the samllest eigenvalue: n+Eigenvalues[m- n IdentityMatrix[dimension],1] hope this helps, Daniel > Eigenvalues[m, -k] gives the k that are smallest in absolute value,Here m is large sparse matrix. But I want to get the smallest eigenvalues,not in the meaning of absolute value,how can I achieve this aim directly,excluding the method that find the smallest eigenvalues in absolute value and select out the smallest values,for the method would waste many computational cost.How could we use Lanczos method according to Mathematica? > === Subject: Re: Mathematica Book and Documentation I do not think an actual printed book is that useful with the new > Mathematica 6 because it is impossible to reproduce dynamic behavior on a > static printed page. The world changes and the elderly can adapt as well as > the young. We've had more practice. > When I discover that I'm going to have a chance to visit a new country or a new part of the world, the first step is to go to a good bookstore; browse the travel guides on the shelves there; and then buy one or two of these that I can scan through while having a solitary meal or trapped in a cramped airline seat or in the evening, by the fire. **After** that, one has the necessary overview to start doing intelligent online research for all the finer details of specific hotel rates, train and boat schedules, museum open days and hours, theater and musical performances, and so on. Ditto for massive new or modified software packages. [And the problem with being elderly -- which I definitely am -- is not so much difficulty in adapting. The problem is that one has had so many, many opportunities over the years to encounter and recognize both intelligent decisions, and dumb decisions (by others, that is). And Wolfram's failure to recognize the need for some *printed* (or printable) introductory guidebooks to 6.0, and either prepare one themselves or foster their preparation by others, was certainly a dumb decision, by an otherwise remarkable organization. === Subject: Re: Part or Partition or Split or Extract or ...... ???? >First I tried the way Bill Rowe has suggested >A =Import[new3.txt,Lines]; >In[2]:= GetridOFF = A[[1]] Out[2]= (300a,011c) DS >[2555] # 6, 2 LeafJawPositions >In[3]:= StringReplace[GetridOFF,{RegularExpression@^.+ >[->,RegularExpression@= [.+$->}] You have a typo. There is an '=' character following the '@' character in the second RegularExpression that should not be there. That is causing the error message. Also, if you convert expressions to Input form before copying them and pasting them into email they will be much more readable. -- To reply via email subtract one hundred and four === Subject: Re: LogLogPlot with WorkingPrecision bug It does crash, and so does LogPlot. However, using Presentations the following might works: Needs[Presentations`Master`] Module[ {f = Function[x, x], xyticks = CustomTicks[ Log[#] &, {-3, 0, {1, 5} // N, {2, 3, 4, 6, 7, 8, 9}}]}, Draw2D[ {ParametricDraw[{logx, Log[f[Exp[logx]]]}, {logx, Log[.001], Log[1]}, WorkingPrecision -> 20]}, Axes -> True, Ticks -> {xyticks, xyticks}, AxesOrigin -> {Log[.001], Log[.001]}] ] -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ >I can reliably crash the kernel on my laptop with the following > command: LogLogPlot[x, {x, .001, 1}, WorkingPrecision -> 20] Of course, I discovered this problem with a very different function, > but this is the simplest example that will demonstrate the kernel > crash. I have already sent a message to support@wolfram.com, but I > thought I would post here to see if anyone else can shed light on this > apparent bug. -- Dan > === Subject: Re: FindMaximum query fun[x_?NumericQ] := ... Neely > Consider the following function: fun[x_] := > Module[ > {y, sol}, > sol = FindRoot[Sqrt[y] == Abs[x], {y, 0, 0.001}]; > (* AppendTo[list, sol]; *) > -y /. sol[[1]] > ] Then Plot[fun[x], {x, -2, 2}] works fine, but FindMaximum[fun[x], {x, 1, 1.001}] fails. If I uncomment the debug line in fun and execute list = {}; > FindMaximum[fun[x], {x, 1, 1.001}] Then list contains {FindRoot[Sqrt[y$21471] == Abs[x], {y$21471, 0, 0.001}]} > So, FindRoot fails because x is passed through unevaluated, I think. > I would appreciate any advice on how to get FindMaximum (or NMaximize) > to work in this case. Mathematic 6.0.1.0 x86 32 bit > Mac OS X 10.4.11 > E. Neely Atkinson > Department of Biostatistics > M. D. Anderson Cancer Center neely@pdq.net > === Subject: manipulate and filenamesetter together? Ok, Now, I am aware of filenamesetter. However, what I would like to do now is include a filenamestter button in a manipulate ( or dynamic window ). Thus, you have a manipulate window form which has =66ilenamesetter browse button embedded in it. Once you click on the appropriate file(s), the data in the file is processed and shown in the manipulate window having gone through processing. I tried naively to do this but did not get anywhere. Is this right way to do this or is there a better approach=3F Peter ---------------------------------------------------------------------------- -- NOTICE: Protiviti is a leading international provider of independent internal audit and business and technology risk consulting services. Protiviti is not licensed or registered as a public accounting firm and does not issue opinions on financial statements or offer attestation services. === Kevin > There were some postings in the 'How should I get started with Mathematica' > thread about the lack of a printed book. In August 2007 there were postings on the question of the old book > organization and Thomas Muench posted some code that would create a Virtual > Mathematica Book from the documentation material. I have pasted his code at > the end of this posting. Paste it into a blank notebook and evaluate. It > will create a Virtual Book notebook. One nice thing about this virtual book > is that it has a listing of all the supplied 'standard' packages, which I > find otherwise difficult to find. I do not think an actual printed book is that useful with the new > Mathematica 6 because it is impossible to reproduce dynamic behavior on a > static printed page. The world changes and the elderly can adapt as well as > the young. We've had more practice. I think that one way to improve the new Version 6 documentation would be to > increase the density of information on the 'index pages'. One should not > have to go through a number of levels of index pages to get to the required > information. I think this would go a long way to decreasing complaints. > -- Kevin J. McCann Research Associate Professor JCET/Physics Physics Building University of Maryland, Baltimore County 1000 Hilltop Circle Baltimore, MD 21250 === Subject: Assuming I would appreciate some comments about the Assuming-function. Several examples using Mathematica 6 as follows: In[1]:= Assuming[a > 0, Simplify[a == -1]] Out[1]= False In[2]:= Assuming[a [Element] Integers, Simplify[a == -1]] Out[2]= a == -1 In[3]:= Assuming[a [Element] Integers && a > 0 && a < 2, Simplify[a^2< 1.1]] Out[3]= True In[4]:= Assuming[a [Element] Reals && a > 0 && a < 2, Simplify[a^2 < 1.1]] Out[4]= a < 1.04881 So far, everything seems pretty reasonable, but In[5]:= Assuming[a [Element] Integers && a > 0 && a < 2, Simplify[(a^2 - 1)/(a - 1)]] Out[5]= 1 + a whereas In[6]:= (a^2 - 1)/(a - 1) /. a -> 1 Out[6]= Indeterminate I consider this as blunder (or bug?); I comprehend working with domains can be pretty tricky and of course I don't expect In[7]:= Simplify[(a^2 - 1)/(a - 1)] to yield Out[7]= Beware, a != 1 neccessary! instead of Out[7]= 1 + a. Am I tricked by some personal misconception of how Mathematica deals with Assuming plus fractions as shown above, or is this a mere flaw? Markus Binder === Subject: Re: Assuming HI Markus, I think you are fooling yourself. Consider Simplify[(a^2 - 1)/(a - 1)] As a^2 - 1)== (a+1)(a-1) this will give (a+1). This is true in general, for a==1 understood as limit. Therefore, this has nothing to do with assumptions. On the other hand, (a^2 - 1)/(a - 1) /. a -> 1 can not be calculated as it gives 0/0. Note that /. and -> mean replacement, not limit. If you want a limit, you have to say so: Limit[(a^2 - 1)/(a - 1), a -> 1] hope this helps, Daniel I would appreciate some comments about the Assuming-function. Several examples using Mathematica 6 as follows: In[1]:= Assuming[a > 0, Simplify[a == -1]] > Out[1]= False > In[2]:= Assuming[a [Element] Integers, Simplify[a == -1]] > Out[2]= a == -1 > In[3]:= Assuming[a [Element] Integers && a > 0 && a < 2, Simplify[a^2< 1.1]] > Out[3]= True > In[4]:= Assuming[a [Element] Reals && a > 0 && a < 2, Simplify[a^2 < 1.1]] > Out[4]= a < 1.04881 So far, everything seems pretty reasonable, but In[5]:= Assuming[a [Element] Integers && a > 0 && a < 2, Simplify[(a^2 - 1)/(a - 1)]] > Out[5]= 1 + a whereas In[6]:= (a^2 - 1)/(a - 1) /. a -> 1 > Out[6]= Indeterminate I consider this as blunder (or bug?); I comprehend working with domains can be pretty tricky and of course I don't expect In[7]:= Simplify[(a^2 - 1)/(a - 1)] to yield Out[7]= Beware, a != 1 neccessary! instead of Out[7]= 1 + a. Am I tricked by some personal misconception of how Mathematica deals with Assuming plus fractions as shown above, or is this a mere flaw? Markus Binder > === Subject: eliminate all the occurrences of theta -> and lambda -> Hello All, I'm relatively new to Mathematica. Here's my problem. I have this list that I generated from FindMaximum: results = {{-5933.0186,{q*4.5785,l*1.0231}}, {-5960.3876,{q*5.0002,l*1.0085}}, {-5929.7166,{q*3.9758,l*1.0951}}, {-5929.4666,{q*3.9308,l*1.3277}}, {-5933.7226,{q*4.7088,l*1.1294}}, {-5928.0464,{q*3.6767,l*1.1019}}}; How do I eliminate all the occurrences of q* and l* to transform it into this list? {{4.5785,1.0231},{5.0002,1.0085},{3.9758,1.0951}, {3.9308,1.3277},{4.7088,1.1294},{3.6767,1.1019}} BTW, I can evaluate this function Take[Partition[Flatten[results],3],All,2;;3] to get to this point: {{q*4.5785,l*1.0231},{q*5.0002,l*1.0085},{q*3.9758,l*1.0951},{q*3.9308,l *1.3277},{q*4.7088,l*1.1294},{q*3.6767,l*1.1019}} $Version 6.0 for Microsoft Windows (32-bit) (June 19, 2007) Richard Richard Hofler Professor Department of Economics College of Business Administration P.O. Box 161400 University of Central Florida Orlando, FL 32816-1400 407-823-2606 === Subject: Re: eliminate all the occurrences of theta -> and lambda -> Hi Richard, simply replace q and l by 1: results/.{q->1,l->1} hope this helps, Daniel > Hello All, I'm relatively new to Mathematica. Here's my problem. I have this list that I generated from FindMaximum: results = {{-5933.0186,{q*4.5785,l*1.0231}}, > {-5960.3876,{q*5.0002,l*1.0085}}, > {-5929.7166,{q*3.9758,l*1.0951}}, > {-5929.4666,{q*3.9308,l*1.3277}}, > {-5933.7226,{q*4.7088,l*1.1294}}, > {-5928.0464,{q*3.6767,l*1.1019}}}; How do I eliminate all the occurrences of q* and l* > to transform it into this list? {{4.5785,1.0231},{5.0002,1.0085},{3.9758,1.0951}, > {3.9308,1.3277},{4.7088,1.1294},{3.6767,1.1019}} > BTW, I can evaluate this function Take[Partition[Flatten[results],3],All,2;;3] to get to this point: {{q*4.5785,l*1.0231},{q*5.0002,l*1.0085},{q*3.9758,l*1.0951},{q*3.9308,l > *1.3277},{q*4.7088,l*1.1294},{q*3.6767,l*1.1019}} $Version > 6.0 for Microsoft Windows (32-bit) (June 19, 2007) Richard Richard Hofler > Professor > Department of Economics > College of Business Administration > P.O. Box 161400 > University of Central Florida > Orlando, FL 32816-1400 > 407-823-2606 === Subject: Re: eliminate all the occurrences of theta -> and lambda - Hello All, I'm relatively new to Mathematica. Here's my problem. I have this list that I generated from FindMaximum: results = {{-5933.0186,{q*4.5785,l*1.0231}}, > {-5960.3876,{q*5.0002,l*1.0085}}, > {-5929.7166,{q*3.9758,l*1.0951}}, > {-5929.4666,{q*3.9308,l*1.3277}}, > {-5933.7226,{q*4.7088,l*1.1294}}, > {-5928.0464,{q*3.6767,l*1.1019}}}; How do I eliminate all the occurrences of q* and l* > to transform it into this list? {{4.5785,1.0231},{5.0002,1.0085},{3.9758,1.0951}, > {3.9308,1.3277},{4.7088,1.1294},{3.6767,1.1019}} BTW, I can evaluate this function Take[Partition[Flatten[results],3],All,2;;3] to get to this point: {{q*4.5785,l*1.0231},{q*5.0002,l*1.0085},{q*3.9758,l*1.0951},{q*3.9308,l > *1.3277},{q*4.7088,l*1.1294},{q*3.6767,l*1.1019}} $Version > 6.0 for Microsoft Windows (32-bit) (June 19, 2007) Richard Richard Hofler > Professor > Department of Economics > College of Business Administration > P.O. Box 161400 > University of Central Florida > Orlando, FL 32816-1400 > 407-823-2606 Hope this helps: In[1]:= results = {{-5933.0186,{q*4.5785,l*1.0231}}, {-5960.3876,{q*5.0002,l*1.0085}}, {-5929.7166,{q*3.9758,l*1.0951}}, {-5929.4666,{q*3.9308,l*1.3277}}, {-5933.7226,{q*4.7088,l*1.1294}}, {-5928.0464, {q*3.6767,l*1.1019}}}; In[2]:= results Out[2]= {{-5933.02, {4.5785 q, 1.0231 l}}, {-5960.39, {5.0002 q, 1.0085 l}}, > {-5929.72, {3.9758 q, 1.0951 l}}, {-5929.47, {3.9308 q, 1.3277 l}}, > {-5933.72, {4.7088 q, 1.1294 l}}, {-5928.05, {3.6767 q, 1.1019 l}}} In[3]:= Rest/@results Out[3]= {{{4.5785 q, 1.0231 l}}, {{5.0002 q, 1.0085 l}}, > {{3.9758 q, 1.0951 l}}, {{3.9308 q, 1.3277 l}}, {{4.7088 q, 1.1294 l}}, > {{3.6767 q, 1.1019 l}}} In[4]:= Out[3]/.{q->1,l->1} Out[4]= {{{4.5785, 1.0231}}, {{5.0002, 1.0085}}, {{3.9758, 1.0951}}, > {{3.9308, 1.3277}}, {{4.7088, 1.1294}}, {{3.6767, 1.1019}}} In[5]:= ?Flatten Flatten[list] flattens out nested lists. Flatten[list, n] flattens to level n. Flatten[list, n, h] flattens subexpressions with head h . Flatten[list, {{s , s , ...}, {s , s , ...}, ...}] 11 12 21 22 flattens list by combining all levels s ij to make each level i in the result. In[6]:= Flatten[Out[4],2] Out[6]= {4.5785, 1.0231, 5.0002, 1.0085, 3.9758, 1.0951, 3.9308, 1.3277, > 4.7088, 1.1294, 3.6767, 1.1019} In[7]:= Flatten[Out[4],3] Out[7]= {4.5785, 1.0231, 5.0002, 1.0085, 3.9758, 1.0951, 3.9308, 1.3277, > 4.7088, 1.1294, 3.6767, 1.1019} In[8]:= Flatten[Out[4],1] Out[8]= {{4.5785, 1.0231}, {5.0002, 1.0085}, {3.9758, 1.0951}, > {3.9308, 1.3277}, {4.7088, 1.1294}, {3.6767, 1.1019}} Raj === Subject: Re: eliminate all the occurrences of theta -> and lambda -> (Last /@ results) /. {l -> 1, q -> 1} > Hello All, I'm relatively new to Mathematica. Here's my problem. I have this list that I generated from FindMaximum: results = {{-5933.0186,{q*4.5785,l*1.0231}}, > {-5960.3876,{q*5.0002,l*1.0085}}, > {-5929.7166,{q*3.9758,l*1.0951}}, > {-5929.4666,{q*3.9308,l*1.3277}}, > {-5933.7226,{q*4.7088,l*1.1294}}, > {-5928.0464,{q*3.6767,l*1.1019}}}; How do I eliminate all the occurrences of q* and l* > to transform it into this list? {{4.5785,1.0231},{5.0002,1.0085},{3.9758,1.0951}, > {3.9308,1.3277},{4.7088,1.1294},{3.6767,1.1019}} > BTW, I can evaluate this function Take[Partition[Flatten[results],3],All,2;;3] to get to this point: {{q*4.5785,l*1.0231},{q*5.0002,l*1.0085},{q*3.9758,l*1.0951},{q*3.9308,l > *1.3277},{q*4.7088,l*1.1294},{q*3.6767,l*1.1019}} $Version > 6.0 for Microsoft Windows (32-bit) (June 19, 2007) Richard Richard Hofler > Professor > Department of Economics > College of Business Administration > P.O. Box 161400 > University of Central Florida > Orlando, FL 32816-1400 > 407-823-2606 === Subject: Re: eliminate all the occurrences of theta -> and lambda - Hello All, I'm relatively new to Mathematica. Here's my problem. I have this list that I generated from FindMaximum: results = {{-5933.0186,{q*4.5785,l*1.0231}}, > {-5960.3876,{q*5.0002,l*1.0085}}, > {-5929.7166,{q*3.9758,l*1.0951}}, > {-5929.4666,{q*3.9308,l*1.3277}}, > {-5933.7226,{q*4.7088,l*1.1294}}, > {-5928.0464,{q*3.6767,l*1.1019}}}; How do I eliminate all the occurrences of q* and l* > to transform it into this list? {{4.5785,1.0231},{5.0002,1.0085},{3.9758,1.0951}, > {3.9308,1.3277},{4.7088,1.1294},{3.6767,1.1019}} Try results[[All, 2]] /. {l -> 1, q -> 1} === Subject: Re: Re: open URL programmatically? How did you discover that, since the Documentation Center does not seem to say anything about it (unless I missed it)? > FrontEndExecute[{FrontEnd`NotebookLocate[{URL[theURL], None}]}] or NotebookLocate[{URL[theURL], None}] I hope that this helps... > --David > A WorkLife FrameWork > E x t e n d i n g MATHEMATICA's Reach... > http://scientificarts.com/worklife/ > Hi all, >> I know how to create a hyperlink and click on it to go to an URL in my >> browser. But I don't know how to write a program that does that >> without making the user click. In other words, I'd like a function >> such as >> openURL[url] >> that goes to the URL in the browser. Any ideas? >> --Mark -- 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: NearestFunction Algorithm > I'm looking to iteratively assign a list of initial points to a list > of final points such that at each step, the initial point that is > furthest from its nearest final point is assigned to its nearest final > point. =A0That final points is then no longer available to other initial > points. I noticed that you can speed up repeated uses of Nearest by calling it > with only one argument in order to produce a NearestFunction, and then > using that in later calculations. =A0Can anyone give me a clue about how > this actually works? Is it possible to manipulate a NearestFunction in order to remove > points that have already been assigned? > Jason Merrill If you have a list of points, pts = {1,2,3,4,5} then you could make a NearestFunction by writing myFunction = Nearest[pts] myFunction works just like any other function, so if you want to find the nearest element to 7, you write myFunction[7] As far as removing points that have already been assigned, I don't think you can do that without creating a new NearestFunction at every step of the algorithm. -Daniel === Subject: Re: How should I start with mathematica? > If you can master those 3 books then update your knowledge about new > functionality on version 6.0 with http://reference.wolfram.com/mathematica/guide/Mathematica.html Good suggestion -- if it weren't for the fact that that particular page > has (by actual count) **one hundred and twenty three** (123) separate > links on it -- each of which you'll have to click to, one at a time, and > then click back from -- not to mention the scrolling and the perhaps > dozen or so links you'll have to click to or nested cells you'll have to > open within each of those pages. Actually I only found 86, of which only 7 are titled New in 6 ;-) === Subject: Re: How should I start with mathematica? If you can master those 3 books then update your knowledge about new > functionality on version 6.0 with http://reference.wolfram.com/mathematica/guide/Mathematica.html > Good suggestion -- if it weren't for the fact that that particular page has (by actual count) **one hundred and twenty three** (123) separate links on it -- each of which you'll have to click to, one at a time, and then click back from -- not to mention the scrolling and the perhaps dozen or so links you'll have to click to or nested cells you'll have to open within each of those pages. === Subject: Re: Re: How should I start with mathematica? Jakub, This isn't exactly what you're looking for (in particular, the structure of the list is merely alphabetical order), but if you start typing a command (say String) and then press Ctrl-K (at least on Windows and Linux), you'll get a list of all of the currently-loaded functions the names of which start with that string. It helps me immensely when I can't remember which command I should be using, but know what it starts with. Hope that helps! C.O. [...] > But what I'm missing for my work is some structured list of functions. For > example when I'm looking for let's say string manipulation functions, I > start with writing word String and pressing F1 in notebook. Than I use See > also, More about or Tutorials sections of the help and after while of > clicking I usualy find what I need. > But if I had such structured list of functions (may be printed on some > bigger format poster), I think this searching could be much faster. Jakub Curtis Osterhoudt cfo@remove_this.lanl.and_this.gov PGP Key ID: 0x4DCA2A10 Please avoid sending me Word or PowerPoint attachments See http://www.gnu.org/philosophy/no-word-attachments.html === Subject: Re: Re: How should I start with mathematica? As a teacher, I hate textbooks (or electronic versions thereof) that have answers to all, or most, of the problems. Such books defeat one of their main purposes: to provide problems I can assign that students work on, and then I can read their solutions and provide feedback. (A few solutions are OK -- no more than half.) > Hi Szabolcs, I am working my way through the link > You recommended - http://library.wolfram.com/infocenter/MathSource/1847/ Its Great! However many of the Homework questions do not have answers... Just wondering if there is a collection of ready made answers anywhere that > I can view after I have tried the problem myself... it would be very helpful > to double check my answers... > -----Original Message----- === > Subject: Re: How should I start with mathematica? > I'm new in mathematica, Is there any approach recommended to start with > mathematica? It depends on what you plan to use Mathematica for. If you would like > to understand the system well, and you are not in a hurry, take a look > at these notes: http://library.wolfram.com/infocenter/MathSource/1847/ > They are terribly outdated, but still useful to learn the core > language, especially if you don't have much programming experience. > Some exercises are included, too. And, as others said, read the included documentation! It is full of > good tutorials (suitable for beginners), though unfortunately it is a > bit more difficult to navigate in version 6 than in previous versions. > -- 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: Equation reference can somebody help me how to insert a reference to a numbered displayed Stefan === Subject: Helpfile-like action in ordinary notebook Is it possible to set up, in Version 5.2, a group of cells in a normal notebook that will have a similar behaviour to the Further Information sections in the Version 5 help file? What I'd like to have is a group of cells that can be toggled between open and closed by clicking a permanently visible icon (whether the icon changes shape as the cells change from open to closed is immaterial). Tony Harker Dr A.H. Harker Department of Physics and Astronomy University College London Gower Street London WC1E 6BT Tel: (44)(0) 2076793404 E: a.harker@ucl.ac.uk === Subject: Re: rendering problem if you enter things like > g1 = g0 /. Point[x_] :> Line[x] > > g2 = Show[g0 /. Point[x_] :> {Opacity[0.4], Polygon[x]}, > BoxRatios -> {1, 0.5, 1}, ImageSize -> 500] there is no wonder that nonsense comes out. What is with Module[{gline}, gline = {1, 1, 0}*# & /@ dtaset; {color, Line[dtaset], Opacity[0.5], {EdgeForm[], Polygon /@ Most[Transpose[{dtaset, RotateLeft[dtaset], RotateLeft[gline], gline}] ]} } ] and Graphics3D[ MapThread[ {data, {RGBColor[1, 0, 0], RGBColor[0, 1, 0]}} ], BoxRatios -> {1, 1, 1} ] ?? > Hi everybody, I have to plot various sets of experimental data in the same 3D graph, what > is easily done with ListPoint3D (g0 at the end of this e-mail, after the big > data list); substituting the points with a line is also easy (g1); the > problem arises when I need to fill each data set (g2), when the rendering > does not occurs correctly, as small gaps can be seen in each data set. Also, > the generated PDF shows lots of triangles and flaws. I am running versior > 6.0.0 under Windows XP. Any Ideas on how to solve this problem? Ricardo data = {{{510.525, 1, 0.000012015350868422505}, {513.475, 1, > 0.}, {516.4375, 1, 0.0008313530253405353}, {519.4000000000001, 1, > 0.0008351544303773088}, {522.3625, 1, > 0.0008205487649462082}, {525.3249999999999, 1, > 0.0008317872796995367}, {528.275, 1, > 0.0008205532433342349}, {531.2375, 1, > 0.000827384158447478}, {537.1625, 1, > 0.0008421621223939312}, {540.125, 1, > 9.600081565752917*^-6}, {543.075, 1, > 0.000010034485204355387}, {546.0375, 1, > 0.000025678838098478815}, {549., 1, > 0.000029999586866763887}, {551.9625, 1, > 0.0000448648495238199}, {554.9250000000001, 1, > 0.00006474038342569176}, {557.875, 1, > 0.0000736415826839378}, {560.8375, 1, > 0.00009006502581512868}, {563.8, 1, > 0.00009593962594912263}, {566.7624999999999, 1, > 0.00010881678288146817}, {569.7249999999999, 1, > 0.00011728825095261968}, {572.675, 1, > 0.00013232817074272204}, {575.6375, 1, > 0.00013172373763870095}, {578.6, 1, > 0.00012316732947464053}, {581.575, 1, > 0.00014287283391109385}, {584.5374999999999, 1, > 0.00013448645521245206}, {587.5, 1, > 0.00012057479064590896}, {590.475, 1, > 0.00011564513038557596}, {593.45, 1, > 0.0001038021825282263}, {596.4375, 1, > 0.00008832800837912239}, {599.425, 1, > 0.00007994610806850745}, {602.4, 1, > 0.00007372234294802162}, {605.375, 1, > 0.000057043631699301486}, {608.3625, 1, > 0.00005211844982699531}, {611.3499999999999, 1, > 0.000060325693004563934}, {614.3375, 1, > 0.000052722882931016413}, {617.3249999999999, 1, > 0.00004200819029722596}, {620.3, 1, > 0.00003985005510709683}, {623.275, 1, > 0.000035614395711321534}, {626.2624999999999, 1, > 0.00003812184516754333}, {629.25, 1, > 0.000029910123601947907}, {632.2375, 1, > 0.000022047611806724583}, {635.225, 1, > 0.000015568727848310377}, {638.2, 1, > 0.000018420863902997157}, {641.175, 1, > 0.00002005965536161496}, {644.1625, 1, > 0.000019020818618991422}, {647.15, 1, > 0.000020664088465636032}, {650.1374999999999, 1, > 0.0000177267137588386}, {653.125, 1, > 0.00002170277592865869}, {656.1, 1, > 0.000029390630590835728}, {659.075, 1, > 0.00003863671051102782}, {662.0625, 1, > 0.00004632908834511195}, {665.05, 1, > 0.000057218288832347837}, {668.0375, 1, > 0.00006127944037467773}, {671.0250000000001, 1, > 0.00006162412697314268}, {674., 1, > 0.00008141472078210572}, {676.975, 1, > 0.00008876226273812394}, {679.9625, 1, > 0.00010942136526509009}, {682.95, 1, > 0.0001326862925052675}, {685.9375, 1, > 0.00014625312119374476}, {688.925, 1, > 0.0001809940670322735}, {691.9, 1, > 0.00021382303974254793}, {694.875, 1, > 0.00025420556025807466}, {697.8625, 1, > 0.00028853001601010834}, {700.8499999999999, 1, > 0.000323436512926029}, {703.8375, 1, > 0.0003447001978366171}, {706.8125, 1, > 0.00036005808317662435}, {709.7874999999999, 1, > 0.0004058001892030598}, {712.7625, 1, > 0.0004665596737998625}, {718.7375000000001, 1, > 0.0004941858045801673}, {721.7249999999999, 1, > 0.0005104390689663386}, {724.7, 1, > 0.0005524379890003491}, {727.6750000000001, 1, > 0.000618301940270132}, {730.6625, 1, > 0.0006912402518262967}, {733.6500000000001, 1, > 0.00073798521821154}, {736.6374999999999, 1, > 0.0007730887642006411}, {739.625, 1, > 0.0008251924204191877}, {742.6, 1, > 0.0009305272416818359}, {745.575, 1, > 0.0012112955991950853}, {748.5625, 1, > 0.0017703983103290015}, {751.5500000000001, 1, > 0.0029367304309679556}, {754.5375, 1, > 0.004732592691409948}, {757.5250000000001, 1, > 0.008281742520839276}, {760.5125, 1, > 0.013854478104121661}, {763.5, 1, 0.023589000878440004}, {766.5, > 1, 0.04231463401462301}, {769.4875, 1, > 0.07022693378984221}, {772.475, 1, > 0.11639911434645413}, {775.4625, 1, > 0.17765599857343675}, {778.45, 1, 0.2562666364043835}, {781.4375, > 1, 0.3553390291299142}, {784.425, 1, > 0.46077968962959637}, {787.4124999999999, 1, > 0.5810094801898785}, {790.3999999999999, 1, > 0.7059505349543853}, {793.3999999999999, 1, > 0.8201404728624835}, {796.3999999999999, 1, > 0.9060628255452337}, {799.3999999999999, 1, > 0.9680750645527414}, {802.3874999999999, 1, > 0.9993730256762438}, {805.375, 1, 0.9999999999999999}, {808.3625, > 1, 0.9785082158592452}, {811.35, 1, > 0.918061919865119}, {814.3374999999999, 1, > 0.8423025224112535}, {817.3125, 1, > 0.7560204058903477}, {820.2875, 1, > 0.6725596738263446}, {823.2624999999999, 1, > 0.5859521277754892}, {826.25, 1, 0.5052366475719327}, {829.2375, > 1, 0.42357174910668816}, {832.2125, 1, > 0.35005602405426434}, {835.1875000000001, 1, > 0.291762339905034}, {838.1625, 1, > 0.2314772658798734}, {841.1500000000001, 1, > 0.18110137176207755}, {844.1374999999999, 1, > 0.13584726075096562}, {847.1125000000001, 1, > 0.10088149983349}, {850.0875, 1, 0.0720630728808423}, {853.0625, > 1, 0.052105883037281184}, {856.05, 1, > 0.03719732929596585}, {859.0375, 1, > 0.026649232696773485}, {862.0125, 1, > 0.01935393860106826}, {864.9875, 1, > 0.013908218760443614}, {867.9625000000001, 1, > 0.01012248808176376}, {870.9499999999999, 1, > 0.007345887505129481}, {873.9375, 1, > 0.005200739640278161}, {876.9125, 1, > 0.00355201317638204}, {879.8875, 1, > 0.00246999312937099}, {882.8625, 1, > 0.0017506526496799076}, {885.8499999999999, 1, > 0.001367065877136286}, {888.8249999999999, 1, > 0.0010862231783817914}, {891.8, 1, > 0.0009086243415202183}, {894.7749999999999, 1, > 0.0007918682872727469}, {897.75, 1, > 0.000701135548730778}, {900.7375, 1, > 0.0006779869102996974}, {903.7125, 1, > 0.0006535844725007053}, {906.6875000000001, 1, > 0.0006404653333353102}, {909.6625, 1, > 0.0005811832689485585}, {912.6500000000001, 1, > 0.0005643479633985003}, {915.6249999999999, 1, > 0.0005511394057521694}, {918.6, 1, > 0.0005226178959257005}, {921.5749999999999, 1, > 0.000510349501205802}, {924.5500000000001, 1, > 0.0005070360911843517}, {927.5375, 1, > 0.0004602911247991083}, {930.5125, 1, > 0.00044461990157682393}, {933.4875000000001, 1, > 0.00043405299574791894}, {936.4624999999999, 1, > 0.0004584105003870417}, {939.45, 1, > 0.0004567537953763166}, {942.425, 1, > 0.0004721563153169912}, {945.4, 1, > 0.00047932024336390936}, {948.375, 1, > 0.00044103778827376383}, {951.3499999999999, 1, > 0.0004546046169622412}, {954.3375, 1, > 0.0004279187983879696}, {957.3125, 1, > 0.0003892108964352753}, {960.2874999999999, 1, > 0.0003609579406108153}, {963.2625, 1, > 0.00032717074214240027}, {966.2499999999999, 1, > 0.0002849749223148103}, {969.225, 1, > 0.0002391792249116538}, {972.2, 1, > 0.0002451342867505298}, {975.1750000000001, 1, > 0.0002106530874175571}, {978.1500000000001, 1, > 0.00021383214579820249}, {981.1249999999999, 1, > 0.00022871980039539263}, {984.1, 1, > 0.00019396109028435742}, {987.0749999999999, 1, > 0.00018920593787746988}, {990.0500000000001, 1, > 0.00019370134377880122}, {993.0375, 1, > 0.00019681322633904416}, {996.0125, 1, > 0.0001781555154212681}, {998.9875000000001, 1, > 0.00018810007459404477}, {1001.9624999999999, 1, > 0.0001674497795635313}, {1004.95, 1, > 0.00015489491728951665}, {1007.925, 1, > 0.00019422068751031264}, {1010.9, 1, > 0.00020303699145953003}, {1013.875, 1, > 0.0001944804340158687}, {1016.8499999999999, 1, > 0.0002113291747300075}, {1019.8375, 1, > 0.00020864706814073932}, {1022.8125, 1, > 0.0001989622554735187}, {1025.7875, 1, > 0.00019835782236949764}, {1028.7625, 1, > 0.00020216370579429822}, {1031.7499999999998, 1, > 0.00019222362500954842}, {1034.725, 1, > 0.0002029202548116306}, {1037.6999999999998, 1, > 0.00018770567788848198}, {1040.675, 1, > 0.0001736195054684934}, {1043.6500000000003, 1, > 0.003981940069033281}, {1046.6375, 1, > 0.003988087552277709}, {1049.6125000000002, 1, > 0.003979960920084623}, {1052.5874999999999, 1, > 0.003984281668852909}, {1055.5625, 1, > 0.003960685340898747}, {1058.55, 1, > 0.0039439396031092245}, {1061.525, 1, > 0.003995694990018884}, {1064.5, 1, > 0.003995609900646374}, {1067.475, 1, > 0.0001762299578493323}, {1070.45, 1, > 0.0001511515820174908}, {1073.4250000000002, 1, > 0.0001467457438766959}, {1076.4, 1, > 0.00013533719965794875}, {1079.375, 1, > 0.0001349027960193463}, {1082.3500000000001, 1, > 0.00011338393255898936}, {1085.3375, 1, > 0.0000751998527258332}, {1088.3125, 1, > 0.00009393817462809223}}, {{509.5, 2, > 0.0001947656171689308}, {512.1625, 2, > 0.00015272972340914348}, {514.8249999999999, 2, > 0.0001095750823536299}, {517.4875, 2, > 8.079841580245149*^-7}, {520.15, 2, > 0.00002484033347362498}, {522.8125, 2, 0.}, {525.475, 2, > 0.00008869179950007362}, {528.1374999999999, 2, > 0.00015304255830109656}, {530.8, 2, > 0.00031936298959906226}, {533.4625, 2, > 0.00040519576823227994}, {536.1374999999999, 2, > 0.0006394904565168709}, {538.8, 2, > 0.000759652203094873}, {541.4625, 2, > 0.0008546835706040621}, {544.1249999999999, 2, > 0.0010119090007386239}, {546.7875, 2, > 0.0011221056093676574}, {549.45, 2, > 0.0013073204394378883}, {552.1125, 2, > 0.0013265463188903688}, {554.775, 2, > 0.0014135392799043396}, {557.4375, 2, > 0.0013826701415593013}, {560.0999999999999, 2, > 0.0014613968031104059}, {562.7624999999999, 2, > 0.0015317121424010508}, {565.4375, 2, > 0.0016265984871126453}, {568.0999999999999, 2, > 0.001644415573674211}, {570.7624999999999, 2, > 0.0016164468912810556}, {573.4375, 2, > 0.001669898150965753}, {576.0999999999999, 2, > 0.0017241781123509888}, {578.7624999999999, 2, > 0.0017502822159179338}, {581.4375, 2, > 0.0017366086378590578}, {584.1125000000001, 2, > 0.0018043550018780352}, {586.775, 2, > 0.0016922730968802777}, {589.45, 2, > 0.0017328794802066371}, {592.125, 2, > 0.001717962849596954}, {594.8, 2, > 0.0017546328998457581}, {597.4875, 2, > 0.0017328794802066371}, {600.1750000000001, 2, > 0.001716305446195878}, {602.8625000000001, 2, > 0.0017330866556317715}, {605.5375, 2, > 0.0017318436030809648}, {608.225, 2, > 0.001792960353495638}, {610.9125, 2, > 0.001807462633255052}, {613.5999999999999, 2, > 0.0019558002376513445}, {616.2874999999999, 2, > 0.0021066239471492507}, {618.9749999999999, 2, > 0.002388382525332153}, {621.65, 2, > 0.0028257298477910543}, {624.325, 2, > 0.0034522283333977416}, {627.0125, 2, > 0.004236594492956907}, {629.7, 2, > 0.005320743492685675}, {632.3874999999999, 2, > 0.006911850757718532}, {635.0749999999999, 2, > 0.009207354468208643}, {637.7624999999999, 2, > 0.012767042622869389}, {640.4375, 2, > 0.018496479004963616}, {643.125, 2, > 0.026501737432160173}, {645.8125, 2, > 0.03831446582247833}, {648.5, 2, 0.05536500331104657}, {651.1875, > 2, 0.08138830846218942}, {653.875, 2, > 0.11562611921991466}, {656.55, 2, 0.15771173508173425}, {659.225, > 2, 0.20647875840414107}, {661.9125, 2, > 0.25721394826532545}, {664.6, 2, > 0.310016748869352}, {667.2874999999999, 2, > 0.3570207093238643}, {669.975, 2, > 0.40016499160812113}, {672.6625, 2, > 0.4270149267055506}, {675.3374999999999, 2, > 0.44553640971257374}, {678.025, 2, > 0.44779462184653973}, {680.7125, 2, 0.43990123814891574}, {683.4, > 2, 0.422829983117834}, {686.0875, 2, > 0.402464638827114}, {688.775, 2, 0.3785565947665942}, {691.45, 2, > 0.3532397578151599}, {694.125, 2, > 0.3338067029375451}, {696.8125, 2, 0.31172180261820887}, {699.5, > 2, 0.29821396489944035}, {702.1875000000001, 2, > 0.28567985167880394}, {704.875, 2, > 0.28008611520017274}, {707.5625, 2, > 0.2736636770210037}, {710.2375000000001, 2, > 0.2751760576244855}, {712.925, 2, > 0.27726852941834373}, {715.6125, 2, 0.2803140081678207}, {718.3, > 2, 0.28918111636357674}, {720.9875, 2, > 0.29647369132831064}, {723.6750000000001, 2, > 0.30565156266176846}, {726.35, 2, > 0.31337920601928476}, {729.0250000000001, 2, > 0.3192008354655638}, {731.7125, 2, 0.3252089227944639}, {734.4, > 2, 0.3289795155319116}, {737.0875, 2, > 0.33490473269075793}, {739.7749999999999, 2, > 0.3390896762784746}, {742.4625, 2, > 0.3429845742710028}, {745.1374999999999, 2, > 0.34623722844561433}, {747.8249999999999, 2, > 0.35369554375045587}, {750.5125, 2, 0.36235547652107736}, {753.2, > 2, 0.365338802643014}, {755.8874999999999, 2, > 0.3695030286882172}, {758.575, 2, > 0.3692958532630827}, {761.2624999999998, 2, > 0.3660431990884712}, {763.9499999999999, 2, > 0.36167179761813356}, {766.65, 2, > 0.35723824352025557}, {769.3375, 2, > 0.34671373192342364}, {772.0250000000001, 2, > 0.33780518864264075}, {774.7125, 2, 0.3329987187795206}, {777.4, > 2, 0.32947673655223436}, {780.0875, 2, > 0.3290209506169384}, {782.7749999999999, 2, > 0.33239791004663066}, {785.4625, 2, > 0.33645854837926653}, {788.15, 2, 0.340912820019658}, {790.85, 2, > 0.35040145449081744}, {793.5500000000001, 2, > 0.35553940503415277}, {796.25, 2, 0.35943430302668117}, {798.95, > 2, 0.3608223783750822}, {801.65, 2, > 0.3597450661643828}, {804.3374999999999, 2, > 0.3556015576616931}, {807.025, 2, 0.3560987786820159}, {809.7125, > 2, 0.3559330383419083}, {812.4, 2, > 0.3521624456044606}, {815.0875, 2, > 0.3548971612162359}, {817.7625, 2, > 0.3591856925165198}, {820.4375, 2, > 0.3677006024895471}, {823.1125000000001, 2, > 0.3816020735160712}, {825.8, 2, 0.39846615312201844}, {828.4875, > 2, 0.4148744467926697}, {831.1750000000001, 2, > 0.4324843579291011}, {833.85, 2, > 0.45168951983906797}, {836.5250000000001, 2, > 0.4685743169875286}, {839.2125, 2, 0.4865364263466886}, {841.9, > 2, 0.5059280461392766}, {844.5875, 2, > 0.5246567045714341}, {847.2625, 2, > 0.5466794522632301}, {849.9375000000001, 2, > 0.579371734349452}, {852.6125000000001, 2, > 0.6231686192228825}, {855.3, 2, > 0.67902311383914}, {857.9875000000001, 2, > 0.7394561853508698}, {860.675, 2, > 0.8037012846850741}, {863.3499999999999, 2, > 0.8665790262133908}, {866.025, 2, 0.923013612020025}, {868.7125, > 2, 0.9686957932621791}, {871.4, 2, > 0.9999999999999999}, {874.0875, 2, > 0.9938468898735058}, {876.7625, 2, > 0.9600980131190979}, {879.4375, 2, > 0.9107073917670365}, {882.1125000000001, 2, > 0.847705344983639}, {884.8, 2, 0.7761676706847009}, {887.4875, 2, > 0.7025168070493908}, {890.1625, 2, > 0.6335481080221204}, {892.8375, 2, > 0.5657603089181162}, {895.5125, 2, 0.5211761574291748}, {898.2, > 2, 0.49351823817372087}, {900.8874999999999, 2, > 0.4754939761870205}, {903.5625, 2, > 0.4628977103388437}, {906.2375, 2, > 0.45465212841849106}, {908.9125, 2, 0.4501771392355862}, {911.6, > 2, 0.4446869904695223}, {914.2874999999999, 2, > 0.4362549506665486}, {916.9625000000001, 2, > 0.4258133092397706}, {919.6375, 2, > 0.40793407005066445}, {922.3125, 2, 0.3861392153265164}, {925., > 2, 0.36181682041572777}, {927.6875000000001, 2, > 0.33674859397445484}, {930.3625, 2, > 0.30919426243156817}, {933.0375, 2, > 0.27909167315952726}, {935.7125, 2, 0.25019898837027177}, {938.4, > 2, 0.22379448043688147}, {941.0875, 2, > 0.20146925662438916}, {943.7625, 2, > 0.18220608559538462}, {946.4375000000001, 2, > 0.16614170313045654}, {949.1125000000001, 2, > 0.15055796765184043}, {951.8, 2, > 0.13811501161826317}, {954.4875000000001, 2, > 0.1281560889320484}, {957.1624999999999, 2, > 0.1181681616863148}, {959.8375000000001, 2, > 0.10900893614111917}, {962.5124999999999, 2, > 0.09891949293706966}, {965.1999999999999, 2, > 0.08966911020481484}, {967.8875, 2, > 0.08044566027782751}, {970.5624999999999, 2, > 0.07248390868990919}, {973.2375, 2, > 0.0648888576044789}, {975.9125, 2, 0.058545146086860934}, {978.6, > 2, 0.05303635153253494}, {981.2874999999999, 2, > 0.04772644538633805}, {983.9625, 2, > 0.043265958483192556}, {986.6375, 2, > 0.0387060273759825}, {989.3125, 2, 0.03494579340979158}, {992., > 2, 0.03132436697844075}, {994.6875, 2, > 0.028322395068242037}, {997.3625, 2, > 0.025080099664887327}, {1000.0374999999999, 2, > 0.02224241786682027}, {1002.7125, 2, > 0.019836489654733475}, {1005.4, 2, > 0.017763285175412667}, {1008.0875, 2, > 0.01564201599746066}, {1010.7625, 2, > 0.013711555386057513}, {1013.4375, 2, > 0.012139922610987298}, {1016.1125000000001, 2, > 0.010580306010574882}, {1018.8, 2, > 0.00902068941016247}, {1021.4875, 2, > 0.007951871391893654}, {1024.1625, 2, > 0.0069864339107669465}, {1026.8375, 2, > 0.006157110683953597}, {1029.5125, 2, > 0.005699874520681786}, {1032.2, 2, > 0.005252582777816429}, {1034.8875, 2, > 0.004751218248990972}, {1037.5625000000002, 2, > 0.00441310795517149}, {1040.2375, 2, > 0.0044622085309283625}, {1042.9125, 2, > 0.0041841791103978815}, {1045.6000000000001, 2, > 0.003945720196068088}, {1048.2749999999999, 2, > 0.003713890895342597}, {1050.9499999999998, 2, > 0.003500293032028941}, {1053.625, 2, > 0.0033186001841859973}, {1056.3, 2, > 0.002993749117575122}, {1058.9875, 2, > 0.0028143351994086565}, {1061.6625, 2, > 0.002526154183046586}, {1064.3375, 2, > 0.0023015760222008025}, {1067.0125, 2, > 0.0022779580237354707}, {1069.7, 2, > 0.002110145929376537}, {1072.3875, 2, > 0.002050686582362939}, {1075.0625000000002, 2, > 0.0019887411302477276}, {1077.7375, 2, > 0.0021265127879621613}, {1080.4125, 2, > 0.0020912929656892983}, {1083.1000000000001, 2, > 0.0028501765479569236}, {1085.7875, 2, > 0.0029083928424197135}, {1088.4624999999999, 2, > 0.0028085342875048915}}}; > g0 = ListPointPlot3D[data, > Filling -> None, > BoxRatios -> {1, 1, 1}, > PlotRange -> All, > Lighting -> {{Ambient, White}}] g1 = g0 /. Point[x_] :> Line[x] g2 = Show[g0 /. Point[x_] :> {Opacity[0.4], Polygon[x]}, > BoxRatios -> {1, 0.5, 1}, ImageSize -> 500] Export[C:TempGraph.pdf, g2] > -- Ricardo Elgul Samad tel: (+55 11) 3133-9372 > fax: (+55 11) 3133-9374 Centro de Lasers e Aplica=E7=F5es > IPEN/CNEN-SP > AV. Prof. Lineu Prestes 2242 > Cidade Universit=E1ria > 05508-000 > S=E3o Paulo - SP > Brazil === Subject: Re: Numerical Evaluation > function and I want to evaluate a derivative (not necessarily the >> first derivative) of the function. What is the best way to do this? Is there a problem with using the built in operator D? For example, a second derivative is computed as follows: In[1]:= D[x^3 + x Sin[x], {x, 2}] Out[1]= -sin(x) x+6 x+2 cos(x) And this can be used to give a numerical result by simply using > a replacement rule, i.e., for x = 2.5 the result is: In[2]:= D[x^3 + x Sin[x], {x, 2}] /. x -> 2.5 Out[2]= 11.9015 -- > To reply via email subtract one hundred and four > Dave === Subject: 5 plots in 1 eps file?? I have 5 different plots all drawn in Mathematica 5.2 and I want to export them all in one eps file. The plots are all 3D plots (drawn with plot3d and listplot3d functions). How can I do this? P.S.: I also want to be able to edit the positions of these plots in that big eps file. I will be very happy for any help. Thx === Subject: [functional approach should give] an even faster way to normalize a Hello UG: I have a 512x512 array of 3-tuples. I want to make any tuple with a value outside of 0 <--> 1, become {0.,0.,0.}. The first version has this loop: For[i = 1, i <= graphSize, i++, For[j = 1, j <= graphSize, j++, If[((sum[[i, j, 1]] < 0) || (sum[[i, j, 1]] > 1) || (sum[[i, j, 2]] < 0) || (sum[[i, j, 2]] > 1) || (sum[[i, j, 3]] < 0) || (sum[[i, j, 3]] > 1)), sum[[i, j]] = {0., 0., 0.} ] ] ]; After scratching my head for a while I came up with this (equivalent) Map statement. sum = Map[ If[#[[1]] < 0 || #[[1]] > 1 || #[[2]] < 0 || #[[2]] > 1 || #[[3]] < 0 || #[[3]] > 1, {0., 0., 0.}, #] &, sum, {2}]; It is faster but only by about 15%. It is unreasonable to believe some other construction can accomplish this with a bigger payoff? === Subject: Re: Assuming > Hi David, we all learned not to divide by zero, > but things are a bit more subtle than this. Of course. > You claim that (a^2 - 1)/(a - 1) should simplify to If[a == 1, > Indeterminate, a + 1] and not to (a+1), I said that it should simplify to _something equivalent to_ If[a == 1, Indeterminate, a + 1]. Furthermore, when I said should, I should have made it clear that I was talking about in an ideal sense, rather than practicality. Sorry that I failed to make that clear. I do not claim that Mathematica should be rewritten so that Simplify[(a^2 - 1)/(a - 1)] yields anything other than what it currently does. Perhaps you noticed what I said at the end of my response: But such a result [like If[a == 1, Indeterminate, a + 1] here] is normally considered to be too cumbersome to be practical; the 'misdemeanor' simplification is considered preferable. All CASs known to me make such simplifications. Thus, if the developers consider If[a == 1, Indeterminate, a + 1] to be too cumbersome to be practical, I accept their judgement, despite the fact that (a + 1) is not equivalent to (a^2 - 1)/(a - 1). Also, note that simplify to something equivalent to If[a == 1, Indeterminate, a + 1] leaves open the possibility that Simplify[(a^2 - 1)/(a - 1)] would yield (a^2 - 1)/(a - 1) unchanged. > but you do not give a good reason for this. I didn't mention a reason; I thought it was obvious. Namely, (a^2 - 1)/(a - 1) and (a + 1) are not equivalent. In Mathematica, when a is 1, the former expression is Indeterminate while the latter is 2. > Obviously (a^2 - 1)/(a - 1) is not defined for a==1, Well, in Mathematica, it's not defined as anything I'd normally call a number, but it is defined to be Indeterminate. [You may consider that comment to be mere pedantry. However, Indeterminate in Mathematica corresponds fairly well to NaN in standard floating-point arithmetic. IIRC, Kahan is quite adamant that NaN is not the same as undefined.] > but note that the left and right limit exist and are identical. Sure, the singularity is removable. > Now what harm is done if > we replace the first function by a second one (a+1) that agrees with > the first one where it is defined, but that is also defined for a==1? A singularity has vanished all of a sudden. Although that required us to invoke Simplify in this case, there are simpler cases when this can happen without even asking for any simplifcation, such as In[7]:= x/x Out[7]= 1 Whatever potential harm this misdemeanor might do is outweighed, in the minds of most (perhaps, all) CAS developers, by the utility of having a simpler result. For all I know, some future version of Mathematica might return 0 and Sinc[x] for FullSimplify[0^Abs[z]] and FullSimplify[Sin[x]/x], resp.; in the current version, FullSimplify leaves those arguments unchanged. > This seems to me a better aproach than your proposal, especially if > we consider the implications on practical calculations. As I said above, I am not proposing that Mathematica should be rewritten so that Simplify[(a^2 - 1)/(a - 1)] yields anything other than (a + 1), despite the fact that (a^2 - 1)/(a - 1) should not, in an ideal sense, simplify to (a + 1). This response should also have addressed a point raised by David Bailey. David W. Cantrell > Here's a portion of a response of mine which appeared some years > ago in this newsgroup. It's relevant to what Markus was asking about. ------------------------------------------------------- In a sense, there is something wrong. These simplifications are > Misdemeanors in the Computer Algebra Trade, _Notices of the American > Mathematical Society_ 38:7 (1991) 778-785. In case anyone doesn't see why simplifying, say, x^0 to 1 is a > misdemeanor: In Mathematica, 0^0 is regarded as being Indeterminate. > Thus, without knowing that x is nonzero, Mathematica should not bluntly > simplify x^0 to 1. Rather, it would seem that, in Mathematica, x^0 > should simplify to, say, If[x == 0, Indeterminate, 1]. But such a > result is normally considered to be too cumbersome to be practical; the > misdemeanor simplification is considered preferable. All CASs known > to me make such simplifications. ------------------------------------------------------- === Subject: Re: Pythonika - Difficulties to install > I am having difficulties to install Pythonika in Windows Vista. When I go to compile, an error occurs therefore the archive pythonikatm.c it is not found. > Where it is this archive? I only found pythonika.tm! > This is explained in the tutorial on compiling MathLink programs: tutorial/MathLinkDeveloperGuide-Windows You need to process the .tm file with mprep. This is done by the Makefile supplied with Pythonika, you just have to edit the paths first so that they match your specific configuration. But if you are uncomfortable with compiling C code, why don't you just use the precompiled executable from the package? === Subject: StyleSheets How-to Hi all! Does anybody know about some good tutorial about the creation and edition of StyleSheets (M6.0.1)? I have found some information in the help and on WRI documentation pages, but all the information is only partial and I need to glue it in my head little bit. What I cannot find anywhere is, how to work with background images in StyleSheet (for axample the brown hexagons on the top of Creative/NaturalColor StyleSheet). I have searched in Option Inspector nearly line by line and haven't found it. If I open this StyleSheet notebook in some text editor, it seems to me, that the image is may be UUencoded inside the notebook. There is something like in it: Cell[StyleData[Notebook], DockedCells->{ Cell[ GraphicsData[ Bitmap, = CF5dJ6E]HGAYHf4PAg9QL6QYHg {1399, 24}, ImageMargins -> 0, CellMargins -> {{0, 0}, {0, 0}}, Background -> RGBColor[0.403922, 0.313725, 0.192157], CellFrameMargins -> {{0, 0}, {0, 0}}]} But how to create StyleSheet with my own images? Jakub === Subject: Re: Default font You use Stylesheets to control the look of various Cell types. Use Menu, Format, Edit Stylesheet. Then modify the styles for the cell types. You can do many modifications with the Format menu, but I usually use Shift-Ctrl-E to look at and modify the underlying specification. Unfortunately the documentation is not too complete. There is a tutorial at my web site that will help you get started. You always have to save a Stylesheet with a Save As. An ordinary Save won't update it. You save them in your Front End, Stylesheets folder. -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ > As foolish as it looks i haven't been able to find a way to change the > default font used by mathematica both for input and for output. What I > want > is every single letter I type in a mathematica window, even when writing > code, to be rendered with a specified font (that obviously is among those > mathematica can pick). > Can you help me? > === Subject: Re: Default font has you edited the style sheet ? or created your own ? Go to the Menu | Format | Edit Stylesheet... and change the fonts for the format elements like Text, Title .. > As foolish as it looks i haven't been able to find a way to change the > default font used by mathematica both for input and for output. What I want > is every single letter I type in a mathematica window, even when writing > code, to be rendered with a specified font (that obviously is among those > mathematica can pick). > Can you help me? > === Subject: Re: Sub-division of surface plotting by PlotPoints->{m,n} Use a combination of PlotPoints and MaxRecursion to control the subdivision of the surface. Use Mesh -> All to see what Mathematica is actually doing. ParametricPlot3D[{u Cos[t], u Sin[t], t}, {u, 1, 2}, {t, 0, Pi}, PlotPoints -> {2, 3}, MaxRecursion -> 4, Mesh -> All] -- David Park djmpark@comcast.net http://home.comcast.net/~djmpark/ >I need to further sub-divide some skew quadrilaterals dividing each > advance for such an indication. ParametricPlot3D[ {u Cos[t], u Sin[t], t}, {u,1,2}, {v,0,Pi}, > PlotPoints-> {2,3} ] Narasimham > === Subject: Re: Sub-division of surface plotting by PlotPoints->{m,n} a) your surface has *no* straight edge b) ParametricPlot3D[{u Cos[t], u Sin[t], t}, {u, 1, 2}, {t, 0, 2 Pi}, Mesh -> All, PlotPoints -> {4096, 4096}] will create more polygons in the polygonal approximation than you will need. > I need to further sub-divide some skew quadrilaterals dividing each > advance for such an indication. ParametricPlot3D[ {u Cos[t], u Sin[t], t}, {u,1,2}, {v,0,Pi}, > PlotPoints-> {2,3} ] Narasimham > === Subject: Mathematica 6 over ssh tunnel I've been using Mathematica 5.2 with a remote kernel (OS X both for the frontend and the remote kernel). To get around a firewall, I've used, essentially, the method described at the bottom of this page: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=FAQ_R emote_Kernels This works well for Mathematica 5.2. I recently upgraded to Mathematica 6, however, and now everything works fine except graphics, which come out with only a line reading -Graphics- and no actual graphics output. Has anybody else experienced this? Is there a way around it? It appears that Graphics work if you connect with the firewall off (and therefore, no need for the ssh tunnel), but I can't leave the firewall off. I could open up a couple of specific ports, but it looks like, no matter what I do, the remote kernel is trying to use one port that changes every time I connect, making it impossible to allow connections on specific ports and have any effect. Any help would be most appreciated. dan seaton === Subject: Re: Garbage collection and mutable data structures > Hi MathGroup, This snippet of code is giving me headaches: ----- > $HistoryLength = 0; > NewCell[i_] := Module[{c}, CellVal[c] ^= i; c] > MemoryInUse[] > NewCell /@ Range[10^5]; > MemoryInUse[] > ----- It occurred while trying to build mutable data structures by using > upvalues. I can't understand why the temporary variable c is not freed > since I don't keep any reference to it. > Have I missed something in the reference counting scheme ? I don' think so, have you accounted for the memory used to hold the values of CellVac[c]? I did run into a problem with v6 in that a large array I was allocating inside a Module was not being freed in certain circumstances but that code followed a different pattern than yours. The problem was resolved by explicitly releasing the variable in the Module. Sseziwa === Subject: Re: Garbage collection and mutable data structures try Information /@ Names[c$*] and find out where the reference to c$* is keept. > Hi MathGroup, This snippet of code is giving me headaches: ----- > $HistoryLength = 0; > NewCell[i_] := Module[{c}, CellVal[c] ^= i; c] > MemoryInUse[] > NewCell /@ Range[10^5]; > MemoryInUse[] > ----- It occurred while trying to build mutable data structures by using > upvalues. I can't understand why the temporary variable c is not freed > since I don't keep any reference to it. > Have I missed something in the reference counting scheme ? > Hayssam. > === Subject: Re: Garbage collection and mutable data structures > Hi MathGroup, This snippet of code is giving me headaches: ----- > $HistoryLength = 0; > NewCell[i_] := Module[{c}, CellVal[c] ^= i; c] > MemoryInUse[] > NewCell /@ Range[10^5]; > MemoryInUse[] > ----- It occurred while trying to build mutable data structures by using > upvalues. I can't understand why the temporary variable c is not freed > since I don't keep any reference to it. > Have I missed something in the reference counting scheme ? > Hayssam. > The temporary 'c' variables are still in use because Up Values are attached to them! In[1]:= $HistoryLength=0; NewCell[i_]:=Module[{c},CellVal[c]^=i;c] MemoryInUse[] NewCell/@Range[10]; MemoryInUse[] Out[3]= 8977568 Out[5]= 9012224 In[7]:= ?c$* Global` c$ c$940 c$942 c$944 c$946 c$948 c$939 c$941 c$943 c$945 c$947 In[8]:= ?c$943 Global`c$943 Attributes[c$943]={Temporary} CellVal[c$943]^=5 Why not describe what it is you are trying to do. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: Garbage collection and mutable data structures > Hi MathGroup, This snippet of code is giving me headaches: ----- > $HistoryLength = 0; > NewCell[i_] := Module[{c}, CellVal[c] ^= i; c] > MemoryInUse[] > NewCell /@ Range[10^5]; > MemoryInUse[] > ----- It occurred while trying to build mutable data structures by using > upvalues. I can't understand why the temporary variable c is not freed > since I don't keep any reference to it. > Have I missed something in the reference counting scheme ? It looks like if you let a temporary escape from the Module[] (i.e. you create references to it outside the Module[] by returning it), then it won't be cleaned up. In[1]:= Module[{var}, var; 1] Out[1]= 1 In[2]:= ?Global`* Global`var OK, temporary was cleaned up. Now let us return it from the Module[]: In[3]:= Module[{var}, var] Out[3]= var$79 In[4]:= ?Global`* Global` var var$79 As you see, now it persists. Now let's try assigning something to it. In[5]:= Module[{var}, var = 10; Hold[var]] Out[5]= Hold[var$87] In[6]:= ?Global`* Global` var var$79 var$87 In[7]:= ?var$87 Global`var$87 Attributes[var$87]={Temporary} var$87=10 It looks like it keeps the value. === Subject: Question: Embed mathematica 3d in pdf? I would like to include some interactive 3d mathematica graphics in pdf files -- in fact, preferably into latex-generated pdf files. Can anyone recommend how to get from mathematica graphics to interactive 3d PDFs (e.g., directly; with intermediate use of 3d graphics formats; etc)? Given the file formats I have available at the two ends I'm not sure how to get from 'a' to 'b'. -Richard === Subject: reproducible front end crash If a non-existent file is passed to the front end as a command line argument, it crashes. This is with Mathematica 6.0.1 on WinXP.