I have created a mathematica notebook which is rather large and if one wants to run certain cells one has to run a various number of cells throughout the notebook first. Now I wish to link certain groups of cells throughout the notebook so that running a cell, automatically runs a selection of other cells first. How can i do this? ==== Given a matrix M, where all entries come from the ring S=Z[X]/(f(X)) where f(X) is an irreducible polynomial, is it possible in mathematica to compute the nullspace of this matrix in this ring S. I can't find this anywhere. ==== Dear Mr. Abbot I am afraid I was not so much clear. Let me try to explain again my problem: For example, I have the following set of Mathematica cells: Cell 1: Cell[BoxData[[IndentingNewLine]], NumberedEquation] Cell 2: Cell[BoxData[[IndentingNewLine]], NumberedEquation, CellTags->Eqtwo] Cell 3: Cell[TextData[{ See (, CounterBox[NumberedEquation, Eqtwo], )n }], Text] Cell 4: Cell[TextData[{ See , ButtonBox[(0), ButtonData:>Eqtwo, ButtonStyle->Hyperlink], n }], Text] My problem is shown on Cell 4. I got this cell when I try to hyperlink the dynamic referenced equation given in Cell 3. In doing so, I use the following steps: - selected the equation number (i.e the string (2) in the cell 3) - Used the commands Input/Create hyperlink- Cell with tag: Eqtwo Instead of having a hyperlinked number (2) (what I really want), I got a hyperlinked (0). Hope now, you can tell me the solution, With best wishes, Alexandre Costa ==== I've running into problems getting functions of some add-on packages to evaluate. When I run the function, the answer is in unevaluated form, and doing Evaluate[...] doesn't help. Here's an example. < a=ListContourPlot3D[data3d1,Contours->{0}] b=ListContourPlot3D[data3d2,Contours->{0}] then I would like to find intersections where a=b) uses a sort of solve to find the intersections). But for Contours found by ListContourPlot3D the equations of the surfaces are not known. Does anyone have an idea on how to find these intersections? Maybe look at the Polygons in the ContourPlot? All suggestions are welcome ==== I am working on a project investigating the Pell equation x^2-d*y^2=1, where I calculate the values of d keeping y constant and determining the periodic behaviour of x and d. I have found using Mathematica most useful to find the integer values of x and d. However, when I use Table[{(x^2-1)/y^2},{x,n,m}], it lists all the rational fractions over the complete range of n to m which I choose, where I am interested only in getting the Integer values of x and d while y is kept constant for one set of calculations. I wonder if it is possible for someone to advise me on how I must change my Table listing to only give the Integer values of x and d. I have tried several changes but none worked. Alfonso Burgers ==== Dear all, I am computing a few complex matrix exponentials for some Fourier transforms, and I keep getting the same kind of result that I cannot understand. As an example: ============================= A) I can get the eigenvalues of the matrix..... IN: {{-1.850-1.993 [ImaginaryI], -0.438-0.741 [ImaginaryI]},{-0.00919+0.01696 [ImaginaryI],-10.80+0.938 [ImaginaryI]}} // Eigenvalues OUT: {-10.8017 + 0.937514 [ImaginaryI], -1.84831 - 1.99251 [ImaginaryI]} ============================= B) I can also get the eigenvectors of the matrix......... and they are apparently distinct. IN: {{-1.850-1.993 [ImaginaryI], -0.438-0.741 [ImaginaryI]},{-0.00919+0.01696 [ImaginaryI],-10.80+0.938 [ImaginaryI]}} // Eigenvectors OUT: {{0.0196355 + 0.0888622 [ImaginaryI], 0.99585+ 0.[ImaginaryI]}, {0.999998+0.[ImaginaryI], -0.00148745 + 0.00140766 [ImaginaryI]}} ============================= C) But not the exponential, although they are related. IN: {{-1.850-1.993 [ImaginaryI], -0.438-0.741 [ImaginaryI]},{-0.00919+0.01696 [ImaginaryI],-10.80+0.938 [ImaginaryI]}} // MatrixExp OUT: Dot::inf: Input matrix contains an infinite entry. Dot::inf: Input matrix contains an infinite entry. [Infinity]::indet: Indeterminate expression (0.+0.[ImaginaryI]) ComplexInfinity encountered. Dot::mindet: Input matrix contains an indeterminate entry. Inverse::inf: Input matrix contains an infinite entry. {{Indeterminate, Indeterminate},{0.00477109+ 0.00196731[ImaginaryI],0.000017144-0.0000126169[ImaginaryI]}}.Inverse[{{ ComplexInfinity, 0}, {0, 1}}] ============================= I am not sure which one of the many dubious ways Mathematica uses for its MatrixExp calculations. Could someone enlighten me? I have observed that it happens as the element differences become larger, although in the above example I would not say they are that large. Is it that matrices need some rebalancing before they are inserted in the MatrixExp[] function? Best Kyriakos. _______________________________________ Kyriakos Chourdakis Lecturer in Financial Economics University of London Queen Mary London E1 4NS URL: http://www.qmul.ac.uk/~te9001 Tel Wk: +44 207 7882 5086 Tel Mb: +44 793 140 1304 _______________________________________ ==== I have questions about the BuckyMatrix notebook at http://www.mathsource.com/cgi-bin/msitem?0212-072 First, I wonder how the formatting is achieved. Second, I'm wondering the purpose of the undefined symbol mz in the early expressions. For instance, if mz is undefined then bm=(B@@#1&)/@mz/@Transpose[m] is equivalent to the much simpler B/@Transpose[m] and e=B@@mz[{5,6}] is equivalent to e=B[{5,6}] Ooh! Now I see! The symbol is defined near the bottom of the notebook, AFTER it's used. Not a good idea, perhaps... it certainly confused ME! Bobby Treat Dr. Bobby Treat Survey Sampling: http://www.bus.utexas.edu/courses/msis/sta376/ OR Models: http://www.me.utexas.edu/~treatb/ Austin INFORMS: http://www.me.utexas.edu/~informs/ -----Original Message----- solved the same way. I have been told some of it is not new. Can anyone tell me the name of a book or web site about something like B numbers and the Synergetics coordinate system? Cliff Nelson ==== Following up my message, I became interested in seeing if it would be difficult to modify PolynomialQ so that it would return answers that appear to be mathematically more sensible. While I have spent very little time on this the follwoing function: MyolynomialQ seems to me to do just that: MyPolynomialQ[expr_, {l___, g_[f___, Power[a_, -b_.], h___], m___}] := PolynomialQ[ PowerExpand[expr /. a -> a^-1], {l, g[f, Power[a, b], h], m}]; MyPolynomialQ[expr_, {l___, Power[a_, -b_.], m___}] := PolynomialQ[PowerExpand[expr /. a -> a^-1], {l, Power[a, b], m}]; MyPolynomialQ[expr_, x_] := MyPolynomialQ[expr, {x}]; MyPolynomialQ[a_, v_List] := PolynomialQ[a, v]; Now we get: In[5]:= MyPolynomialQ[x^-1,x^-1] Out[5]= True In[6]:= MyPolynomialQ[x^-a,x^-a] Out[6]= True In[7]:= MyPolynomialQ[x,Sqrt[x]] Out[7]= True In[8]:= MyPolynomialQ[1/x,Sqrt[1/x]] Out[8]= True while in other cases it works just as PolynomialQ. Seems pretty simple. Any caveats? Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ > The following strange behaviour of PolynomialQ has been recently > observed on the Japan Mathematica Users mailing list: > > In[1]:= > PolynomialQ[1/x,1/x] > > Out[1]= > False > > To see that this is odd compare: > > In[2]:= > PolynomialQ[x,Sqrt[x]] > > Out[2]= > True > > with > > In[2]:= > PolynomialQ[1/x,Sqrt[1/x]] > > Out[2]= > False > > or, more generally > > In[4]:= > PolynomialQ[x^a,x^a] > > Out[4]= > True > > while > > In[5]:= > PolynomialQ[x^-a,x^-a] > > Out[5]= > False > > It certainly makes no mathematical sense and looks like a bug. > > A possibly related curiosity is that PolynomialQ returns an answer when > no variables are specified, though it is rather unclear if this is > intended or a side-effect of something (this behaviour does not seem > to be documented). Again we see things like: > > In[6]:= > PolynomialQ[2^-x] > > Out[6]= > True > > In[7]:= > PolynomialQ[x^-2] > > Out[7]= > False > > In[9]:= > PolynomialQ[x^y] > > Out[9]= > True > > In[10]:= > PolynomialQ[x^-y] > > Out[10]= > False ==== 1) After the following input, I would expect the output TRUE, since after my mathematical understanding, the expression is unambiguously negative. Mathematica, however, only restates the expression. Element[{a, b, n, m}, Reals] Simplify[-m^(-2 + a + b + n)*(-1 + a + b + n)*(a/(a + b + n))^a *((b + n)/(a + b + n))^(b + n)*(a + b + n) < 0, {a > 0, b > 0, n > 0, a + b + n > 1}] 2) The second problem may be similar. Given the restriction on the parameter values, the following equation should can be solved for m: Element[{a, b, n, m}, Reals] Solve[a/(a + b + n) - m^(-1 + a + b + n)*(a/(a + b + n))^a *((b + n)/(a + b + n))^(b + n)*(a + b + n) == 0, m] Does somebody see what I am doing wrong? Hannes ==== In Mathematica version 2.x I used to be able to modify the postscript code of a Mathematica generated graph by: 1) Selecting the cell containing the graph and going to Cell -> Formatted to un- check the Formatted option which would immediately display the postscript code in lieu of the graph 2) Modify the code 3) Undo-ing step 1 by going to Cell -> Formatted again 4) Going to Graph -> Render PostScript to have my changes take affect Is this possible in Mathematica version 3.x? Any help would be appreciated! Terry ==== Jack, There is the standard package, Miscellaneous`RealOnly`, which can be loaded. But a better package, especially when dealing with solutions to equations, is Ted Erseks's SwitchableRealOnly`, which can be obtained from MathSource. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ > I would like to know if there is a possibility to tell Mathematica, > that I am only interested in real valued solutions, respectively that > some parameters and variables can only real valued. > > It would be comfortable if one could give this information at the > beginning of a Mathematica notebook and at each command. > Jack > ==== Mg, I would like to be able to set colors of the sunlit and shaded areas in the Scientific Astronomer package, and in the PlanetPlot, PlanetPlot3D commands in particular. I would like to have a full control over the FrameLabels in the PlanetPlot command as well. Thank you. Sincerely, andy@radio4u.com ==== > > > > In[1]:= > ExpandedCollect[expr_, vars_, h_:Identity] := > Module[{sub}, Expand[Collect[expr, vars, sub]] /. > sub -> h] > Thank you very much (and to the other Helpers too). After some consideration and a glimpse into the Help, I see how this works - its what I needed and a bit more :) Detlef ==== >I am a mathematica newbie. I have a first order equation that >describes the amount of a compound at time t, it is a periodic system >and the compound is either present or not (a step function): > >dA(t)/dt=S(t)-ln(2)/halflife*A(t) > >S(t) = S if T1S(t) = 0 otherwise > >Does anybody have an idea how I would solve this using mathematica to >obtain the formal solution. I would really appreciate any >suggestions!! Thankyou!! > eqn = (A'[t]== S*(UnitStep[t-t1]-UnitStep[t-t2])-Log[2]/halflife*A[t]); soln = DSolve[eqn, A[t], t]// Flatten//FullSimplify with a boundary condition soln = DSolve[{eqn,A[0]==0}, A[t], t]//Flatten//FullSimplify Bob Hanlon Chantilly, VA USA ==== > If you want to classify single events to predefined bins - especially if you > have got many bins - you may use binary search, instead of linearly scanning > the list of values delimiting the bins: Note that BinarySearch is included in the DiscreteMath`Combinatorica` package. Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia (CRICOS Provider No 00126G) Crawley WA 6009 mailto:paul@physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul ____________________________________________________________________ ==== See if the following helps. I tried to do things in the way that is easiest to visualize. It probably is not the most elegant or efficient way. Adam Smith In[18]:= Needs[Statistics`NonlinearFit`] Define a function for the data In[19]:= f[x_] := 1000*E^(-0.25*x)+10 Now create a list of perfect data without any error In[20]:= perfectdata=Table[{x, f[x]}, {x, 0,20, 0.5}]; Now create a list of data with a random error that is +/- the square root of the perfectdata. There are more elegant ways in Mathematica to do this, but this seems the easiest to understand. In[21]:= data = Table[{x, f[x]+Sqrt[f[x]]*Random[Real,{-1,1}]}, {x, 0, 20, 0.5}]; Now create a list of weights based on the noisy data. I choose to weight by the square root of the number (statistical weighting). In[22]:= mywts = Table[ data[[i,2]]^.5,{i,1,Length[data]}]; This next one is just a test for all the weights being equal - the default in NonlinearFit. In[23]:= equalwts = Table[ 1,{i,1,Length[data]}]; This is just to visualize the two data sets. In[24]:= plot1 = ListPlot[data,PlotStyle->PointSize[0.018]]; ListPlot[perfectdata,PlotStyle->PointSize[0.018]]; Define the model that I want to fit In[26]:= fmodel[a_, b_,c_][x_] := b*E^(-a*x)+c; Try the default with the default weighting In[27]:= NonlinearRegress[data, fmodel[a, b,c][x], {x}, {a, b,c}, RegressionReport ->{BestFitParameters}] Out[27]= {BestFitParameters ->{a->0.243643,b->997.273,c->6.67955}} Now check my equal weighting list. It should give the same as above. Examination shows this is true. Using RegressionReport->{BestFitParameters, ParameterCITable} reveals that the uncertainties in the parameters differ for different weighting also. I just left them off because they don't translate well into asii text. In[28]:= NonlinearRegress[data, fmodel[a, b,c][x], {x}, {a, b,c}, RegressionReport->BestFitParameters},Weights->equalwts] Out[28]= {BestFitParameters->{a->0.243643,b->997.273,c->6.67955}} Now try the weighting function I created above and named mywts. Note the changes from the above non-weighted parameters. In[29]:= NonlinearRegress[data, fmodel[a, b,c][x], {x}, {a, b,c}, RegressionReport->{BestFitParameters},Weights->mywts] Out[29]= {BestFitParameters->{a->0.239198,b->997.654,c->2.38525}} There is another way using a pure function that avoids manually constructing the list of weights. In[30]:= NonlinearRegress[data, fmodel[a, b,c][x], {x}, {a, b,c}, RegressionReport->{BestFitParameters},Weights->(Sqrt[#]&)] Out[30]= {BestFitParameters->{a->0.239198,b->997.654,c->2.38525}} The following checks the last method by plotting the fit function over the data. plot1 is defined above and is just the noisy data. In[31]:= ffit[x_] = fmodel[a, b,c][x] /. (BestFitParameters /. %) plot2 = Plot[ffit[x], {x, 0, 12}]; Show[plot1, plot2]; > > It seems I have an identical problem to Frederic Fontaine dated 22 Jun > 1999 that didn't get answered in the threads. > > I'm ALSO having troubles with the syntax of the Weights option in > NonlinearRegress. I want to input an equation not simply values. > I'm not a member of this list so Im not sure if this will get back to me > either... > I'd appreciate any help, for ease I have cut and pasted his eloquent > version... > > > NonlinearRegress, Weights, Syntax > > > I've been fighting against the syntax of the option Weights in the > NonlinearRegress command. I want to fit large data sets and I don't want > to type hundreds of values. I'd rather use a function defining the weight > of each data points. But how to do it with Mathematica 3 for Unix? > For instance: > NonlinearRegress[dataset, fitfunction(x,para),{x},{para},Weights->{???}] > I would appreciate someone helping me remove the question marks! > > **Edited from F.F.** > > Dion Lewis > University of Tasmania > Physics Department