mm-939 === Subject: Re: How to show the plot in Module[{}, ]? a[] := Module[{}, Print[I'll be good!]; Print[Plot[Cos[x], {x, 0, 10}]]; Print[Fine,me too];] === Subject: NIntegrate with change of variables I'm working on contour integrals using NIntegrate. Can I specify a transformation rule that would replace both the variable of integration as well as the differential? For example, suppose I wish to integrate f(z)dz around the unit circle, that is z=Exp[i t]. Well I could make the transformation: NIntegrate[f[z] /. z->Exp[i t],{t,-pi, pi}] but that does not replace dz with its equivalent in terms of t, that is: dz=i Exp[i t] dt The correct form to integrate would be: NIntegrate[f[Exp[i t]] i Exp[i t],{t,-pi, pi}] Is there a way to define a transformation rule that would make both those substitutions for unspecified z=g(t)? === Subject: Re: NIntegrate with change of variables > > I'm working on contour integrals using NIntegrate. Can I specify a transformation rule that would replace both the variable of integration as well as the differential? For example, suppose I wish to integrate f(z)dz around the unit circle, that is z=Exp[i t]. Well I could make the transformation: > > NIntegrate[f[z] /. z->Exp[i t],{t,-pi, pi}] but that does not replace dz with its equivalent in terms of t, that is: > > dz=i Exp[i t] dt > > The correct form to integrate would be: > > NIntegrate[f[Exp[i t]] i Exp[i t],{t,-pi, pi}] > > Is there a way to define a transformation rule that would make both those substitutions for unspecified z=g(t)? You can define a function that handles both the change of variable and the chain rule [1]. For instance, In[1]:= ContourIntegrate[f_, par : (z_ -> g_), {t_, a_, b_}] := NIntegrate[Evaluate[(f /. par)*D[g, t]], {t, a, b}] ContourIntegrate[1/(z - 1/2), z -> Exp[I*t]*(2*Cos[t] + 1), {t, -Pi, Pi}] Out[2]= -17 -5.55112 10 + 12.5664 I Jean-Marc [1] Contour integral http://forums.wolfram.com/mathgroup/archive/1998/Feb/msg00100.html === Subject: Re: NIntegrate with change of variables (discovering also a bug in Integrate!?) Hi. (Adopted code from R. Gass book (1996), slightly modified and with added comments.) In[4]:= Off[General::spell1] In[5]:= Clear[ContourIntegrate,ContourNIntegrate] In[6]:= ContourNIntegrate[f_(*the function to be integrated*), par : (z_ -> g_) (*the rule z -> g is named par; z is the original variable and g is the contour*), {t_, a_, b_}(* variable and limits of integration*), opts___(*options for NIntegrate; without setting the default are used*)] := NIntegrate[Evaluate[(f /. par)*D[g, t]], {t, a, b}, opts] In[7]:= ContourIntegrate[f_(*the function to be integrated*), par : (z_ -> g_) (*the rule z -> g is named par; z is the original variable and g is the contour*), {t_, a_, b_}(*variable and limits of integration*), opts___(*options for NIntegrate; without setting the default are used*)] := Integrate[Evaluate[(f /. par)*D[g, t]], {t, a, b}, opts] The first function performs numerical contour integration; the latter symbolic. (*check*) In[15]:= ContourNIntegrate[1/z, z -> Exp[I*t], {t, -Pi, Pi}] Out[15]= 0. + 6.283185307179586*I In[16]:= ContourIntegrate[1/z, z -> Exp[I*t], {t, -Pi, Pi}] Out[16]= 2*I*Pi In[21]:= ContourNIntegrate[z^2/((z - 1/2)*(z - 1/3)*(z - 1/4)), z -> Exp[I*t], {t, -Pi, Pi}, WorkingPrecision -> 40] Out[21]= 0``29.40408430471268 + 6.28318530717958647692528676655900576839433879875`30.202264173070795*I In[26]:= ContourIntegrate[z^2/((z - 1/2)*(z - 1/3)*(z - 1/4)), z -> Exp[I*t], {t, -Pi, Pi}] N[%, 30] Out[26]= 2*I*Pi Out[27]= 6.28318530717958647692528676655900576839433879875`30.*I However you should trust more the ContourNIntegrate that its symbolic counterpart! For example In[29]:= ContourNIntegrate[1/(z - 1/2), z -> Exp[I*t]*(2*Cos[t] + 1), {t, -Pi, Pi}] Out[29]= 0. + 12.566370614352092*I which is correct. The curve encricles the origin two times. In[30]:= ParametricPlot[{Re[Exp[I*t]*(2*Cos[t] + 1)], Im[Exp[I*t]*(2*Cos[t] + 1)]}, {t, 0, 2*Pi}] So from the residue theorem the result of the contour integration should be 2(2Pi) residue of 1/(z-1/2) @ 1/2. In[33]:= 2*(2*Pi*I*Residue[1/(z - 1/2), {z, 1/2}]) N[%] Out[33]= 4*I*Pi Out[34]= 0. + 12.566370614359172*I However In[31]:= ContourIntegrate[1/(z - 1/2), z -> Exp[I*t]*(2*Cos[t] + 1), {t, -Pi, Pi}] Out[31]= (1 + 4*I)*Pi The real part should not have been there! Dimitris / chuck009 : > > I'm working on contour integrals using NIntegrate. Can I specify a transformation rule that would replace both the variable of integration as well as the differential? For example, suppose I wish to integrate f(z)dz around the unit circle, that is z=Exp[i t]. Well I could make the transformation: > > NIntegrate[f[z] /. z->Exp[i t],{t,-pi, pi}] but that does not replace dz with its equivalent in terms of t, that is: > > dz=i Exp[i t] dt > > The correct form to integrate would be: > > NIntegrate[f[Exp[i t]] i Exp[i t],{t,-pi, pi}] > > Is there a way to define a transformation rule that would make both those substitutions for unspecified z=g(t)? === Subject: Re: Re: Antialiasing of 3D graphics >I've got an ATI x1400 chipset. Can I activate AA directly out of >mathematica or do I have to do this on OS level? Mathematica 6.0 does not support antialiasing for 3D graphics. You may be able to configure your video driver to override application preferences such as antialiasing level for Mathematica or any other application. Obviously the methods for configuration as well as the capabilities and results depend on the video driver. Mathematica has not been extensively tested in this configuration. We are working to support antialiasing of 3D graphics in a future release. Chris Hill Wolfram Research === Subject: Re: Graphics3D exported to pdf > Hello! > > I am meeting some problems when exporting 3D graphics > to pdf format, problems that are new to Mathematica 6. > > $Version is 6.0 for Mac OS X PowerPC (32-bit) (April 20, 2007) > > Take for example two simple 3D squares, one black and one > partially transparent: > > myGraph = > Graphics3D[{{Black, Polygon[{{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, > 1, 0}}], > Opacity[.5], Polygon[{{1, 0, 0}, {2, 0, 0}, {2, 1, 0}, {1, 1, > 0}}]}}, > Boxed -> False, BoxRatios -> {8, 4, 1}] > > The display in the FrontEnd is fine. Let us export to pdf: > > Export[~/Desktop/myGraph.pdf, myGraph] > > Looking at the plot with AdobeViewer, or with Apple's Preview, > I clearly see thin white lines crossing both the squares. > If I change the preview settings to not antialiasing of text and > line art, strangely enough, the white lines on the black square disappear, > but the white lines on the transparent square turn black and more > visible. > > When exporting Plot3D output to pdf, the white lines are so many > and so dense that the whole picture looks dirty. > > I wish that the pdf output did not show those junctions. > > I have found a workaround: select the picture by clicking on it, > go to File>PrintSelection menu, and print to pdf. The result is > a high resolution *bitmap* pdf that closely matches what the FrontEnd > displays. One annoyance is that the picture is on a full-page pdf, > that I have to crop manually. > > Do we have to give up on vector pdf's for 3D graphics? > Any thoughts? > > Happy computing, > Gianluca It may not be possible to solve this problem Consider the attached PostScript file. The two squares are perfectly aligned, yet when the drawing is converted to PDF and displayed in Adobe Reader, the white line is still there. Most probably it will not be visible on a _printed_ drawing. But I do not know why is it necessary to break those two squares in your example into so many little polygons. Szabolcs ------------>8-------------- %!PS-Adobe-2.0 /draw-square { newpath 0 0 moveto 100 0 rlineto 0 100 rlineto -100 0 rlineto closepath fill } def 200 100 translate 40 rotate draw-square 100 0 translate draw-square showpage === Subject: Re: Unable to copy graphics from Mathematica 6 to Publicon > I have Publicon 1.0.1 and recently installed Mathematica 6 (Windws > versions). In Mathematica 5, copy-paste of graphics from Mathematica and > Publicon worked like a charm, but no more with Mathematica 6. I have found > no other way than copying as a bitmap, which results in reduced quality as > well as bloated graphics files (10 times bigger than they used to be) when I > export to LaTeX from Pulicon. > This is a big problem, because it is hard to pass LaTeX around with such big > files. > Tips anyone? > Any plans to upgrade Publicon to the new Mathematica kernel? > > Kjell Tangen I don't know about Publicon, but copying from Mathematica 6 to Mathematica 5 works for me if I convert the graphics to PostScript first (Cell->Convert To->PostScript). You may try copying directly or Copy As->Metafile. The results may be a bit different. But not that PostScript graphics do not support some features, e.g. Opacity. Szabolcs === Subject: Re: display change in version 6 > In version 5 the loop > > Do[ > Show[Graphics[Raster[Table[Random[], {3}, {3}]]]], {2}] > > displays two graphics objects. In version 6 the same loop > produces no display. What has changed and how do I recover > the displays as they are produced in the loop? > > Veit Elser > Use Table instead of Do. GraphicsColumn@Table[ Graphics[Raster[Table[Random[], {3}, {3}]]], {2}] Szabolcs === Subject: Re: 3D manipulation with gamepad in V6 >I have bought myself a Logitech Dual Action gamepad as recommended in >tutorial/IntroductionToManipulate, and I am very pleased with how flexibly >it allows me to control Manipulate. This will make manipulation much easier. > >Out of curiosity I tried using the gamepad to manipulate a plain 3D graphic, >where normally you would use the l.h. mouse button (optionally with Ctrl or >Shift) to rotate/zoom/translate the graphic. I found that I could rotate the >graphic by using the l.h. gamepad joystick, but I couldn't find any way to >zoom or translate the graphic using the gamepad. Does anybody know how to do >this, or it is not implemented? Currently the built-in support for using the gamepad with 3D graphics allows for rotation, but not zooming or translation. Binding Graphics3D options to the gamepad with other mechanisms like Manipulate or ControllerState is an alternative. Though it's slightly less convenient since it requires writing code to specify the relationship between the gamepad and the view options, it's very flexible. Here's an example of a simple zoom feature that is tied directly to the vertical position of the right stick on your Logitech gamepad. It changes the ViewAngle option dynamically. The built-in support for rotation continues to work well because the built-in support doesn't modify the ViewAngle option. Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, Axes -> False, ViewAngle -> Dynamic[Rescale[ControllerState[Y2], {-1, 1}, {1 Degree, 179 Degree}]]] Here's a version that isn't tied directly to the position of the stick, but increases or decreases the zoom based on the deflection of the stick from center. DynamicModule[{va = 90 Degree}, Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, Axes -> False, ViewAngle -> Dynamic[Module[{y = ControllerState[Y2]}, If[Abs[y] > 0.2, va += y*0.05; va = Clip[va, {1 Degree, 179 Degree}]]; va]]]] Chris Hill Wolfram Research === Subject: New release of package SNEG A new version of the Mathematica package SNEG for performing calculations using the operators of the second quantization formalism of quantum mechanics has been released. In the past, SNEG has been applied to perform exact diagonalizations on Hubbard clusters, calculations of commutators of complex expressions, perturbation theory and high-temperature expansions to higher orders, numerical renormalization group (NRG) calculations, etc. This version adds the following new functionality: - support for bosonic operators, - support for real (Majorana) fermionic operators, - support for anti-commuting Grassman variables, Berezin integration, and fermionic coherent states, - automatic simplifications of expressions with exponential functions of operators using Baker-Campbell-Hausdorff and Mendas-Milutinovic formulas, - improved automatic canonical ordering of fermionic operators in the case of Fermi sea vacuum, - improved handling of symbolic sums and automatic renaming of dummy indexes when name conflicts appear, - built-in support for pretty printing of operator expressions, obviating the need to use the Notation package, - code for rewriting creation operator expressions in terms of higher-level functions, such as number, hopping, spin, and electron-electron repulsion terms, - various performance improvements (for example, the generation of basis states with well-defined charge and spin quantum numbers is much faster). Furthermore, the documentation has been significantly improved and is now browsable in the Mathematica help system. The package is freely (GPL license) available from http://nrgljubljana.ijs.si/sneg Rok Zitko Rok Zitko, rok.zitko@ijs.si Jozef Stefan Institute Ljubljana, Slovenia === Subject: Re: Selecting Sub-lists After Split walk == Rest@NestList[# + Random[] - 1/2 &, 0, 1000]; signedRuns == Split[walk, #1 #2 > 0 &]; Length /@ signedRuns negativeRuns == Select[signedRuns, First[#] < 0 &]; Length /@ negativeRuns {12, 11, 2, 22, 1, 207, 2, 3, 78, 1, 202, 38, 66, 355} {12, 2, 1, 2, 78, 202, 66} I didn't let negativeRuns display, but I think that's what you wanted. Bobby On Fri, 08 Jun 2007 04:34:49 -0500, Gregory Lypny > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList == Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory > > -- DrMajorBob@bigfoot.com === Subject: Re: Customising syntax colouring > The new syntax colouring in version 6 is great. Is it readily > customisable? Here's an arbitrary hypothetical example: Suppose I > wanted all input of the form f[_] to be automatically coloured > Darker[Green]. Is this easy? > > I'm not sure if I've read about this before in the documentation; at > any rate, I can't find it now. As a side question: I'm having some > trouble getting accustomed to the new documentation interface. Any > crucial tips on using it efficiently? About the documentation: I agree with you completely. Having no table of contents and never knowing your exact position in the documentation is awful. A good master index and TOC cannot be replaced with some fuzzy search feature ... this is good for wikis, gmail etc. where manual organisation of information is not practical, but surely WRI can afford to create a usable index and table of contents. About the syntax colouring: Look up SyntaxInformation[]. It does not allow for completely arbitrary colouring, but it is still very useful. Szabolcs === Subject: Re: Can anybody help me solving such a system of nonlinear equations? NSolve (in v6) immediately (less than 2 seconds) returned one real solution and lots of Complex ones: NSolve[system, vars] {{pA -> -12.0619, p1 -> 8.34402, p2 -> 3.35668, disA -> -32.7094}, {pA -> 5.04037+ 0.135893 [ImaginaryI], p1 -> 2.85233+ 0.141601 [ImaginaryI], p2 -> 8.05437- 0.100419 [ImaginaryI], disA -> 0.123062- 1.61597 [ImaginaryI]}, {pA -> 5.04037- 0.135893 [ImaginaryI], p1 -> 2.85233- 0.141601 [ImaginaryI], p2 -> 8.05437+ 0.100419 [ImaginaryI], disA -> 0.123062+ 1.61597 [ImaginaryI]}, {pA -> 3.46024+ 0.739387 [ImaginaryI], p1 -> 3.05242+ 0.039231 [ImaginaryI], p2 -> 7.99578+ 0.0164869 [ImaginaryI], disA -> -0.132054 + 0.565823 [ImaginaryI]}, {pA -> 3.46024- 0.739387 [ImaginaryI], p1 -> 3.05242- 0.039231 [ImaginaryI], p2 -> 7.99578- 0.0164869 [ImaginaryI], disA -> -0.132054 - 0.565823 [ImaginaryI]}, {pA -> 5.12009+ 0.185328 [ImaginaryI], p1 -> 2.91361+ 0.134372 [ImaginaryI], p2 -> 4.94667+ 0.0458226 [ImaginaryI], disA -> 0.173236- 1.66046 [ImaginaryI]}, {pA -> 5.12009- 0.185328 [ImaginaryI], p1 -> 2.91361- 0.134372 [ImaginaryI], p2 -> 4.94667- 0.0458226 [ImaginaryI], disA -> 0.173236+ 1.66046 [ImaginaryI]}, {pA -> 4.11572+ 0.218866 [ImaginaryI], p1 -> 6.24958- 1.18944 [ImaginaryI], p2 -> 6.18469+ 1.25056 [ImaginaryI], disA -> -0.992109 - 1.0035 [ImaginaryI]}, {pA -> 4.11572- 0.218866 [ImaginaryI], p1 -> 6.24958+ 1.18944 [ImaginaryI], p2 -> 6.18469- 1.25056 [ImaginaryI], disA -> -0.992109 + 1.0035 [ImaginaryI]}, {pA -> 4.65713+ 0.303246 [ImaginaryI], p1 -> 6.1733- 1.1441 [ImaginaryI], p2 -> 6.18853+ 1.16429 [ImaginaryI], disA -> -0.14015 + 0.689885 [ImaginaryI]}, {pA -> 4.65713- 0.303246 [ImaginaryI], p1 -> 6.1733+ 1.1441 [ImaginaryI], p2 -> 6.18853- 1.16429 [ImaginaryI], disA -> -0.14015 - 0.689885 [ImaginaryI]}, {pA -> 4.11999+ 0.168207 [ImaginaryI], p1 -> 6.14997- 1.16879 [ImaginaryI], p2 -> 6.06909- 1.22008 [ImaginaryI], disA -> -1.05888 - 1.00133 [ImaginaryI]}, {pA -> 4.11999- 0.168207 [ImaginaryI], p1 -> 6.14997+ 1.16879 [ImaginaryI], p2 -> 6.06909+ 1.22008 [ImaginaryI], disA -> -1.05888 + 1.00133 [ImaginaryI]}, {pA -> 1.29105, p1 -> 4.62264, p2 -> 3.07625, disA -> -6.77437}, {pA -> 4.61563- 0.275035 [ImaginaryI], p1 -> 6.09824+ 1.12335 [ImaginaryI], p2 -> 6.09862+ 1.14324 [ImaginaryI], disA -> -0.156714 - 0.658444 [ImaginaryI]}, {pA -> 4.61563+ 0.275035 [ImaginaryI], p1 -> 6.09824- 1.12335 [ImaginaryI], p2 -> 6.09862- 1.14324 [ImaginaryI], disA -> -0.156714 + 0.658444 [ImaginaryI]}, {pA -> 3.39423+ 0.689896 [ImaginaryI], p1 -> 3.11883+ 0.0412614 [ImaginaryI], p2 -> 4.97625- 0.00736208 [ImaginaryI], disA -> -0.182116 + 0.514722 [ImaginaryI]}, {pA -> 3.39423- 0.689896 [ImaginaryI], p1 -> 3.11883- 0.0412614 [ImaginaryI], p2 -> 4.97625+ 0.00736208 [ImaginaryI], disA -> -0.182116 - 0.514722 [ImaginaryI]}, {pA -> 4.85856- 1.56365 [ImaginaryI], p1 -> 6.16703- 1.34382 [ImaginaryI], p2 -> 6.23016+ 1.1167 [ImaginaryI], disA -> 0.98401- 1.28569 [ImaginaryI]}, {pA -> 4.85856+ 1.56365 [ImaginaryI], p1 -> 6.16703+ 1.34382 [ImaginaryI], p2 -> 6.23016- 1.1167 [ImaginaryI], disA -> 0.98401+ 1.28569 [ImaginaryI]}, {pA -> 4.69963- 3.76838 [ImaginaryI], p1 -> 6.35932+ 1.13176 [ImaginaryI], p2 -> 5.83321+ 1.08874 [ImaginaryI], disA -> 1.02155- 7.52248 [ImaginaryI]}, {pA -> 4.69963+ 3.76838 [ImaginaryI], p1 -> 6.35932- 1.13176 [ImaginaryI], p2 -> 5.83321- 1.08874 [ImaginaryI], disA -> 1.02155+ 7.52248 [ImaginaryI]}, {pA -> 4.8093- 4.31103 [ImaginaryI], p1 -> 6.42633+ 1.20204 [ImaginaryI], p2 -> 6.50206- 1.20925 [ImaginaryI], disA -> 1.21366- 8.63106 [ImaginaryI]}, {pA -> 4.8093+ 4.31103 [ImaginaryI], p1 -> 6.42633- 1.20204 [ImaginaryI], p2 -> 6.50206+ 1.20925 [ImaginaryI], disA -> 1.21366+ 8.63106 [ImaginaryI]}, {pA -> 4.86385+ 1.55527 [ImaginaryI], p1 -> 6.10499+ 1.32257 [ImaginaryI], p2 -> 6.07398+ 1.0823 [ImaginaryI], disA -> 1.02757+ 1.30923 [ImaginaryI]}, {pA -> 4.86385- 1.55527 [ImaginaryI], p1 -> 6.10499- 1.32257 [ImaginaryI], p2 -> 6.07398- 1.0823 [ImaginaryI], disA -> 1.02757- 1.30923 [ImaginaryI]}, {pA -> 3.38843+ 0.895522 [ImaginaryI], p1 -> 6.29755- 1.27803 [ImaginaryI], p2 -> 6.31132+ 1.20406 [ImaginaryI], disA -> 0.15814+ 1.5184 [ImaginaryI]}, {pA -> 3.38843- 0.895522 [ImaginaryI], p1 -> 6.29755+ 1.27803 [ImaginaryI], p2 -> 6.31132- 1.20406 [ImaginaryI], disA -> 0.15814- 1.5184 [ImaginaryI]}, {pA -> 13.8105, p1 -> 2.4038, p2 -> 8.79103, disA -> 18.7794}, {pA -> 4.1733- 0.324981 [ImaginaryI], p1 -> 2.29099+ 0.0766739 [ImaginaryI], p2 -> 2.3076+ 0.0406625 [ImaginaryI], disA -> -0.710154 - 1.18873 [ImaginaryI]}, {pA -> 4.1733+ 0.324981 [ImaginaryI], p1 -> 2.29099- 0.0766739 [ImaginaryI], p2 -> 2.3076- 0.0406625 [ImaginaryI], disA -> -0.710154 + 1.18873 [ImaginaryI]}, {pA -> 3.46353- 0.931219 [ImaginaryI], p1 -> 6.22396+ 1.23016 [ImaginaryI], p2 -> 5.97284+ 1.13346 [ImaginaryI], disA -> 0.201138- 1.55057 [ImaginaryI]}, {pA -> 3.46353+ 0.931219 [ImaginaryI], p1 -> 6.22396- 1.23016 [ImaginaryI], p2 -> 5.97284- 1.13346 [ImaginaryI], disA -> 0.201138+ 1.55057 [ImaginaryI]}, {pA -> 4.70041- 0.960206 [ImaginaryI], p1 -> 2.32094+ 0.0471748 [ImaginaryI], p2 -> 2.2751+ 0.0383211 [ImaginaryI], disA -> 1.03635- 1.34182 [ImaginaryI]}, {pA -> 4.70041+ 0.960206 [ImaginaryI], p1 -> 2.32094- 0.0471748 [ImaginaryI], p2 -> 2.2751- 0.0383211 [ImaginaryI], disA -> 1.03635+ 1.34182 [ImaginaryI]}, {pA -> 4.36828- 2.33519 [ImaginaryI], p1 -> 4.86511- 0.121694 [ImaginaryI], p2 -> 3.02683+ 0.00790086 [ImaginaryI], disA -> -0.520092 - 2.76693 [ImaginaryI]}, {pA -> 4.36828+ 2.33519 [ImaginaryI], p1 -> 4.86511+ 0.121694 [ImaginaryI], p2 -> 3.02683- 0.00790086 [ImaginaryI], disA -> -0.520092 + 2.76693 [ImaginaryI]}, {pA -> 4.55414, p1 -> 2.30068, p2 -> 2.26998, disA -> 1.10028}, {pA -> 4.12886, p1 -> 4.9679, p2 -> 3.10847, disA -> -0.118869}, {pA -> 5.34263+ 1.29037 [ImaginaryI], p1 -> 7.96453+ 0.077481 [ImaginaryI], p2 -> 3.02181+ 0.00290677 [ImaginaryI], disA -> 0.325702+ 1.01253 [ImaginaryI]}, {pA -> 5.34263- 1.29037 [ImaginaryI], p1 -> 7.96453- 0.077481 [ImaginaryI], p2 -> 3.02181- 0.00290677 [ImaginaryI], disA -> 0.325702- 1.01253 [ImaginaryI]}, {pA -> 4.01023, p1 -> 4.96928, p2 -> 3.03291, disA -> 1.7214}, {pA -> 17.2655, p1 -> 2.43961, p2 -> 4.61844, disA -> 25.6739}, {pA -> 3.09831+ 0.527086 [ImaginaryI], p1 -> 8.13816+ 0.0758926 [ImaginaryI], p2 -> 3.05628+ 0.0238497 [ImaginaryI], disA -> -0.330776 - 1.208 [ImaginaryI]}, {pA -> 3.09831- 0.527086 [ImaginaryI], p1 -> 8.13816- 0.0758926 [ImaginaryI], p2 -> 3.05628- 0.0238497 [ImaginaryI], disA -> -0.330776 + 1.208 [ImaginaryI]}} Bobby > > I have tried NSolve, Solve, Reduce, to solve the system below, > however, the mathematica didn't return an answer. Can anybody know how > to solve it using Mathematica? > > The inputs are as follows: > > a = 24; > b = 5; > c = 25; > d = 4; > cA = 3; > cB = 2; > t = 5; > alpha = 0.2; > Solve[{(a - b*pA - b*(pA - cA))*(0.5 - ((d/2)( > p1^2 - p2^2) - > c(p1 - p2))/(2t) - ((b/2)((pA - disA)^2 - pA^2) + > a*disA)/(2t)) - ((p1 - cB)( > c - d*p1) + ( > pA - disA - cA)(a - b*(pA - disA)) - (pA - > cA)(a - b*(pA)))*(-(a - b*pA)/(2t)) == > 0, -(a - b*(pA - disA) - b(pA - disA - cA))*(0.5 + ((d/2) > ( > p1^2 - p2^2) - c(p1 - p2))/(2t) + (( > b/2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) - (( > p1 - cB)(c - d*p1) + (pA - disA - cA)(a - > b*(pA - disA)) - (pA - cA)(a - b*( > pA)))*(-(a - b*(pA - disA))/(2t)) == 0, ((p1 - > cB)(c - d*p1) + alpha*(pA - disA - cA)(a - b*( > pA - disA)) - alpha*(pA - cA)(a - b*(pA)))*(-( > c - d*p1)/(2t)) + (c - d*p1 - d(p1 - cB))(0.5 + ((d/ > 2)(p1^2 - p2^2) - c(p1 - p2))/(2t) + alpha*(( > b/2)((pA - disA)^2 - pA^2) + a*disA)/( > 2t)) == 0, (c - d*p2 - d*(p2 - cB))(0.5 - ((d/ > 2)(p1^2 - p2^2) - c(p1 - p2))/(2t) - > alpha*((b/ > 2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) + ( > p2 - cB)(c - d*p2)(-(c - d*p2)/(2t)) == 0}, {pA, p1,p2, > disA}] > > > > > > -- DrMajorBob@bigfoot.com === Subject: Re: Can anybody help me solving such a system of nonlinear equations? > > I have tried NSolve, Solve, Reduce, to solve the system below, > however, the mathematica didn't return an answer. Can anybody know how > to solve it using Mathematica? > > The inputs are as follows: > > a = 24; > b = 5; > c = 25; > d = 4; > cA = 3; > cB = 2; > t = 5; > alpha = 0.2; > Solve[{(a - b*pA - b*(pA - cA))*(0.5 - ((d/2)( > p1^2 - p2^2) - > c(p1 - p2))/(2t) - ((b/2)((pA - disA)^2 - pA^2) + > a*disA)/(2t)) - ((p1 - cB)( > c - d*p1) + ( > pA - disA - cA)(a - b*(pA - disA)) - (pA - > cA)(a - b*(pA)))*(-(a - b*pA)/(2t)) == > 0, -(a - b*(pA - disA) - b(pA - disA - cA))*(0.5 + ((d/2) > ( > p1^2 - p2^2) - c(p1 - p2))/(2t) + (( > b/2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) - (( > p1 - cB)(c - d*p1) + (pA - disA - cA)(a - > b*(pA - disA)) - (pA - cA)(a - b*( > pA)))*(-(a - b*(pA - disA))/(2t)) == 0, ((p1 - > cB)(c - d*p1) + alpha*(pA - disA - cA)(a - b*( > pA - disA)) - alpha*(pA - cA)(a - b*(pA)))*(-( > c - d*p1)/(2t)) + (c - d*p1 - d(p1 - cB))(0.5 + ((d/ > 2)(p1^2 - p2^2) - c(p1 - p2))/(2t) + alpha*(( > b/2)((pA - disA)^2 - pA^2) + a*disA)/( > 2t)) == 0, (c - d*p2 - d*(p2 - cB))(0.5 - ((d/ > 2)(p1^2 - p2^2) - c(p1 - p2))/(2t) - > alpha*((b/ > 2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) + ( > p2 - cB)(c - d*p2)(-(c - d*p2)/(2t)) == 0}, {pA, p1, p2, > disA}] > > > Depending on the precision you need, NSolve works fine. For instance, In[1]:= eqns = With[{a = 24, b = 5, c = 25, d = 4, cA = 3, cB = 2, t = 5, alpha = 2/10}, FullSimplify /@ {(a - b*pA - b*(pA - cA))*(1/2 - ((d/2)*(p1^2 - p2^2) - c*(p1 - p2))/(2* t) - ((b/2)*((pA - disA)^2 - pA^2) + a*disA)/(2*t)) - ((p1 - cB)*(c - d*p1) + (pA - disA - cA)*(a - b*(pA - disA)) - (pA - cA)*(a - b*pA))* (-(a - b*pA)/(2*t)) == 0, (-(a - b*(pA - disA) - b*(pA - disA - cA)))* (1/2 + ((d/2)*(p1^2 - p2^2) - c*(p1 - p2))/(2*t) + ((b/2)*((pA - disA)^2 - pA^2) + a*disA)/(2*t)) - ((p1 - cB)*(c - d*p1) + (pA - disA - cA)*(a - b*(pA - disA)) - (pA - cA)*(a - b*pA))*(-(a - b*(pA - disA))/(2*t)) == 0, ((p1 - cB)*(c - d*p1) + alpha*(pA - disA - cA)* (a - b*(pA - disA)) - alpha*(pA - cA)*(a - b*pA))* (-(c - d*p1)/(2*t)) + (c - d*p1 - d*(p1 - cB))* (1/2 + ((d/2)*(p1^2 - p2^2) - c*(p1 - p2))/(2*t) + alpha*(((b/2)*((pA - disA)^2 - pA^2) + a*disA)/(2*t))) == 0, (c - d*p2 - d*(p2 - cB))*(1/2 - ((d/2)*(p1^2 - p2^2) - c*(p1 - p2))/(2*t) - alpha*(((b/2)*((pA - disA)^2 - pA^2) + a*disA)/(2*t))) + (p2 - cB)*(c - d*p2)* (-(c - d*p2)/(2*t)) == 0}] sols = NSolve[eqns, {pA, p1, p2, disA}] (Chop[#1, 10^(-8)] & )[{eqns[[1, 1]] - eqns[[1, 2]], eqns[[2, 1]] - eqns[[2, 2]], eqns[[3, 1]], eqns[[4, 1]]} /. sols] Out[1]= {6*(589 - 58*p1)*p1 + 10*(40 + p1*(-83 + 8*p1))*pA + 5*disA^2*(-87 + 20*pA) == 2010 + 2*p2*(-25 + 2*p2)*(-39 + 10*pA) + 4*disA*(936 + 5*pA*(-87 + 10*pA)), 2*(1395 + 50*disA^3 + 2*p1^2*(87 - 20*pA) - 300*pA + p2*(-25 + 2*p2)*(-39 + 10*pA) + p1*(-1767 + 415*pA) + disA*(2172 + 5*p1*(-83 + 8*p1) + 10*(25 - 2*p2)*p2 + 10*pA*(-87 + 10*pA))) == 15*disA^2*(-87 + 20*pA), 5*disA^2*(-83 + 16*p1) + 10*(2*(-9 + p1)*p1*(-105 + 16*p1) + 200*p1*p2 + 2*(33 - 8*p1)*p2^2 - 5*(283 + 165*p2)) + 2*disA*(-1767 + 4*p1*(87 - 20*pA) + 415*pA) == 0, (1/100)*(10*(25 - 4*p2)^2*(-2 + p2) + (-33 + 8*p2)* (10*(5 + (25 - 2*p1)*p1 + p2*(-25 + 2*p2)) + disA*(-48 - 5*disA + 10*pA))) == 0} Out[2]= {{pA -> -12.06189642812917, p1 -> 8.34402234764809, p2 -> 3.356678571144645, disA -> -32.70935236153433}, {pA -> 17.265485311392837, p1 -> 2.439609061873783, p2 -> 4.618440545871479, disA -> 25.673938511061692}, {pA -> 13.81047581155533, p1 -> 2.4037962568088047, p2 -> 8.791025403403523, disA -> 18.77941930142607}, {pA -> 4.699630588499789 + 3.7683838321516383*I, p1 -> 6.359324240492989 - 1.1317601366711163*I, p2 -> 5.833210978440062 - 1.0887366827652258*I, disA -> 1.0215517102528369 + 7.522476139258227*I}, {pA -> 4.699630588499789 - 3.7683838321516383*I, p1 -> 6.359324240492989 + 1.1317601366711163*I, p2 -> 5.833210978440062 + 1.0887366827652258*I, disA -> 1.0215517102528369 - 7.522476139258227*I}, {pA -> 4.809304762769946 + 4.311029960544415*I, p1 -> 6.426329341619092 - 1.202035823002143*I, p2 -> 6.502058831524984 + 1.2092489543878284*I, disA -> 1.213663968993755 + 8.631059512781976*I}, {pA -> 4.809304762769946 - 4.311029960544415*I, p1 -> 6.426329341619092 + 1.202035823002143*I, p2 -> 6.502058831524984 - 1.2092489543878284*I, disA -> 1.213663968993755 - 8.631059512781976*I}, {pA -> 1.2910505175398863, p1 -> 4.6226352739904275, p2 -> 3.0762499216577734, disA -> -6.7743708779685505}, {pA -> 3.4635262592499094 + 0.9312186311857698*I, p1 -> 6.223958361707435 - 1.2301621442682107*I, p2 -> 5.9728359912537865 - 1.1334628248384875*I, disA -> 0.20113798369291158 + 1.5505747049588072*I}, {pA -> 3.4635262592499094 - 0.9312186311857698*I, p1 -> 6.223958361707435 + 1.2301621442682107*I, p2 -> 5.9728359912537865 + 1.1334628248384875*I, disA -> 0.20113798369291158 - 1.5505747049588072*I}, {pA -> 3.3884321485724955 + 0.8955222267076347*I, p1 -> 6.297554158874207 - 1.278032188535932*I, p2 -> 6.311322058804194 + 1.2040631070690104*I, disA -> 0.1581399153887693 + 1.5183991645734929*I}, {pA -> 3.3884321485724955 - 0.8955222267076347*I, p1 -> 6.297554158874207 + 1.278032188535932*I, p2 -> 6.311322058804194 - 1.2040631070690104*I, disA -> 0.1581399153887693 - 1.5183991645734929*I}, {pA -> 4.11571873522887 - 0.21886644927641588*I, p1 -> 6.249580007206807 + 1.1894390540657032*I, p2 -> 6.184694166431468 - 1.2505596012644582*I, disA -> -0.992108747596738 + 1.003503973138894*I}, {pA -> 4.11571873522887 + 0.21886644927641588*I, p1 -> 6.249580007206807 - 1.1894390540657032*I, p2 -> 6.184694166431468 + 1.2505596012644582*I, disA -> -0.992108747596738 - 1.003503973138894*I}, {pA -> 4.119992313758444 + 0.16820717551995332*I, p1 -> 6.149972535352223 - 1.1687915102753534*I, p2 -> 6.069091957840634 - 1.2200796383812478*I, disA -> -1.0588801411331423 - 1.0013345567536924*I}, {pA -> 4.119992313758444 - 0.16820717551995332*I, p1 -> 6.149972535352223 + 1.1687915102753534*I, p2 -> 6.069091957840634 + 1.2200796383812478*I, disA -> -1.0588801411331423 + 1.0013345567536924*I}, {pA -> 4.368275470923857 + 2.3351851286136247*I, p1 -> 4.865111663465403 + 0.12169418355287195*I, p2 -> 3.0268342640601227 - 0.00790086095686217*I, disA -> -0.5200916815936684 + 2.76693245489717*I}, {pA -> 4.368275470923857 - 2.3351851286136247*I, p1 -> 4.865111663465403 - 0.12169418355287195*I, p2 -> 3.0268342640601227 + 0.00790086095686217*I, disA -> -0.5200916815936684 - 2.76693245489717*I}, {pA -> 3.0983083087838876 - 0.5270861226903584*I, p1 -> 8.138157979060834 - 0.07589264336638436*I, p2 -> 3.0562768785310923 - 0.02384971235213621*I, disA -> -0.33077557680568626 + 1.208000808605468*I}, {pA -> 3.0983083087838876 + 0.5270861226903584*I, p1 -> 8.138157979060834 + 0.07589264336638436*I, p2 -> 3.0562768785310923 + 0.02384971235213621*I, disA -> -0.33077557680568626 - 1.208000808605468*I}, {pA -> 3.460235391222053 + 0.7393870755179917*I, p1 -> 3.0524177544558393 + 0.03923100156390229*I, p2 -> 7.995775247361867 + 0.016486912235177578*I, disA -> -0.13205359263286792 + 0.5658225510181639*I}, {pA -> 3.460235391222053 - 0.7393870755179917*I, p1 -> 3.0524177544558393 - 0.03923100156390229*I, p2 -> 7.995775247361867 - 0.016486912235177578*I, disA -> -0.13205359263286792 - 0.5658225510181639*I}, {pA -> 4.615634965236858 + 0.2750351897569045*I, p1 -> 6.098240871978464 - 1.1233472240855473*I, p2 -> 6.098624677834901 - 1.1432415363240416*I, disA -> -0.1567139969328328 + 0.6584442274616198*I}, {pA -> 4.615634965236858 - 0.2750351897569045*I, p1 -> 6.098240871978464 + 1.1233472240855473*I, p2 -> 6.098624677834901 + 1.1432415363240416*I, disA -> -0.1567139969328328 - 0.6584442274616198*I}, {pA -> 4.657126279735499 + 0.30324565471596754*I, p1 -> 6.173299295732771 - 1.1441043218236748*I, p2 -> 6.188531790221966 + 1.1642890309109823*I, disA -> -0.14014979241180375 + 0.6898845975194938*I}, {pA -> 4.657126279735499 - 0.30324565471596754*I, p1 -> 6.173299295732771 + 1.1441043218236748*I, p2 -> 6.188531790221966 - 1.1642890309109823*I, disA -> -0.14014979241180375 - 0.6898845975194938*I}, {pA -> 4.85856246827544 + 1.5636467453739502*I, p1 -> 6.1670258406571286 + 1.343824684143421*I, p2 -> 6.2301608105421025 - 1.1166971988089176*I, disA -> 0.9840103336255757 + 1.2856940803148085*I}, {pA -> 4.85856246827544 - 1.5636467453739502*I, p1 -> 6.1670258406571286 - 1.343824684143421*I, p2 -> 6.2301608105421025 + 1.1166971988089176*I, disA -> 0.9840103336255757 - 1.2856940803148085*I}, {pA -> 4.700405379706214 + 0.9602056974247697*I, p1 -> 2.3209368999220783 - 0.047174760289443174*I, p2 -> 2.275099928135344 - 0.03832105285008741*I, disA -> 1.0363469218444052 + 1.3418151319164293*I}, {pA -> 4.700405379706214 - 0.9602056974247697*I, p1 -> 2.3209368999220783 + 0.047174760289443174*I, p2 -> 2.275099928135344 + 0.03832105285008741*I, disA -> 1.0363469218444052 - 1.3418151319164293*I}, {pA -> 5.040374022734264 - 0.13589279464710433*I, p1 -> 2.8523278805825223 - 0.14160058618308777*I, p2 -> 8.054373552655694 + 0.10041942243664882*I, disA -> 0.12306168043362546 + 1.615973433307376*I}, {pA -> 5.040374022734264 + 0.13589279464710433*I, p1 -> 2.8523278805825223 + 0.14160058618308777*I, p2 -> 8.054373552655694 - 0.10041942243664882*I, disA -> 0.12306168043362546 - 1.615973433307376*I}, {pA -> 4.863849398252252 + 1.5552707941407546*I, p1 -> 6.104990832845352 + 1.3225727032952503*I, p2 -> 6.0739846623087335 + 1.082299067760124*I, disA -> 1.0275698869564367 + 1.3092322851765947*I}, {pA -> 4.863849398252252 - 1.5552707941407546*I, p1 -> 6.104990832845352 - 1.3225727032952503*I, p2 -> 6.0739846623087335 - 1.082299067760124*I, disA -> 1.0275698869564367 - 1.3092322851765947*I}, {pA -> 5.342633484670965 + 1.2903710461121054*I, p1 -> 7.964533131091436 + 0.07748095383665983*I, p2 -> 3.0218129946565244 + 0.002906769503322082*I, disA -> 0.32570236711158396 + 1.0125321488889447*I}, {pA -> 5.342633484670965 - 1.2903710461121054*I, p1 -> 7.964533131091436 - 0.07748095383665983*I, p2 -> 3.0218129946565244 - 0.002906769503322082*I, disA -> 0.32570236711158396 - 1.0125321488889447*I}, {pA -> 3.3942283180641346 + 0.6898963086021609*I, p1 -> 3.118832641082504 + 0.041261360764756186*I, p2 -> 4.976247479119619 - 0.007362078124791084*I, disA -> -0.1821159831725192 + 0.514722015706369*I}, {pA -> 3.3942283180641346 - 0.6898963086021609*I, p1 -> 3.118832641082504 - 0.041261360764756186*I, p2 -> 4.976247479119619 + 0.007362078124791084*I, disA -> -0.1821159831725192 - 0.514722015706369*I}, {pA -> 4.5541426008457595, p1 -> 2.300678174040287, p2 -> 2.26998405731452, disA -> 1.1002810573705266}, {pA -> 4.128864029252393, p1 -> 4.967898884645701, p2 -> 3.1084676076634485, disA -> -0.11886946315839667}, {pA -> 4.173297695144698 + 0.3249806946923189*I, p1 -> 2.2909911128479843 - 0.07667394829689839*I, p2 -> 2.30759566297336 - 0.04066254122245161*I, disA -> -0.710154054903588 + 1.1887343511995823*I}, {pA -> 4.173297695144698 - 0.3249806946923189*I, p1 -> 2.2909911128479843 + 0.07667394829689839*I, p2 -> 2.30759566297336 + 0.04066254122245161*I, disA -> -0.710154054903588 - 1.1887343511995823*I}, {pA -> 5.120086580366375 - 0.1853276105137699*I, p1 -> 2.9136115732151318 - 0.13437247983174408*I, p2 -> 4.946667951729195 - 0.045822623372494355*I, disA -> 0.1732364017149688 + 1.6604645825866722*I}, {pA -> 5.120086580366375 + 0.1853276105137699*I, p1 -> 2.9136115732151318 + 0.13437247983174408*I, p2 -> 4.946667951729195 + 0.045822623372494355*I, disA -> 0.1732364017149688 - 1.6604645825866722*I}, {pA -> 4.010233474014608, p1 -> 4.969276499781901, p2 -> 3.032911941398236, disA -> 1.7213995448660353}} Out[3]= {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}} Jean-Marc === Subject: Re-defining Log over it's branch cut Hello all, When integrating along a logarithmic branch cut, often have to define two values of z: z=r Exp[0 i] which is a path above the positive real axis z=r Exp[2 pi i] which is the path below the positive real axis However, when I make a transformation rule: Log[z] /.z->r Exp[0 i] returns Log[r] but: Log[z] /.z->r Exp[2 pi i] should be Log[r]+2 pi i however Mathematica returns Log[r] in both cases. Is there a way to configure the Log function to return these two values? I have the same question when the branch cut is along the negative real axis: Log[z] /. z->r Exp[-pi i] (needs to be Log[r]-pi i) Log[z] /. z->r Exp[pi i] (needs to be Log[r]+pi i) === Subject: Re: Re-defining Log over it's branch cut Hi. In[11]:= Log[z] /. z -> r*Exp[0*I] Out[11]= Log[r] In[14]:= PowerExpand[Log[z] /. z -> r*Exp[2*Pi*i]] /. i -> I Out[14]= 2*I*Pi + Log[r] In[15]:= PowerExpand[Log[z] /. z -> r*Exp[(-Pi)*i]] /. i -> I Out[15]= (-I)*Pi + Log[r] In[16]:= PowerExpand[Log[z] /. z -> r*Exp[Pi*i]] /. i -> I Out[16]= I*Pi + Log[r] Dimitris / chuck009 : > Hello all, > > When integrating along a logarithmic branch cut, often have to define two values of z: > > z=r Exp[0 i] which is a path above the positive real axis > > z=r Exp[2 pi i] which is the path below the positive real axis > > However, when I make a transformation rule: > > Log[z] /.z->r Exp[0 i] returns Log[r] > > but: > > Log[z] /.z->r Exp[2 pi i] should be Log[r]+2 pi i > > however Mathematica returns Log[r] in both cases. > > > Is there a way to configure the Log function to return these two values? I have the same question when the branch cut is along the negative real axis: > > Log[z] /. z->r Exp[-pi i] (needs to be Log[r]-pi i) > > Log[z] /. z->r Exp[pi i] (needs to be Log[r]+pi i) === Subject: Re: 6.0 Standard Packages?, New Style Documentation? > 1) Is there anyplace in the documentation where one > can find all the > 'standard packages' listed together in one place like > they were in the 5.2 > Help Browser? > > 2) Is there anyplace in the documentation that tell > how to construct the new > style documentation, how to get a documentation style > sheet, where to put > the documentation, and how to make sure that users > have access to it? > > > -- > David Park > djmpark@comcast.net > http://home.comcast.net/~djmpark/ > > > I would very much like to know the answer to Question 2 but can only help, perhaps, with Question 1. The following function will list all the packages Grid[Partition[ SetDirectory[ ToFileName[{$InstallationDirectory, AddOns, Packages}]]; FileNames[], 2], Frame -> All] To get the function names in a Package define the following function: GetNames[pack_String] := (Needs[StringJoin[pack, `]]; Names[StringJoin[pack, `*]]) Example of use: GetNames[ANOVA] results in: {ANOVA, Bonferroni, CellMeans, Duncan, Dunnett, PostTests, StudentNewmanKeuls, Tukey} I have found it useful to go directly to some of the folders for documentation on a particular package. For instance, (on a Windows Ver. 6 machine), documentation (Guides and Tutorials) can be found on the StatisticalPlots Package at C:Program FilesWolfram ResearchMathematica6.0DocumentationEnglishPackagesStatisticalPlot sDocumentationEnglish The root folder for documentation on all the packages is at: C:Program FilesWolfram ResearchMathematica6.0DocumentationEnglishPackages and then it's possible to go from there to a given package. There are no Standard Packages as such. They seem to fall into 4 categories: Applications, ExraPackages, Legacy Packages and Packages. This structure shows up in the following path (Window machine, Ver. 6): C:Program FilesWolfram ResearchMathematica6.0AddOns Don DuBois === Subject: Re: Selecting Sub-lists After Split > Hello everyone, > > Suppose I have a list of real number called myList. > I split it into > sub-lists of positive and negative numbers called > myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of > negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory > Select[myNewList, Negative[First[#]] &] should accomplish it. Don === Subject: Re: Selecting Sub-lists After Split My suggestion: In[4]:= list={1,2,-3,-7,4,-8,9,12,-3}; newlist={Select[list,#>0 &],Select[list,#<0 &]} Out[5]= {{1,2,4,9,12},{-3,-7,-8,-3}} Now can access the positive sublist and negative sublist using newlist[[1,i]] for the positive and newlist[[2,i]] for the negatives. === Subject: Re: Trouble with TraditionalForm in Mathematica 6.0 > Hi Dan, > > there is something wrong with your slash. You may convince yourself by > > typing: Divide[a,b] instead of a/b. Somhow mathematica gets another > > character than slash. I assume your are using a non english keyboard. > > Check your international settings. > > hope this helps, Daniel > what is wrong is the look ov the slash. But it is unterstood like a slash. The small square is the straight and short line. And the result when I print (to my printer :) ) is good. I use the Kubuntu 6.04 system. === Subject: Re: Trouble with TraditionalForm in Mathematica 6.0 > > HiDan, > > there is something wrong with your slash. You may convince yourself by > > typing: Divide[a,b] instead of a/b. Somhow mathematica gets another > > character than slash. I assume your are using a non english keyboard. > > Check your international settings. > > hope this helps, Daniel > > what is wrong is the look ov the slash. But it is unterstood like a > slash. The small square is the straight and short line. And the result > when I print (to my printer :) ) is good. > > I use the Kubuntu 6.04 system. No ideas ? http://img442.imageshack.us/my.php?image=figure4pl5.png === Subject: Re: 6.0 Standard Packages?, New Style Documentation? >1) Is there anyplace in the documentation where one can find all the >'standard packages' listed together in one place like they were in >the 5.2 Help Browser? I don't believe so. If all that is desired is a list of the standard packages that can be obtained with Last[StringSplit[#, $PathnameSeparator]] & /@ FileNames[*, ToFileName[{$InstallationDirectory, AddOns, Packages}]] and Last[StringSplit[#, $PathnameSeparator]] & /@ FileNames[*m, ToFileName[{$InstallationDirectory, AddOns, LegacyPackages}], 2] for the legacy packages. Of course, this provides no link to the documentation for these packages. To get to the documentation for the standard packages, the best thing I seen so far is the palette Selwyn Hollis created and made available at: -- To reply via email subtract one hundred and four === Subject: Re: Selecting Sub-lists After Split >Suppose I have a list of real number called myList. I split it into >sub-lists of positive and negative numbers called myNewList by doing >this (there may be a more elegant way): >myNewList = Split[myList, #1 #2 > 0 &] >Now, how can I select all of the sub-lists of negative numbers from >myNewList? A simple way to do this would be to use pattern matching and Cases. =46irst generate so data In[12]:= data = Split[RandomReal[{-1, 1}, 20], #1 #2 > 0 &] Out[12]= {{0.515309},{-0.014795},{0.329838,0.896598},{-0.414435, -0.326671,-0.347789,-0.627698,-0.763855,-0.85736,-0.774624},{0.861427, 0.387308,0.590255},{-0.502033},{0.813789},{-0.748274,-0.297541, -0.170911,-0.948834}} then to pick out the sub-lists with negative values In[13]:= Cases[data, {_?(# < 0 &), ___}] Out[13]= {{-0.014795},{-0.414435,-0.326671,-0.347789,-0.627698, -0.763855,-0.85736,-0.774624},{-0.502033},{-0.748274,-0.297541,-0.170911, -0.948834}} -- To reply via email subtract one hundred and four === Subject: Re: Re: Dynamic PlotLabel in Math6? Perhaps it's clearer to use Tooltip, so that the label appears directly near the cursor position as the cursor approaches the curve (and highlighted against a colored background): Plot[{Tooltip[Sin[x]],Tooltip[Cos[x]]},{x,0,2Pi},PlotStyle->Thick] >> It would be convenient if this construction would work in >> math6: >> Plot[{Annotation[Sin[x], Sine, Mouse], Annotation[Cos[x], Cosine, Mouse]}, {x, 0, 2 [Pi]}, >> PlotStyle -> Thick, PlotLabel -> Dynamic[MouseAnnotation[]]] >> (i.e., use the label as a dynamic legend) >> >> This kind of works, if you know a priori to click and >> pull up the pop-up window: >> PopupWindow[ >> Plot[{Annotation[Sin[x], Sine, Mouse], >> Annotation[Cos[x], Cosine, Mouse]}, {x, 0, 2 [Pi]}, >> PlotStyle -> Thick], Dynamic[MouseAnnotation[]]] >> >> Any ideas on how to make the first construction work >> dynamically? >> >> Craig > > Hello Craig, > > I think one possible way to do this is just to tweak your code a > little bit by moving the Dynamic out. > > Dynamic@Plot[{Annotation[Sin[x], Sine, Mouse], > Annotation[Cos[x], Cosine, Mouse]}, {x, 0, 2 [Pi]}, > PlotStyle -> Thick, PlotLabel -> MouseAnnotation[]] > > And this works. > > Hope this helps > > Pratik Desai > > > > -- 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: Selecting Sub-lists After Split > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory Hi Gregory, The expression Cases[myNewList, v_ /; VectorQ[v, Negative]] will do it. In[1]:= myList = RandomInteger[{-5, 5}, {20}] myNewList = Split[myList, #1*#2 > 0 & ] Cases[myNewList, v_ /; VectorQ[v, Negative]] Out[1]= {-3, -5, 0, -2, 4, -1, -5, -3, -1, 0, -1, 4, 1, -3, 1, -3, 5, 4, 3, 5} Out[2]= {{-3, -5}, {0}, {-2}, {4}, {-1, -5, -3, -1}, {0}, {-1}, {4, 1}, {-3}, {1}, {-3}, {5, 4, 3, 5}} Out[3]= {{-3, -5}, {-2}, {-1, -5, -3, -1}, {-1}, {-3}, {-3}} Jean-Marc === Subject: Re: Selecting Sub-lists After Split > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory Select[myNewList, First[#] < 0 &] Adriano Pascoletti === Subject: Re: Selecting Sub-lists After Split I am not sure if I understand you correctly, but I suggest Select/Cases: myList = {1, -13, 4, 6, -12.3, -14, 10, 100}; Here you can use Select or Cases: Select[myList, Negative] {-13, -12.3, -14} Cases[myList, _?Negative] {-13, -12.3, -14} myNewList = Split[myList, #1 #2 > 0 &] {{1}, {-13}, {4, 6}, {-12.3, -14}, {10, 100}} To get the elements you must now use level specification, so Cases is the more natural choice: Cases[myList, _?Negative, 2] {-13, -12.3, -14} But, if you want sub-lists you should use: Select[myNewList, VectorQ[#, Negative] &] {{-13}, {-12.3, -14}} Drago > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory > === Subject: Re: Selecting Sub-lists After Split > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory > Select[myNewList, Negative@First[#]&] Szabolcs === Subject: Re: Selecting Sub-lists After Split > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory Here is a newbie approach: First[Last[Reap[i = 1; While[i <= Length[newlst], If[First[newlst[[i]]] < 0, Sow[newlst[[i]]], Null]* i++; ]]]] newlst is your MyNewList. J=E1nos I think I may need a bathroom break? Is this possible? --G.W.Bush http://news.bbc.co.uk/2/hi/americas/4249646.stm === Subject: Re: Re: Best practice for Mathematica package development > That seems to be the recommended file layout. But why not just have a > single file, PackageName.m, and put it directly in the $Path? That would work well if you have no other files that you want to distribute with your package. Such files might include license text, readme text, install text, package documentation, etc. -- http://chris.chiasson.name/ === Subject: Re: Can anybody help me solving such a system of Use FindRoot a = 24; b = 5; c = 25; d = 4; cA = 3; cB = 2; t = 5; alpha = 0.2; eqns = {(a - b*pA - b*(pA - cA))*(0.5 - ((d/2) (p1^2 - p2^2) - c (p1 - p2))/(2 t) - ((b/2) ((pA - disA)^2 - pA^2) + a*disA)/(2 t)) - ((p1 - cB) (c - d*p1) + (pA - disA - cA) (a - b*(pA - disA)) - (pA - cA) (a - b*(pA)))*(-(a - b*pA)/(2 t)) == 0, -(a - b*(pA - disA) - b (pA - disA - cA))*(0.5 + ((d/2) (p1^2 - p2^2) - c (p1 - p2))/(2 t) + ((b/2) ((pA - disA)^2 - pA^2) + a*disA)/(2 t)) - ((p1 - cB) (c - d*p1) + (pA - disA - cA) (a - b*(pA - disA)) - (pA - cA) (a - b*(pA)))*(-(a - b*(pA - disA))/(2 t)) == 0, ((p1 - cB) (c - d*p1) + alpha*(pA - disA - cA) (a - b*(pA - disA)) - alpha*(pA - cA) (a - b*(pA)))*(-(c - d*p1)/(2 t)) + (c - d*p1 - d (p1 - cB)) (0.5 + ((d/2) (p1^2 - p2^2) - c (p1 - p2))/(2 t) + alpha*((b/2) ((pA - disA)^2 - pA^2) + a*disA)/(2 t)) == 0, (c - d*p2 - d*(p2 - cB)) (0.5 - ((d/2) (p1^2 - p2^2) - c (p1 - p2))/(2 t) - alpha*((b/2) ((pA - disA)^2 - pA^2) + a*disA)/(2 t)) + (p2 - cB) (c - d*p2) (-(c - d*p2)/(2 t)) == 0}; soln = FindRoot[eqns, {{pA, 4}, {p1, 2}, {p2, 2}, {disA, 1}}] {pA->4.55414,p1->2.30068,p2->2.26998,disA->1.10028} (First /@ eqns) /. soln {6.77236*10^-15,-1.11022*10^-14,7.10543*10^-15,1.77636*10^-15} Bob Hanlon > > I have tried NSolve, Solve, Reduce, to solve the system below, > however, the mathematica didn't return an answer. Can anybody know how > to solve it using Mathematica? > > The inputs are as follows: > > a = 24; > b = 5; > c = 25; > d = 4; > cA = 3; > cB = 2; > t = 5; > alpha = 0.2; > Solve[{(a - b*pA - b*(pA - cA))*(0.5 - ((d/2)( > p1^2 - p2^2) - > c(p1 - p2))/(2t) - ((b/2)((pA - disA)^2 - pA^2) + > a*disA)/(2t)) - ((p1 - cB)( > c - d*p1) + ( > pA - disA - cA)(a - b*(pA - disA)) - (pA - > cA)(a - b*(pA)))*(-(a - b*pA)/(2t)) == > 0, -(a - b*(pA - disA) - b(pA - disA - cA))*(0.5 + ((d/2) > ( > p1^2 - p2^2) - c(p1 - p2))/(2t) + (( > b/2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) - (( > p1 - cB)(c - d*p1) + (pA - disA - cA)(a - > b*(pA - disA)) - (pA - cA)(a - b*( > pA)))*(-(a - b*(pA - disA))/(2t)) == 0, ((p1 - > cB)(c - d*p1) + alpha*(pA - disA - cA)(a - b*( > pA - disA)) - alpha*(pA - cA)(a - b*(pA)))*(-( > c - d*p1)/(2t)) + (c - d*p1 - d(p1 - cB))(0.5 + ((d/ > 2)(p1^2 - p2^2) - c(p1 - p2))/(2t) + alpha*(( > b/2)((pA - disA)^2 - pA^2) + a*disA)/( > 2t)) == 0, (c - d*p2 - d*(p2 - cB))(0.5 - ((d/ > 2)(p1^2 - p2^2) - c(p1 - p2))/(2t) - > alpha*((b/ > 2)((pA - disA)^2 - pA^2) + a*disA)/(2t)) + ( > p2 - cB)(c - d*p2)(-(c - d*p2)/(2t)) == 0}, {pA, p1, p2, > disA}] > > > > > === Subject: Re: Selecting Sub-lists After Split myList = Table[RandomReal[{-1, 1}], {10}]; myNewList = Split[myList, #1 #2 > 0 &]; Select[myNewList, #[[1]] < 0 &] {{-0.653948,-0.875564,-0.770361},{-0.240326}} Bob Hanlon > Hello everyone, > > Suppose I have a list of real number called myList. I split it into > sub-lists of positive and negative numbers called myNewList by doing > this (there may be a more elegant way): > > myNewList = Split[myList, #1 #2 > 0 &] > > Now, how can I select all of the sub-lists of negative numbers from > myNewList? > > Any tips would be most appreciated. > > > Gregory > === Subject: Re: Iterate Through a List > Nick you have sent the message various times. > There are many responses. > With the enormous number of messages that attack > the moderator it is obvious that it control everything! > Difficult task indeed. I think that some of the messages in this batch arrived late, e.g. I sent the message about setlinejoin/setlinecap more than two weeks ago. === Subject: Re: Pattern Matching Mathematica 6 versus 5.2? > I have noticed that the 6.0 pattern matcher is a bit better at > properly ordering DownValues when a more general (but earlier-defined) > DownValue would block a less general (later-defined) DownValue. By > default, DownValues are supposed to be used in decreasing order of > generality, but if the pattern matcher can't determine which rule to > apply first, then the order is first come first serve. > > In other words, perhaps you should check to see what order the > DownValues of Grading and NonCommutativeMultiply have in 6.0 and > reorder your code so that it defines them in that order. > > > In this case the difference is actually caused by the same bug fix that was > mentioned here: > > http://forums.wolfram.com/mathgroup/archive/2007/Jun/msg00104.html > > E.g., try > > In[1]:= Attributes[f] = {Flat, Orderless, OneIdentity}; > Grading[foo] = 1; > f[x_, x_] /; OddQ[Grading[x]] := 0 > > In[4]:= f[foo, foo] > Out[4]= 0 > > In[5]:= f[foo, foo, foo] > Out[5]= f[0, foo] > > If you try this in 5.2, the last result will be f[foo,foo,foo], because the > condition prevented f's attributes from being taken into account. A simple > workaround in version 5.2 would be use the equivalent form > > f[x_, x_] := 0 /; OddQ[Grading[x]] > > Now the attributes are indeed used. The key difference is that the Head of > the LHS of the definition is f rather than Condition. > > It's true that the automatic DownValues ordering has also been improved in > version 6. It should now never reorder rules that shouldn't be reordered > (although examples of this are usually fairly subtle). The ordering > algorithm used can be controlled by a system option > > SetSystemOptions[DefinitionsReordering -> val] > > where val is Default, Legacy (5.2 behavior), or None. The None > option can be useful to set temporarily when reading in a file with > thousands of definitions for which you know you don't need reordering. > > Oyvind Tafjord > Wolfram Research > > >> >> I encounter the following different behaviour of the Mathematica pattern matcher >> version 6 versus 5.2. >> >> I give to both versions the following rules (which should implement a simple >> Grassmann algebra): >> >> Grading[_Symbol] = 0; >> Grading[_Integer] = 0; >> Grading[_Rational] = 0; >> Grading[_Complex] = 0; >> Grading[_Real] = 0; >> Fermion[a_, b___] := ((Grading[a] = 1); Fermion[b]); >> >> Unprotect[NonCommutativeMultiply]; >> NonCommutativeMultiply[x_, y_ /; EvenQ[Grading[y]]] := x y; >> NonCommutativeMultiply[y_ /; EvenQ[Grading[y]], x_] := x y; >> NonCommutativeMultiply[x_, x1_ y_ /; EvenQ[Grading[y]]] := y (x ** x1); >> NonCommutativeMultiply[x_ y_ /; EvenQ[Grading[y]], x1_] := y (x ** x1); >> NonCommutativeMultiply[x_, x_] /; OddQ[Grading[x]] := 0; >> NonCommutativeMultiply[y_ /; OddQ[Grading[y]], x_ /; OddQ[Grading[x]]] /; (! OrderedQ[{y, x}]) := -x ** y; >> Protect[NonCommutativeMultiply]; >> >> Now in version 6 I get e.g. >> >> In[11]:= Fermion[f1, f2, f3, f4] >> Out[11]= Fermion[] >> >> In[13]:= f1 ** f2 ** f1 ** f4 >> Out[13]= 0 >> >> which is as expected, since there a two equal factors. >> >> BUT in version 5.2 >> >> In[3]:=Fermion[f1, f2, f3, f4] >> Out[3]=Fermion[] >> >> In[5]:=f1**f2**f1**f4 >> Out[5]=f1**f2**f1**f4 >> >> which is NOT as it should be. Mathematica 5.2 fails to simplify this automatically to zero. >> >> I implemented the above rules on the advice of David Bailey, who tried to convince me that the Mathematica pattern matcher makes >> full use of the attributes Flat and OneIdentity, which are given to NonCommuativeMultiply. This means that it should be only >> necessary to deal explicitly with the 2-argument case (as I do above). >> >> Can it be changed that in 5.2 it runs as in 6.0? >> >> >> >> > > > > -- http://chris.chiasson.name/ === Subject: Re: Pattern Matching Mathematica 6 versus 5.2? > I have noticed that the 6.0 pattern matcher is a bit better at > properly ordering DownValues when a more general (but earlier-defined) > DownValue would block a less general (later-defined) DownValue. By > default, DownValues are supposed to be used in decreasing order of > generality, but if the pattern matcher can't determine which rule to > apply first, then the order is first come first serve. > > In other words, perhaps you should check to see what order the > DownValues of Grading and NonCommutativeMultiply have in 6.0 and > reorder your code so that it defines them in that order. In this case the difference is actually caused by the same bug fix that was mentioned here: http://forums.wolfram.com/mathgroup/archive/2007/Jun/msg00104.html E.g., try In[1]:= Attributes[f] = {Flat, Orderless, OneIdentity}; Grading[foo] = 1; f[x_, x_] /; OddQ[Grading[x]] := 0 In[4]:= f[foo, foo] Out[4]= 0 In[5]:= f[foo, foo, foo] Out[5]= f[0, foo] If you try this in 5.2, the last result will be f[foo,foo,foo], because the condition prevented f's attributes from being taken into account. A simple workaround in version 5.2 would be use the equivalent form f[x_, x_] := 0 /; OddQ[Grading[x]] Now the attributes are indeed used. The key difference is that the Head of the LHS of the definition is f rather than Condition. It's true that the automatic DownValues ordering has also been improved in version 6. It should now never reorder rules that shouldn't be reordered (although examples of this are usually fairly subtle). The ordering algorithm used can be controlled by a system option SetSystemOptions[DefinitionsReordering -> val] where val is Default, Legacy (5.2 behavior), or None. The None option can be useful to set temporarily when reading in a file with thousands of definitions for which you know you don't need reordering. Oyvind Tafjord Wolfram Research > >> >> I encounter the following different behaviour of the Mathematica pattern matcher >> version 6 versus 5.2. >> >> I give to both versions the following rules (which should implement a simple >> Grassmann algebra): >> >> Grading[_Symbol] = 0; >> Grading[_Integer] = 0; >> Grading[_Rational] = 0; >> Grading[_Complex] = 0; >> Grading[_Real] = 0; >> Fermion[a_, b___] := ((Grading[a] = 1); Fermion[b]); >> >> Unprotect[NonCommutativeMultiply]; >> NonCommutativeMultiply[x_, y_ /; EvenQ[Grading[y]]] := x y; >> NonCommutativeMultiply[y_ /; EvenQ[Grading[y]], x_] := x y; >> NonCommutativeMultiply[x_, x1_ y_ /; EvenQ[Grading[y]]] := y (x ** x1); >> NonCommutativeMultiply[x_ y_ /; EvenQ[Grading[y]], x1_] := y (x ** x1); >> NonCommutativeMultiply[x_, x_] /; OddQ[Grading[x]] := 0; >> NonCommutativeMultiply[y_ /; OddQ[Grading[y]], x_ /; OddQ[Grading[x]]] /; (! OrderedQ[{y, x}]) := -x ** y; >> Protect[NonCommutativeMultiply]; >> >> Now in version 6 I get e.g. >> >> In[11]:= Fermion[f1, f2, f3, f4] >> Out[11]= Fermion[] >> >> In[13]:= f1 ** f2 ** f1 ** f4 >> Out[13]= 0 >> >> which is as expected, since there a two equal factors. >> >> BUT in version 5.2 >> >> In[3]:=Fermion[f1, f2, f3, f4] >> Out[3]=Fermion[] >> >> In[5]:=f1**f2**f1**f4 >> Out[5]=f1**f2**f1**f4 >> >> which is NOT as it should be. Mathematica 5.2 fails to simplify this automatically to zero. >> >> I implemented the above rules on the advice of David Bailey, who tried to convince me that the Mathematica pattern matcher makes >> full use of the attributes Flat and OneIdentity, which are given to NonCommuativeMultiply. This means that it should be only >> necessary to deal explicitly with the 2-argument case (as I do above). >> >> Can it be changed that in 5.2 it runs as in 6.0? >> >> >> >> > > === Subject: Re: Pattern Matching Mathematica 6 versus 5.2? I have noticed that the 6.0 pattern matcher is a bit better at properly ordering DownValues when a more general (but earlier-defined) DownValue would block a less general (later-defined) DownValue. By default, DownValues are supposed to be used in decreasing order of generality, but if the pattern matcher can't determine which rule to apply first, then the order is first come first serve. In other words, perhaps you should check to see what order the DownValues of Grading and NonCommutativeMultiply have in 6.0 and reorder your code so that it defines them in that order. > > I encounter the following different behaviour of the Mathematica pattern matcher > version 6 versus 5.2. > > I give to both versions the following rules (which should implement a simple > Grassmann algebra): > > Grading[_Symbol] = 0; > Grading[_Integer] = 0; > Grading[_Rational] = 0; > Grading[_Complex] = 0; > Grading[_Real] = 0; > Fermion[a_, b___] := ((Grading[a] = 1); Fermion[b]); > > Unprotect[NonCommutativeMultiply]; > NonCommutativeMultiply[x_, y_ /; EvenQ[Grading[y]]] := x y; > NonCommutativeMultiply[y_ /; EvenQ[Grading[y]], x_] := x y; > NonCommutativeMultiply[x_, x1_ y_ /; EvenQ[Grading[y]]] := y (x ** x1); > NonCommutativeMultiply[x_ y_ /; EvenQ[Grading[y]], x1_] := y (x ** x1); > NonCommutativeMultiply[x_, x_] /; OddQ[Grading[x]] := 0; > NonCommutativeMultiply[y_ /; OddQ[Grading[y]], x_ /; OddQ[Grading[x]]] /; (! OrderedQ[{y, x}]) := -x ** y; > Protect[NonCommutativeMultiply]; > > Now in version 6 I get e.g. > > In[11]:= Fermion[f1, f2, f3, f4] > Out[11]= Fermion[] > > In[13]:= f1 ** f2 ** f1 ** f4 > Out[13]= 0 > > which is as expected, since there a two equal factors. > > BUT in version 5.2 > > In[3]:=Fermion[f1, f2, f3, f4] > Out[3]=Fermion[] > > In[5]:=f1**f2**f1**f4 > Out[5]=f1**f2**f1**f4 > > which is NOT as it should be. Mathematica 5.2 fails to simplify this automatically to zero. > > I implemented the above rules on the advice of David Bailey, who tried to convince me that the Mathematica pattern matcher makes > full use of the attributes Flat and OneIdentity, which are given to NonCommuativeMultiply. This means that it should be only > necessary to deal explicitly with the 2-argument case (as I do above). > > Can it be changed that in 5.2 it runs as in 6.0? > > > > -- http://chris.chiasson.name/ === Subject: licensing issues with V6.0 Financial Data While reading about the V6 FinancialData[] capability, I found the following sentence: ------------------------------------------------------------------- FinancialData provides gateways to external financial data sources. Its use is subject to any restrictions associated with those sources, and may require additional licensing. ------------------------------------------------------------------- Questions that come to my mind are: - What are the sources of this data? such as Thomson Financial? - What are posiible additional license restrictions? - Are there any other license issues with V6.0 curated data? If anyone has any information about this, I would appreciate it. TIA. === Subject: Fast interactive graphics In version 6 I want to do interactive graphics where I use a controller to manipulate the shape of a curved 2-dimensional manifold (for instance). This is a type of interaction with Mathematica that should be of interest to lots of people. The main problem that I have is that the redraw time after each controller movement is quite long. I need continuous feedback so that I can immediately see the effect of making various controller movements, so using ContinuousAction->False in Manipulate (for instance) doesn't solve this problem. I have tried various shortcuts such as skeletonising the graphic during updates so that it redraws quicker, but it is still too slow, and will get worse for the more complicated graphics that I really want to work on. As a general solution it would be great if it was possible to control the redrawing of graphics so that only those parts that need to be redrawn are actually redrawn, with the user taking responsibility for any consequential errors in the accumulated graphics rendering. Here I don't want to simply zoom the graphic to limit the rendered region, because I want to interactively see the impact of my manipulations in the context of the whole graphic. Does anyone know a way of imposing this type of control (see above) on graphics rendering, or is it not actually possible in Mathematica? I think the answer is no, but I just want to make sure that I haven't overlooked a trick here. Steve Luttrell West Malvern, UK === Subject: Re: Re: Hotkeys - redefine What, exactly, does one enter in KeyEventTranslations.tr? I've tried each of the following (I think), but each gives an error: Item[KeyEvent[[, Modifiers -> {Control}], LeftDoubleBracket] Item[KeyEvent[[, Modifiers -> {Control}], LeftDoubleBracket] Item[KeyEvent[[, Modifiers -> {Control}], [LeftDoubleBracket]] >> Hi all! >> >> I am interested in hotkeys. My am pretty upsat that every different >> editor uses different selection conventions and hotkeys, etc. >> >> Anyway, I would like to redefine the hotkeys and define some for a >> couple of new actions. I wonder if I can do it. An example: how do you >> jump form the cell frame (thing on the rightmost side) to inside the >> cell and back? >> >> Bence > > Hi Bence, > > Take a look at the file > Mathematica[version_number]SystemFilesFrontEndTextResourcesWindows KeyEventTranslations.tr > > (The path may be a bit different for other operating systems.) > > I am mostly happy with the editor shortcuts, I just use this to remap > CTRL-[ to [LeftDoubleBracket] etc. > > AFAIK the format of this file is not documented (but pretty > self-explanatory), so be careful, and back it up before you make any > modifications. If you keep the backup in the same directory, make sure > that its extension is NOT .tr, otherwise your modifications may not take > effect. > > You may also want to read > http://support.wolfram.com/mathematica/interface/customize/assignkeys.html > > Szabolcs > > -- 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: Hotkeys - redefine > Hi all! > > I am interested in hotkeys. My am pretty upsat that every different > editor uses different selection conventions and hotkeys, etc. > > Anyway, I would like to redefine the hotkeys and define some for a > couple of new actions. I wonder if I can do it. An example: how do you > jump form the cell frame (thing on the rightmost side) to inside the > cell and back? > > Bence Hi Bence, Take a look at the file Mathematica[version_number]SystemFilesFrontEndTextResourcesWindows KeyEventTranslations.tr (The path may be a bit different for other operating systems.) I am mostly happy with the editor shortcuts, I just use this to remap CTRL-[ to [LeftDoubleBracket] etc. AFAIK the format of this file is not documented (but pretty self-explanatory), so be careful, and back it up before you make any modifications. If you keep the backup in the same directory, make sure that its extension is NOT .tr, otherwise your modifications may not take effect. You may also want to read http://support.wolfram.com/mathematica/interface/customize/assignkeys.html Szabolcs === Subject: Re: Export data in Mathematica 6 in TSV format write your data to a Mathematica string with ExportString[] and than write the String to the stream. Jens > Using Mathematica 5.2 following commands to export and append data to a file work fine > Openstrm = OpenAppend[FilePath]; > Export[Openstrm, DataToExport, TSV ]; > Close[Openstrm]; > > Now in Mathematica 6 you can't use a stream anymore. You have to specify the path location. As a result the Export command overwrite the file instead of appending the data to the file. > > Can someone help me to append data to a file in the TSV format? > > Thx, > XedeX > === Subject: Re: Export data in Mathematica 6 in TSV format > Using Mathematica 5.2 following commands to export and append data to a file work fine > Openstrm = OpenAppend[FilePath]; > Export[Openstrm, DataToExport, TSV ]; > Close[Openstrm]; > > Now in Mathematica 6 you can't use a stream anymore. You have to specify the path location. As a result the Export command overwrite the file instead of appending the data to the file. > > Can someone help me to append data to a file in the TSV format? > > Thx, > XedeX In version 6.0, Export also has trouble writing to pipes, e.g. Export[!cat >> file.txt, data, Table] Can someone come up with a general workaround (not just for appending to files)? === Subject: Trouble with a system of equations while they are solvable by hand, Mathematica 6.0 has problems solving it Here's an example eqns = {a + b + c + d == 4*m0, b + d == 4*m1, c + d == 4*m2, d == 4*m3} /. {a -> t0/(1 + t0), b -> (t0*t1)/(1 + t0*t1), c -> (t0*t2)/(1 + t0*t2), d -> (t0*t1*t2*t3)/(1 + t0*t1*t2*t3)} Solve[eqns, {t0, t1, t2, t3}] The solution can be found by hand and verified below sol = {t0 -> a/(1/4 - a), t1 -> (b/(1/4 - b))*((1/4 - a)/a), t2 -> (c/ (1/4 - c))*((1/4 - a)/a), t3 -> (m3/(1/4 - m3))*(a/(1/4 - a))*((1/4 - b)/b)*((1/4 - c)/c)} /. {a -> m0 - m1 - m2 + m3, b -> m1 - m3, c -> m2 - m3} eqns /. sol // Simplify This is an example of estimating equations for a saturated logistic regression model with 2 independent variables. I'd like to see if formulas also exist for more variables, but they are too cumbersome to solve by hand. Are there any Mathematica tricks I can use to answer this question? Here's the procedure that generates the system of equations for d variables (d=2 produces the system above) logeq[d_] := Module[{bounds, monomials, params, partition,derivs,sums}, xs = (Subscript[x, #1] & ) /@ Table[i, {i, 1, d}]; monomials = Subsets[xs]; monomials = (Prepend[#1, 1] & ) /@ monomials; monomials = (Times @@ #1 & ) /@ monomials; params = (Subscript[th, #1] & ) /@ Table[i, {i, 0, 2^d - 1}]; monomials = (Times @@ #1 & ) /@ Thread[{params, monomials}]; partition = Log[1 + Exp[Plus @@ monomials]]; derivs = (D[partition, Subscript[th, #1]] & ) /@ Table[i, {i, 0, 2^d - 1}]; bounds = ({#1, 0, 1} & ) /@ xs; sums = (Table[#1, Evaluate[Sequence @@ bounds]] & ) /@ derivs; sums = (Plus @@ #1 & ) /@ (Flatten[#1] & ) /@ sums; Thread[sums == Table[Subscript[m, i], {i, 0, 2^d - 1}]]] === Subject: matrix identity pointers I would like to do symbolic matrix manipulations in Mathematica where identities like partial{det(X)} = det(X) Tr(X^-1 partial{X}), where X is a matrix, would be known to Mathematica and used in things like Simplify[]. There are many such useful identities. There is a nice list in: http://matrixcookbook.com/ I am a novice and I am guessing something like this has not been implemented in Mathematica. There are lots of posts on related topics in this group including how to define your own non-commutative algebras and implementing replacement rules. There is a math source package on exterior calculus and a draft book written with mathematica on grassmanian algebras. There's an exercise in Michael Trott's book on how to prove det(e^A)=e^tr(A) for 3x3 matrices. But I'm still not sure how to start even though people have solved more difficult related problems. So I would appreciate pointers on how to go about this in a principled way, what to read, and an existing package to model mine after. === Subject: Re: 3D interpolation > I would like to do > =A4 a 3D interpolation of Meas(x,y,z) using the real position I too would very much like to know how this is done in Mathematica. I am sure that there is a simple way to do this, because ListPlot3D[] already supports interpolation with arbitrarily positioned points: http://www.wolfram.com/products/mathematica/newin6/content/HighImpactAdaptiv eVisualization/VoronoiRegionInterpolation.html But Interpolation[] gives an error: In[1]:= RandomReal[{0, 1}, {10, 3}] /. {x_, y_, f_} -> {{x, y}, f} Out[1]= {{{0.29816, 0.887332}, 0.240481}, {{0.90088, 0.965822}, 0.387489}, {{0.34728, 0.682987}, 0.827958}, {{0.818205, 0.17033}, 0.343763}, {{0.582784, 0.746518}, 0.562276}, {{0.101323, 0.562885}, 0.592576}, {{0.307368, 0.113622}, 0.911536}, {{0.146258, 0.303898}, 0.152228}, {{0.0440035, 0.377023}, 0.164235}, {{0.41297, 0.128645}, 0.851261}} In[2]:= Interpolation[%] During evaluation of In[2]:= Interpolation::indim: The coordinates do not lie on a structured tensor product grid. Out[2]= Interpolation[{{{0.29816, 0.887332}, 0.240481}, {{0.90088, 0.965822}, 0.387489}, {{0.34728, 0.682987}, 0.827958}, {{0.818205, 0.17033}, 0.343763}, {{0.582784, 0.746518}, 0.562276}, {{0.101323, 0.562885}, 0.592576}, {{0.307368, 0.113622}, 0.911536}, {{0.146258, 0.303898}, 0.152228}, {{0.0440035, 0.377023}, 0.164235}, {{0.41297, 0.128645}, 0.851261}}] Unfortunately I could not find any information in the docs about interpolation with points that do not lie on a grid. === Subject: Re: 3D interpolation (Repost for character table problem) Mathieu G a =E9crit : Hello! Sorry this might sounds like a simple question, but it seems I do not get something: Say I have a tab delimited file with such columns: RealX RealY RealZ TargX TargY TargZ Meas .... ... ... ... ... ... ... Each column having a header, followed by values. This file is taken from an experiment that ask a motion controller to move to the point (TargX,TargY,TargZ). Once the position is reached the real position (target+random positioning error) is recorded as well as a measurement value at this point. I would like to do @ a 3D interpolation of Meas(x,y,z) using the real position @ a 3D interpolation of Meas(x,y,z) using the target position @ then make an interactive XYZ 3Dplot showing: @ 3 planes (intersection pt can be changed with manipulate?) @ YZ at X coordinate = Xintersection @ ZX at Y coordinate = Yintersection @ XY at Z coordinate = Zintersection @ an option to choose which of the 2interpolation is to be used Can somebody help me do that and get more familiar with my new toy?? Any help is really really appreciated! Mathematica is like a toy, but I really have to solve that for my research. Mathieu === Subject: Re: Re: v6: still no multiple undo? Having a save after each evaluation is hardly sufficient: as it seems to be set up, each new version replaces the last. This is dangerous in that a huge amount of work could still be too easily lost. A usable substitute is a 3rd party general utility, such as CS-RCS revision control system or, more simply, a multiple-version backup imaging utility. (On my Windows system, I use a PC Magazine utility Insta-Back, where I can specify what folders and files to back up and how many levels to maintain.) > > Ah, that's at the top of my gripes list too. I'm pretty sure that > Undo is even less functional in 6 than in 5.2. >> Undo seems kind of buggy in 6. I've lost things that just didn't go >> back >> to the way they were when I tried to Undo (after e.g. accidentally >> pasting when I meant to copy). >> > Another shortcoming is the lack of AutoSave or AutoBackup capability. > It's too easy to lose track of time, crash, and then discover that > you haven't saved anything in 2 hours. (Or maybe its just dementia on > my part.) >> I'm fairly obsessive about saving frequently, but I cannot for the >> life >> of me get my students to do it. A few times a semester, someone will >> crash Mathematica at the very end of a class period when they are >> taking >> a quiz or exam, without having saved a thing. Built-in AutoSave >> would be >> nice to have. > > Would the NotebookAutoSave option work for you? > > http://reference.wolfram.com/mathematica/ref/NotebookAutoSave.html > > It saves the notebook after each evaluation, provided the notebook > has been saved once already. > > (NotebookAutoSave has been around for several versions.) > > > Brett Champion > Wolfram Research > -- 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: Re: v6: still no multiple undo? > Anything that would bring my > computer to a halt is unacceptable to me, however nice it might be > for people who alsways have the latest hardware. All I wanted to > point out is that there is also this aspect to features like this one > and I hope that WRI does not forget about it when designing new > versions. Agreed. -- http://chris.chiasson.name/ === Subject: Re: Re: v6: still no multiple undo? >> *This message was transferred with a trial version of CommuniGate >> (tm) Pro* >> The idea that people always run the best software they could seems >> rather doubtful to me, but is completely irrelevant. I think you >> older software was better, but only that a lot of new software >> (certainly not all) is bloated - a completely different thing. Did >> you really think that the reason I posted this link was because I >> would rather use Mathematica 1 than Mathematica 6? > > Andrzej Kozlowski, > > ago, so I have had time to think about it and form an opinion. > Basically, I do believe that software bloat does exist. However, many > features, while they may be computationally inefficient, are actually > quite convenient and useful. How many times have you lost something > beyond the first undo level in Mathematica? Wouldn't multiple undo > levels have been useful? I understand that the feature will decrease > performance (even further, heh), but I do not think the optimum > balance of features vs. performance has been attained here. > > > -- > http://chris.chiasson.name/ There are a few features that are useful to everyone, and there are many that are useful only to some but (unless they are made somehow optional), will slow down everyone, forcing people either to get new hardware or give up other features that they really need by having to stick with older versions. I agree that a multiple undo would occasionally be useful, but I certainly would not pay the price of having my computer paralyzed for a few minutes every time time I save. Besides, I can think of many other features, more directly relevant to the main purpose of Mathematica, that I would rather have than this one. Of course a simple kind of multiple undo, one that only undoes typing and not evaluation, might not present any problems, though it would hardly be worth making so much fuss about. Anything that would bring my computer to a halt is unacceptable to me, however nice it might be for people who alsways have the latest hardware. All I wanted to point out is that there is also this aspect to features like this one and I hope that WRI does not forget about it when designing new versions. Andrzej Kozlowski === Subject: Re: Re: v6: still no multiple undo? > The idea that people always run the best software they could seems > rather doubtful to me, but is completely irrelevant. I think you > older software was better, but only that a lot of new software > (certainly not all) is bloated - a completely different thing. Did > you really think that the reason I posted this link was because I > would rather use Mathematica 1 than Mathematica 6? Andrzej Kozlowski, ago, so I have had time to think about it and form an opinion. Basically, I do believe that software bloat does exist. However, many features, while they may be computationally inefficient, are actually quite convenient and useful. How many times have you lost something beyond the first undo level in Mathematica? Wouldn't multiple undo levels have been useful? I understand that the feature will decrease performance (even further, heh), but I do not think the optimum balance of features vs. performance has been attained here. -- http://chris.chiasson.name/ === Subject: Re: Re: v6: still no multiple undo? The idea that people always run the best software they could seems rather doubtful to me, but is completely irrelevant. I think you older software was better, but only that a lot of new software (certainly not all) is bloated - a completely different thing. Did you really think that the reason I posted this link was because I would rather use Mathematica 1 than Mathematica 6? Andrzej Kozlowski > then everyone would still be using it. > >> I understand that thera are many people would like have WRI implement >> in Mathematica one or more of their favourite features of other >> programs. After all, we all now have multi-gigaherz processors, >> do all the things that all these other programs do? You might even >> not need them any more. >> However, this kind of approach has its price and to see this clearly >> I suggest that, before submitting another request for another great >> feature you can't live without, everyone reads this: >> >> http://hubpages.com/hub/ >> >> and thinks again if this price is really worth paying. >> >> >> Andrzej Kozlowski >> >> >> >> >> While I strongly support that multiple undo is a feature we need to >> see >> soon, it will take some real work to get there. >> >> The editor, and the kernels are linked in an efficient exchange of >> messages >> and information about what needs to be displayed where and when. >> >> While implementing multiple undo-redo in a stand alone editor >> usually >> requires only to implement a tokenized undo-redo, in the v6 font >> end, it >> will require a more complex model. It is a bit like if you were >> trying to >> implement multiple undo on a wiki site like wikipedia where they >> are >> multiple contributors. >> >> We probably do not want the kernel to undo, just the front end. >> So one >> solution would be to make the kernel and the user to appear as a >> single >> contributor, and to undo both effects on the front end. So one undo >> might >> remove an output created by the kernel. >> >> Even that is challenging, because Dynamics now create a lot of >> updates and >> you will not want to roll those back. >> >> Anyway, the front end team is obviously smart enough to find a >> solution for >> all those things, but it is not going to be easy. >> >> A cheap thing that I would like to see, is a text buffer of all my >> input and >> all the code I deleted saved as a log on disk. It might be ugly, >> but it >> would be VERY USEFUL. >> >> >> Luc >> >> >> >>> >>> I am baffled that technical software is released in 2007 with >>> only a >>> single undo level. Am I missing something here? Is it because >> I'm >>> using a student license? How hard can an undo stack really be in >>> the >>> notebook interface? >>> >>> I've been irritated a few times in v5.2 from clumsy keypresses >>> losing >>> me work that I would expect to be two undos away. Alas not. >>> Still. >>> >>> Will Robertson >>> >>> >> >> Good point! I've wondered the same thing for a long time. This is >> the >> only app I run that doesn't happen multiple levels of undo. I >> think it's >> time WRI spent some time on this issue. >> >>> How much time could it possibly take! Once you have a 1-level undo >>> working, all you need to do is spill the relevant data into a >>> structure >>> - possibly on disk - and retrieve it as needed! >>> >>> David Bailey >>> http://www.dbaileyconsultancy.co.uk >>> >> >> >> >> >> > > > -- > http://chris.chiasson.name/ === Subject: Re: Re: v6: still no multiple undo? then everyone would still be using it. > I understand that thera are many people would like have WRI implement > in Mathematica one or more of their favourite features of other > programs. After all, we all now have multi-gigaherz processors, > do all the things that all these other programs do? You might even > not need them any more. > However, this kind of approach has its price and to see this clearly > I suggest that, before submitting another request for another great > feature you can't live without, everyone reads this: > > http://hubpages.com/hub/ > > and thinks again if this price is really worth paying. > > > Andrzej Kozlowski > > > > > While I strongly support that multiple undo is a feature we need to > see > soon, it will take some real work to get there. > > The editor, and the kernels are linked in an efficient exchange of > messages > and information about what needs to be displayed where and when. > > While implementing multiple undo-redo in a stand alone editor usually > requires only to implement a tokenized undo-redo, in the v6 font > end, it > will require a more complex model. It is a bit like if you were > trying to > implement multiple undo on a wiki site like wikipedia where they are > multiple contributors. > > We probably do not want the kernel to undo, just the front end. > So one > solution would be to make the kernel and the user to appear as a > single > contributor, and to undo both effects on the front end. So one undo > might > remove an output created by the kernel. > > Even that is challenging, because Dynamics now create a lot of > updates and > you will not want to roll those back. > > Anyway, the front end team is obviously smart enough to find a > solution for > all those things, but it is not going to be easy. > > A cheap thing that I would like to see, is a text buffer of all my > input and > all the code I deleted saved as a log on disk. It might be ugly, > but it > would be VERY USEFUL. > > > Luc > > > >> >> I am baffled that technical software is released in 2007 with >> only a >> single undo level. Am I missing something here? Is it because I'm >> using a student license? How hard can an undo stack really be in >> the >> notebook interface? >> >> I've been irritated a few times in v5.2 from clumsy keypresses >> losing >> me work that I would expect to be two undos away. Alas not. >> Still. >> >> Will Robertson >> >> > > Good point! I've wondered the same thing for a long time. This is > the > only app I run that doesn't happen multiple levels of undo. I > think it's > time WRI spent some time on this issue. > >> How much time could it possibly take! Once you have a 1-level undo >> working, all you need to do is spill the relevant data into a >> structure >> - possibly on disk - and retrieve it as needed! >> >> David Bailey >> http://www.dbaileyconsultancy.co.uk >> > > > > > -- http://chris.chiasson.name/ === Subject: Re: v6: still no multiple undo? It's probably been looked at before, so: What are the downsides of storing diffs of the notebook expression in memory after each event, such as key strokes or the end of an evaluation, and using those diffs to perform undos? > > I am baffled that technical software is released in 2007 with only a > single undo level. Am I missing something here? Is it because I'm > using a student license? How hard can an undo stack really be in the > notebook interface? > > I've been irritated a few times in v5.2 from clumsy keypresses losing > me work that I would expect to be two undos away. Alas not. Still. > > Will Robertson > > > -- http://chris.chiasson.name/ === Subject: Re: Re: v6: still no multiple undo? I understand that thera are many people would like have WRI implement in Mathematica one or more of their favourite features of other programs. After all, we all now have multi-gigaherz processors, do all the things that all these other programs do? You might even not need them any more. However, this kind of approach has its price and to see this clearly I suggest that, before submitting another request for another great feature you can't live without, everyone reads this: http://hubpages.com/hub/ and thinks again if this price is really worth paying. Andrzej Kozlowski > > While I strongly support that multiple undo is a feature we need to > see > soon, it will take some real work to get there. > > The editor, and the kernels are linked in an efficient exchange of > messages > and information about what needs to be displayed where and when. > > While implementing multiple undo-redo in a stand alone editor usually > requires only to implement a tokenized undo-redo, in the v6 font > end, it > will require a more complex model. It is a bit like if you were > trying to > implement multiple undo on a wiki site like wikipedia where they are > multiple contributors. > > We probably do not want the kernel to undo, just the front end. > So one > solution would be to make the kernel and the user to appear as a > single > contributor, and to undo both effects on the front end. So one undo > might > remove an output created by the kernel. > > Even that is challenging, because Dynamics now create a lot of > updates and > you will not want to roll those back. > > Anyway, the front end team is obviously smart enough to find a > solution for > all those things, but it is not going to be easy. > > A cheap thing that I would like to see, is a text buffer of all my > input and > all the code I deleted saved as a log on disk. It might be ugly, > but it > would be VERY USEFUL. > > > Luc > > > >> >> I am baffled that technical software is released in 2007 with >> only a >> single undo level. Am I missing something here? Is it because I'm >> using a student license? How hard can an undo stack really be in >> the >> notebook interface? >> >> I've been irritated a few times in v5.2 from clumsy keypresses >> losing >> me work that I would expect to be two undos away. Alas not. >> Still. >> >> Will Robertson >> >> > > Good point! I've wondered the same thing for a long time. This is > the > only app I run that doesn't happen multiple levels of undo. I > think it's > time WRI spent some time on this issue. > >> How much time could it possibly take! Once you have a 1-level undo >> working, all you need to do is spill the relevant data into a >> structure >> - possibly on disk - and retrieve it as needed! >> >> David Bailey >> http://www.dbaileyconsultancy.co.uk >> > > === Subject: Re: Re: v6: still no multiple undo? The result of undo and redo that one would expect in the case of Dynamic objects would seem to be particularly thorny! > > ...I do think though that Undo is tricky in Mathematica. One reason is > that some of what one does and might want to undo can be **very** > large. Another is the question of what one means by Undo and redo. > Does this include evaluations? -- 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: v6: still no multiple undo? > The minimal approach to Undos is part of the reason why I created the > notebook backup and tracking functionality that I include in A > WorkLife FrameWork (shameless plug!). It is sort of a mini CVS in > Mathematica. > > I do think though that Undo is tricky in Mathematica. One reason is > that some of what one does and might want to undo can be **very** > large. Another is the question of what one means by Undo and redo. > Does this include evaluations? Does it include formatting changes? > And so on. I suspect that the question is rather more complex than > what one might have to deal with in a simple text editor or word > processor. But, on the other hand, I am sure that some cleverness > could be brought to bear on this... > > --David > > http://scientificarts.com/worklife > Now Mathematica 6 compatible > > >> Ah, that's at the top of my gripes list too. I'm pretty sure that >> Undo is even less functional in 6 than in 5.2. >> >> Another shortcoming is the lack of AutoSave or AutoBackup capability. >> It's too easy to lose track of time, crash, and then discover that >> you haven't saved anything in 2 hours. (Or maybe its just dementia on >> my part.) I've created a little palette of my own with an AutoSave >> function that saves the InputNotebook[] every few minutes. That works >> pretty well, and if anyone would like to test it, let me know. I've >> made an attempt at an AutoBackup function, but I don't know how to >> make it sufficiently non-intrusive. >> >> -- Selwyn >> >> > I am baffled that technical software is released in 2007 with only a > single undo level. Am I missing something here? Is it because I'm > using a student license? How hard can an undo stack really be in the > notebook interface? > I've been irritated a few times in v5.2 from clumsy keypresses losing > me work that I would expect to be two undos away. Alas not. Still. > Will Robertson > > > A multi-level undo that let you go back to the last evaluation would be a step forward. Alternatively, a multi-level undo that ignored generated cells might be a possibility - after all, it is usually (but not always) the input that is really valuable, the output can be regenerated. David Bailey http://www.dbaileyconsultancy.co.uk === Subject: Re: v6: still no multiple undo? OK, I answered the question (at least in principle) for myself. If one defines a function called, say, EvaluateCellsWithTracking[] (not a coincidence that that is similar to the name of the function in http://scientificarts.com/worklife), then if one sets the options for a notebook nb as: SetOptions[nb, NotebookEventActions :> {{MenuCommand, EvaluateCells} :> EvaluateCellsWithTracking[]}] this will do the trick. Of course it depends on what EvaluateCellsWithTracking[] is defined to do, but you could create your own bit of code within a Module and place it whre EvaluateWithTracking[] appears in the above bit of code. There is a bit of trickyness here (which had be restart mathematica several times when I got into an infinite loop, but it is doable. One thing though, when I tried something at the level of the FrontEnd like SetOptions[$FrontEnd, FrontEndEventActions :> {{MenuCommand, EvaluateCells} :> EvaluateCellsWithTracking[]}] I encountered a nasty bug or two, so I would not recommend this as a global FrontEnd approach just yet, but rather use the notebook-level approach in the first snippet of code. As always I will track it down in a simple example and report it to bugs@wolfram.com. An example of what you might use for EvaluateCellsWithTracking is (this is a rarified version of what is in A WorkLife FrameWork--for this tow rk you will need to create a file on disk to store the evaluatons and specify the parameter $CurrentEvaluationTrackingNotebookFile as its file path): ClearAll[EvaluateCellsWithTracking]; EvaluateCellsWithTracking[nb_NotebookObject] := Module[{nbr, currentEvaluationTrackingNotebook}, SelectionMove[nb, All, Cell]; nbr = NotebookRead[nb]; currentEvaluationTrackingNotebook = NotebookOpen[$CurrentEvaluationTrackingNotebookFile, Visible -> False]; SelectionMove[currentEvaluationTrackingNotebook, After, Notebook, AutoScroll -> False]; NotebookWrite[currentEvaluationTrackingNotebook, nbr]; NotebookSave[currentEvaluationTrackingNotebook]; NotebookClose[currentEvaluationTrackingNotebook]; FrontEndExecute[FrontEnd`FrontEndToken[nb, Evaluate]]; nb ]; EvaluateCellsWithTracking[] := EvaluateCellsWithTracking[EvaluationNotebook[]] --David http://scientificarts.com/worklife Now Mathematica 6 compatible > While I strongly support that multipleundois a feature we need to see > soon, it will take some real work to get there. > > The editor, and the kernels are linked in an efficient exchange of messages > and information about what needs to be displayed where and when. > > While implementing multipleundo-redo in a stand alone editor usually > requires only to implement a tokenizedundo-redo, in the v6 font end, it > will require a more complex model. It is a bit like if you were trying to > implement multipleundoon a wiki site like wikipedia where they are > multiple contributors. > > We probably do not want the kernel to undo, just the front end. So one > solution would be to make the kernel and the user to appear as a single > contributor, and toundoboth effects on the front end. So oneundomight > remove an output created by the kernel. > > Even that is challenging, because Dynamics now create a lot of updates and > you will not want to roll those back. > > Anyway, the front end team is obviously smart enough to find a solution for > all those things, but it is not going to be easy. > > A cheap thing that I would like to see, is a text buffer of all my input and > all the code I deleted saved as a log on disk. It might be ugly, but it > would be VERY USEFUL. > > > Luc > > > > I am baffled that technical software is released in 2007 with only a > singleundolevel. Am I missing something here? Is it because I'm > using a student license? How hard can anundostack really be in the > notebook interface? > > I've been irritated a few times in v5.2 from clumsy keypresses losing > me work that I would expect to be two undos away. Alas not. Still. > > Will Robertson > >> Good point! I've wondered the same thing for a long time. This is the >> only app I run that doesn't happen multiple levels ofundo. I think it's >> time WRI spent some time on this issue. > > How much time could it possibly take! Once you have a 1-levelundo > working, all you need to do is spill the relevant data into a structure > - possibly on disk - and retrieve it as needed! > > David Bailey >http://www.dbaileyconsultancy.co.uk === Subject: Re: v6: still no multiple undo? In WorkLife I have implemented an execution log that retains all of the cells that one executes in a mathematica session if that execution is done though the appropriate palette button. See http://scientificarts.com/worklife/documentation/evaluationpalette.html I was wondering last night whether I can, in Version 6, make this an automatic behavior (toggled according to the user's choice) that is done whenever an execution takes place, irrespective of whether the palette button is used. Functoins such as FrontEndEventActions, NotebookEventActions, or CellEventActions may well do the trick. I use these for other purposes in WorkLife, but they are very broad and poserful for other things. I will look into this and let the group know what I come up with... -David http://scientificarts.com/worklife Now Mathematica 6 compatible > While I strongly support that multiple undo is a feature we need to see > soon, it will take some real work to get there. > > The editor, and the kernels are linked in an efficient exchange of messages > and information about what needs to be displayed where and when. > > While implementing multiple undo-redo in a stand alone editor usually > requires only to implement a tokenized undo-redo, in the v6 font end, it > will require a more complex model. It is a bit like if you were trying to > implement multiple undo on a wiki site like wikipedia where they are > multiple contributors. > > We probably do not want the kernel to undo, just the front end. So one > solution would be to make the kernel and the user to appear as a single > contributor, and to undo both effects on the front end. So one undo might > remove an output created by the kernel. > > Even that is challenging, because Dynamics now create a lot of updates and > you will not want to roll those back. > > Anyway, the front end team is obviously smart enough to find a solution for > all those things, but it is not going to be easy. > > A cheap thing that I would like to see, is a text buffer of all my input and > all the code I deleted saved as a log on disk. It might be ugly, but it > would be VERY USEFUL. > > > Luc > > > > I am baffled that technical software is released in 2007 with only a > single undo level. Am I missing something here? Is it because I'm > using a student license? How hard can an undo stack really be in the > notebook interface? > > I've been irritated a few times in v5.2 from clumsy keypresses losing > me work that I would expect to be two undos away. Alas not. Still. > > Will Robertson > >> Good point! I've wondered the same thing for a long time. This is the >> only app I run that doesn't happen multiple levels of undo. I think it's >> time WRI spent some time on this issue. > > How much time could it possibly take! Once you have a 1-level undo > working, all you need to do is spill the relevant data into a structure > - possibly on disk - and retrieve it as needed! > > David Bailey >http://www.dbaileyconsultancy.co.uk === Subject: Re: Re: v6: still no multiple undo? >> Ah, that's at the top of my gripes list too. I'm pretty sure that >> Undo is even less functional in 6 than in 5.2. > > Undo seems kind of buggy in 6. I've lost things that just didn't go > back > to the way they were when I tried to Undo (after e.g. accidentally > pasting when I meant to copy). > >> Another shortcoming is the lack of AutoSave or AutoBackup capability. >> It's too easy to lose track of time, crash, and then discover that >> you haven't saved anything in 2 hours. (Or maybe its just dementia on >> my part.) > > I'm fairly obsessive about saving frequently, but I cannot for the > life > of me get my students to do it. A few times a semester, someone will > crash Mathematica at the very end of a class period when they are > taking > a quiz or exam, without having saved a thing. Built-in AutoSave > would be > nice to have. Would the NotebookAutoSave option work for you? http://reference.wolfram.com/mathematica/ref/NotebookAutoSave.html It saves the notebook after each evaluation, provided the notebook has been saved once already. (NotebookAutoSave has been around for several versions.) Brett Champion Wolfram Research