.1398 ==== Subject: Re: Don't understand behaviour of Solve[] Hi Oliver, Mathematica can not know what you consider to be a parameter and what a variable. If you do not specify a variable Mathematica takes it for a parameter. But then you have an overdetermined system without a generic solution. If you want the solution only for a fraction of variables you have to tell Mathematica to eliminate the rest by specifying a third \ argument. Example: Solve[{x + y == 3, x + 2 y == 5}, {x, y}] gives {{x -> 1, y -> 2}} Solve[{x + y == 3, x + 2 y == 5}, {x}] gives {} because Mathematica takes y \ now as a parameter, not a variable. You have 2 equations for 1 variable that do not have a generic solution. A solution only exists for a special value of y. If you only want a solution for x, you must tell Mathematica by the third argument: Solve[{x + y == 3, x + 2 y == 5}, {x}, y] gives {{x -> 1}} sincerely, Daniel > Hallo, > > I have a problem understanding the general behaviour of the Solve[] > function. > > I have a set of equations with the variables a,b,c,d and k. > > Evaluating Solve[set,k] or Solve[set,{a,b}] returns with {}, whereas \ Solve > [set,{k,b,c,d}] returns solutions for k,b,c and d. > > My question: Why does Solve returns no solution when searching only for k \ > for example and why is there a solution for several variables? I thought > that giving a list of variables just means that I want to search for all \ of > them. But the procedure doesn't seem to be independant from one variable \ to > another. > > What kind of information contains my list of variables except my wish to > solve for these? > > > Oliver friedrich > ==== Subject: Re: Finite differences and the advanced documentation of NDSolve[] does not help help you ? It is a wonderful clear document -- look into the part about PDE Jens \Claire David\ schrieb im > > I am searching a finite differences program for > the linear > Burgers equation. What does exist on the > subject? > > > C. David > ************************************************ > > Claire DAVID > > Laboratoire de Mod=E9lisation en M=E9canique > > Universit=E9 Paris VI > Bo=EEte courrier n=B0 162 > 4, Place Jussieu > 75005 PARIS > > Fax : (+33) 1.44.27.52.59 > > ************************************************ > > ==== Subject: Re: Set of strings reducing problem and thus spake Edson Ferreira [2005.07.07 @ 05:21]: > > > I have a problem that I haven't got any clue to solve with Mathematica. > > Let's say a have a list of \n\ equal length strings: [ ... ] here's an implementation of your approach. it's quite wordy, but i think it should work. first set up your string transformation rules, i'm using a throwaway symbol s[] to attach the rules to: s /: Plus[s[\1\], s[\X\]] = \D\; s /: Plus[s[\1\], s[\2\]] = \M\; s /: Plus[s[\1\], s[\U\]] = \T\; s /: Plus[s[\X\], s[\2\]] = \U\; s /: Plus[s[\X\], s[\M\]] = \T\; s /: Plus[s[\2\], s[\D\]] = \T\; s /: Plus[s[s1_String], s[s2_String]] := s1 the last rule is something i threw in to handle string combinations you didn't supply. you'll probably want to handle these differently. (* this is just UnsortedUnion from the help browser, see Union[] *) uniq[x_]:= Module[{f}, f[y_] := (f[y] = Sequence[]; y); f /@ x] (* this applies the string transformations iff the two lists differ in exactly one position *) stringReduce[l1_List, l2_List] := Module[ {t = Equal @@@ Transpose[{l1, l2}], p}, If[Count[t, False] == 1, p = Position[t, False][[1, 1]]; ReplacePart[l1, Plus @@ (s /@ {l1[[p]], l2[[p]]}), p], Sequence @@ {l1, l2} ] ] now, the trivial function that will actually do an iteration of the list: listReduce[l_List] := uniq[stringReduce@@@Tuples[l,2]] (* tuples is new in 5.1. if you don't have 5.1, you can use this: Flatten[Outer[List, l, l, 1],1] to achieve the same thing (those are two ell's and a one) *) finally, we can use FixedPoint to reduce the list until it can be reduced no more. I created a simple list of sample strings to test: alphabet = {\1\, \X\, \2\, \U\, \M\, \D\, \T\}; l = Flatten[{ {\1\, \1\, \1\, \1\, #, \1\, \1\, \1\}, {\2\, \1\, \1\, \1\, #, \1\, \1\, \2\}} & /@ alphabet, 1]; FixedPoint[listReduce,l]//ColumnForm {\1\, \1\, \1\, \1\, \1\, \1\, \1\, \1\} {\2\, \1\, \1\, \1\, \1\, \1\, \1\, \2\} {\2\, \1\, \1\, \1\, \X\, \1\, \1\, \2\} {\2\, \1\, \1\, \1\, \2\, \1\, \1\, \2\} {\2\, \1\, \1\, \1\, \U\, \1\, \1\, \2\} {\2\, \1\, \1\, \1\, \M\, \1\, \1\, \2\} {\2\, \1\, \1\, \1\, \D\, \1\, \1\, \2\} {\2\, \1\, \1\, \1\, \T\, \1\, \1\, \2\} {\1\, \1\, \1\, \1\, \D\, \1\, \1\, \1\} {\1\, \1\, \1\, \1\, \M\, \1\, \1\, \1\} {\1\, \1\, \1\, \1\, \T\, \1\, \1\, \1\} {\1\, \1\, \1\, \1\, \X\, \1\, \1\, \1\} {\1\, \1\, \1\, \1\, \2\, \1\, \1\, \1\} {\1\, \1\, \1\, \1\, \U\, \1\, \1\, \1\} In this simple case, only one pass is necessary. If you want to process the strings as they are in \221111X11\ form, you can simply slap in a call to Characters[] and StringJoin[]. -- /*------------------------------*\\ | stephen layland | | Documentation Programmer | | http://members.wri.com/layland | \\*------------------------------*/ ==== Subject: Re: Set of strings reducing problem one possibility is to use simple pattern matching: Mathematica 5.2 for Linux x86 (64 bit) Copyright 1988-2005 Wolfram Research, Inc. -- Motif graphics initialized -- In[1]:= !!ll L={\11111111\, \11112111\, \1111X111\, \21122211\}; cl=Characters/@L; r = Dispatch[{\1\ + \X\ -> \D\, \1\ + \2\ -> \M\, \1\ + \U\ \ -> \T\, \X\ + \2\ -> \U\, \X\ + \M\ -> \T\, \2\ + \D\ -> \T\ }]; ncl =StringJoin @@@ ( cl //. { x___List, {a___, p_String, c___}, {a___, q_String, c___}, y___List } :> { x, {a, p+q/.r,c}, y } /; StringQ[(p+q)/.r]) In[1]:= < compareString compares two strings and generates the desired string if > there is a single mismatch. Otherwise it generates {}. > > In[1]:= > compareStrings[a_String,a_String]:={}; > \ compareStrings[str1_String,str2_String]/;Equal[Length[str1],Length[str2]]:= > Module[{pos,chars1,chars2,thr,rules}, > rules={{\1\,\X\}|{\X\,\1\}:>\D\, \ {\1\,\2\}|{\2\,\1\} :> > > \ \M\,{\1\,\U\}|{\U\,\1\}|{\M\,\X\}|{\X\,\M\}|{\2\,\D\}|{\ \D\,\2\}:> > \T\,{\2\,\X\}|{\X\,\2\}:>\U\}; > chars1=Characters[str1]; chars2=Characters[str2]; > thr=Thread[{chars1,chars2}]; > pos=Position[thr,{a_,b_}/;b=!=a,{1},2]; > If[ Equal[Length[pos],2],{}, > > StringJoin[ReplacePart[chars1,Extract[thr,First[pos]]/.rules,pos]]]]; > > Note the last argument of Position. There is no need to search beyond > the second mismatch. > > > In[3]:= > compareStrings[\11112111\,\1111X111\] > Out[3]= > 1111U111 > compareStrings[\11112111\,\1111X121\] > Out[4]= > {} > > > It wasn't exactly clear what you meant by taking all transformations. > If you want to look at all possible pairs of the original strings, > generating a new string from a pair only if there is a single mismatch, > and then looking at the collection of all the generated strings, you > can: > > In[12]:= > \ genStrings[a_List]:=Flatten[compareStrings[#[[1]],#[[2]]]&/@Subsets[a,{2}]]; > > In[14]:= > \ origList={\11112111\,\1111X111\,\11111111\,\11112111\,\21122211\,\\ D1122211\}; > > In[15]:= > genStrings[origList] > Out[15]= > {1111U111,1111M111,1111D111,1111U111,1111M111,T1122211} > > - You gave at origList a set with two equal strings. This does not happen. \ The strings are all unique. - The different character, as you noticed, can ocurr at any position. - The length of all strings is the same. - In your example the expected result is: {\1111T111\,\T1122211\} The reason is because all I want is a reduced set of string, thus when you \ compare two strings and you find they differ by only one character, you \ ELIMINATE the original ones and ADD the NEW one to the original set. For instance : {\T11TTTTT\} would be generated from a set with 729 unique \ strings !!!!! I would be glad to get the shortest \joined\ elements list. I would like to thank all mathematica users for the great support!! Edson Ferreira __________________________________________________________________________ UOL Fone: Fale com o Brasil e o Mundo com at\.8e 90% de economia. http://www.uol.com.br/fone ==== Subject: Re: Problem with multiple function calling from a novice... Hello Sami. >Question 2: How can I modify an If...Then clause of the form: > >If[ , a;b;c;...etc.] >so that, again, they ALL show what they evaluate in turn? (Again, not >just >the >last one like in this case). One possible solution is to make a LIST of the commands. Compare the output form these two commands: If[True, a=5; b=a*2; c=b-4] If[True,{a1=5, b1=a1*2, c1=b1-4}] Bye! Jose Luis ==== Subject: Re: Install Issue with Ver 5.2 WinXp Unfortunately, yes, you need to manually remove the Beta version before installing the released version. Fortunately, this is a one-time occurance: Future versions will be able to upgrade in place with little to no user intervention, but we were of course not able to retroactively fix this problem in the Beta version once it was already out there. If you have any additional comments about the Notebook Indexers in general, I would be interested to hear them. Ian ==== Subject: Re: Problem with multiple function calling from a novice... responded right away (via email). You have been very helpful. Sami ==== Subject: Re: Problem with multiple function calling from a novice... > Hi all. I have a small problem, and I would like some help. > > Suppose I define a few functions, say a,b,c etc. > > Question 1: How can I call them from inside a program, so that they > ALL > show what they evaluate in turn? (Not just the last one, but each > one.) > > Question 2: How can I modify an If...Then clause of the form: > > If[ , a;b;c;...etc.] > > or a While loop: > > While[ , a;b;c;...etc.] > > so that, again, they ALL show what they evaluate in turn? (Again, not > just > the > last one like in this case). > > > Sami > Hi Sami, Qu.1: Print[a[],b[],c[]]; Qu.2: put them int a list: result=If[cond,{a[],b[],c[]}] You can use for instance result[[2]] to get the value of b[]. -- Peter Pein Berlin http://people.freenet.de/Peter_Berlin/ ==== Subject: Re: Problem with multiple function calling from a novice... > Hi all. I have a small problem, and I would like some help. > > Suppose I define a few functions, say a,b,c etc. > > Question 1: How can I call them from inside a program, so that they > ALL > show what they evaluate in turn? (Not just the last one, but each > one.) > > Question 2: How can I modify an If...Then clause of the form: > > If[ , a;b;c;...etc.] > > or a While loop: > > While[ , a;b;c;...etc.] > > so that, again, they ALL show what they evaluate in turn? (Again, not > just > the > last one like in this case). > > > Sami > Simply replace a;b;c with Print[a];Print[b];Print[c] Note that the Print command will evaluate its argument before it prints it. David Bailey http://www.dbaileyconsultancy.co.uk ==== Subject: Re: Problem with multiple function calling from a novice... > Hi all. I have a small problem, and I would like some help. > > Suppose I define a few functions, say a,b,c etc. > > Question 1: How can I call them from inside a program, so that they > ALL > show what they evaluate in turn? (Not just the last one, but each > one.) > > Question 2: How can I modify an If...Then clause of the form: > > If[ , a;b;c;...etc.] > > or a While loop: > > While[ , a;b;c;...etc.] > > so that, again, they ALL show what they evaluate in turn? (Again, not > just > the > last one like in this case). > > > Sami > Hi Sami, At least to methods come up in my mind. First, you can write your functions as usual and wrap them within a list in the body of the main function. In[1]:= Clear[f, g, h] In[2]:= f[x_] := x^2 + 2 In[3]:= g[x_] := Sin[x] In[4]:= h[x_] := Module[{}, {f[x], g[x], g[f[x]]}] In[5]:= h[Pi] Out[5]= {2 + Pi^2, 0, Sin[2 + Pi^2]} Second, to get more control on what the functions are displaying and to use them within a *If* or *While* loop, it is better to use some *Print* command within each function whenever you want to display some intermediate results. In[6]:= Clear[f, g, h] In[7]:= f[x_] := Module[{y}, y = x^2 + 2; Print[StringJoin[\f(\, ToString[x], \)=\, ToString[y]]]; y] In[8]:= g[x_] := Module[{y}, y = Sin[x]; Print[StringJoin[\g(\, ToString[x], \)=\, ToString[y]]]; y] In[9]:= h[x_] := Module[{}, f[x]; g[x]; g[f[x]]] In[10]:= h[2] \f(2)=6\ \g(2)=Sin[2]\ \f(2)=6\ \g(6)=Sin[6]\ Out[10]= Sin[6] In[11]:= main[x_] := Module[{i}, i = 2; While[i > 0, f[x]; g[x]; g[f[x]]; i--; ]] In[12]:= main[3] \f(3)=11\ \g(3)=Sin[3]\ \f(3)=11\ \g(11)=Sin[11]\ \f(3)=11\ \g(3)=Sin[3]\ \f(3)=11\ \g(11)=Sin[11]\ /J.M. ==== Subject: Re: Problem with multiple function calling from a novice... Hi Sami, To show what a function evaluates to, simply wrap it in a \Print\ statement. But note that the Print statement returns \Null\. Therefore, if you need the return value, either assigne it before the Print or use a temporary variable. Example: a[x_]:=2x; fun[]=:Module[{},Print[a[2]]; ] or fun[]=:Module[{t},Print[t=a[2]]; ] sincerely, Daniel > Hi all. I have a small problem, and I would like some help. > > Suppose I define a few functions, say a,b,c etc. > > Question 1: How can I call them from inside a program, so that they > ALL > show what they evaluate in turn? (Not just the last one, but each > one.) > > Question 2: How can I modify an If...Then clause of the form: > > If[ , a;b;c;...etc.] > > or a While loop: > > While[ , a;b;c;...etc.] > > so that, again, they ALL show what they evaluate in turn? (Again, not > just > the > last one like in this case). > > > Sami > ==== Subject: Re: Problem with multiple function calling from a novice... 1: a[x_]:=Module[{},Print[{\a is evaluated...\,x,x^2}];x^2] b[x_]:=Module[{},Print[{\b is evaluated...\,x,x^3}];x^3] c[x_]:=Module[{},Print[{\c is evaluated...\,x,x^4}];x^4] f[x_]:=Module[{},a[x]+b[x]+c[x]] 2: Do not use If, use Which or Switch. Just use the Help system (press the F1 key) to look, how they work... Peter Klamser >Hi all. I have a small problem, and I would like some help. > >Suppose I define a few functions, say a,b,c etc. > >Question 1: How can I call them from inside a program, so that they >ALL >show what they evaluate in turn? (Not just the last one, but each >one.) > >Question 2: How can I modify an If...Then clause of the form: > >If[ , a;b;c;...etc.] > >or a While loop: > >While[ , a;b;c;...etc.] > >so that, again, they ALL show what they evaluate in turn? (Again, not >just >the >last one like in this case). > > >Sami > > > > > ==== Subject: Re: Problem with multiple function calling from a novice... Use If[ , a;Print[a];b;Print[b];c;Print[c];...etc.] - Adel > Hi all. I have a small problem, and I would like some help. > > Suppose I define a few functions, say a,b,c etc. > > Question 1: How can I call them from inside a program, so that they > ALL > show what they evaluate in turn? (Not just the last one, but each > one.) > > Question 2: How can I modify an If...Then clause of the form: > > If[ , a;b;c;...etc.] > > or a While loop: > > While[ , a;b;c;...etc.] > > so that, again, they ALL show what they evaluate in turn? (Again, not > just > the > last one like in this case). > > > Sami > > -- Adel ==== Subject: Re: Problem with multiple function calling from a novice... If[True, {a=1,b=2,c=3},{a=2,b=4,c=6}] {1,2,3} If[False, {a=1,b=2,c=3},{a=2,b=4,c=6}] {2,4,6} Bob Hanlon > ==== > Subject: Problem with multiple function calling from a novice... > > Hi all. I have a small problem, and I would like some help. > > Suppose I define a few functions, say a,b,c etc. > > Question 1: How can I call them from inside a program, so that they > ALL > show what they evaluate in turn? (Not just the last one, but each > one.) > > Question 2: How can I modify an If...Then clause of the form: > > If[ , a;b;c;...etc.] > > or a While loop: > > While[ , a;b;c;...etc.] > > so that, again, they ALL show what they evaluate in turn? (Again, not > just > the > last one like in this case). > > > Sami > > ==== Subject: SeedRandom and $SessionID Hi Everyone, I'm doing some Monte-Carlo simulations on a cluster. Since by default the random number seed is based on the system time, I sometimes get the same seed being used in multiple Kernels if they're launched simultaneously from a shell script (something to avoid). Is there any danger in using $SessionID as the random number seed? Also, does anyone know the bounds on $SessionID (compared to the bounds on the random number seed) are and whether the processID is included in the calculation of $SessionID? Alternatively, has anyone worked out a good way to seed the random number generator in Mathematica? -Kerry Kim ==== Subject: Re: GroebnerBasis (was Re: Documentation) > > [...] > I have notized that in Mathematica 3.0 and Mathematica 5.0, > GroebnerBasis sometimes gives different results. Where 3.0, when > eliminating, gives a polynomial with very large coefficients, 5.0 > gives the empty set, although that's incorrect, probably due to > numerical cancellation, quite unexpectedly. > As an example, in Mathematica 5.0 > GroebnerBasis[{x - y, x - 1.01 y}, {y},{x}] > gives {1. y} while > GroebnerBasis[{x - y, x - 1.001 y}, {y},{x}] > gives {}. > The correct Groebner Basis, after elimination of x is of course {y}. > Likewise > GroebnerBasis[{x - y, x - 1.01 y}, {x, y}] > gives the correct {1. y, x} while > GroebnerBasis[{x - y, x - 1.01 y}, {x, y}] > gives the incorrect {x - 1.001 y} Interesting... > Though, if you add CoefficientDomain->Rationals, things works out quite > a bit better. (Default seems to be CoefficientDomain->InexactNumbers). Strictly speaking the default is Automatic, and in presence of approximate numbers that behaves as InexactNumbers. > Should really cancellation errors occur at this level of accurancy? Probably not. I'm changing a couple of values to better handle that. But I should mention that Groebner bases and machine arithmetic do not get along well, and, in my opinion, perhaps never will, at least not when the latter uses any variant of the Buchberger algorithm. To get better results you might work with bignums in significance arithmetic. The reason this si vastly preferable is that one need not impose artificial constants for \guessing\ when something should be regarded as zero. Instead the arithmetic model will tell you when you are really in a neighborhood containing zero vs. having values that might (or might not) be deemed \small\; this is usually problem specific. Even with low precision bignums we get a reasonable result for the example below. In[5]:= GroebnerBasis[{x - y, x - N[1001/1000,8]*y}, {x,y}] Out[5]= {1.0000 y, x} > I agree with Andrzej that the different CoefficientDomains should be > more documented, and so the risk of inaccuracy in the default setting. > > Stefan Karlsson > Sk\.9avde University, Sweden I think the more important thing to document is that machine arithmetic does not cooperate well with Groebner bases, at least as currently implemented in Mathematica. Daniel Lichtblau Wolfram Research ==== Subject: MultiLink.exe, MultiLinkServer.exe What are the files MultiLink.exe and MultiLinkServer.exe that I find in the root Mathematica 5.1 program directory? Are they part of the Mathematica 5.1 distribution? Or from some 3rd party Add-on? -- 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: GraphEdit.m & JavaGraphics.m What are the packages GraphEdit.m and JavaGraphics.m that I find in the directory \ ToFileName[{$InstallationDirectory,\SystemFiles\,\Graphics\,\Packages\}\ ] of Mathematica 5.1? Are they part of the Mathematica 5.1 distribution? Or from some 3rd party Add-on? -- 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: GraphEdit.m & JavaGraphics.m > What are the packages GraphEdit.m and JavaGraphics.m that I find in the > directory > \ ToFileName[{$InstallationDirectory,\SystemFiles\,\Graphics\,\Packages\}\ ] > > of Mathematica 5.1? > > Are they part of the Mathematica 5.1 distribution? Or from some 3rd > party Add-on? Hi Murray, Both _GraphEdit.m_ and _JavaGraphics.m_ packages are part of Mathematica standard installation. _GraphEdit.m_ is said to \render graphics with V5 front end,\ and contains two functions: *SetGraphics* and *ResetGraphics*. The usage massages read, respectively: \SetGraphics[type] sets the type of graphics cells generated by graphics commands. \\\type\\\ may be \\\SymbolicGraphics\\\, \\\PostScript\\\, \ or \\\Compare\\\\, and \ResetGraphics[] restores the display function used before the GraphEdit package was loaded.\ According to the *ReadMe.txt* file located in the packages directory: \This directory contains files called by version-specific init.m files. Most of them set up the correct mode for display of graphics on different machines. [...] JavaGraphics.m : send graphics to Java window.\ /J.M. ==== Subject: Complement replacement hi in the list: pp=Table[Random[Integer, {1, 1000}], {i, 1000}]; how could i know which numbers from 1 to 1000 does not exist in the pp List. but without using: Complement[Table[i,{i,1000}],pp] ==== Subject: NotationPalette with Ersek's SubscriptSymbols package I'm having trouble with the function NotationPalette[] from Ted Ersek's SubscriptSymbols package. I installed the package in directory ToFileName[{$TopDirectory, \AddOns\, \ExtraPackages\, \Utilities\}] per instructions (including creating the package file from notebook SubscriptSymbols.nb). But I had to edit the definition in it of function NotationPalette[] to become: NotationPalette[] := ( NotebookOpen[FrontEnd`FileName[ {$TopDirectory, \AddOns\, \ExtraPackages\, \Utilities\, \ Palettes\, \English\}, \NotationPalette.nb\] ];) so as to use the correct location for NotationPalette.nb under Mathematica 5.2. (This is the correct place with Mathematica 5.1, as \ well.) After loading SubscriptSymbols` in the normal way, if I evaluate NotationPalette[] I get an error message, \The file you tried to open was not found, or could not be opened.\ However, if I directly evaluate in an input cell the expression NotebookOpen[FrontEnd`FileName[ {$TopDirectory, \AddOns\, \ExtraPackages\, \Utilities\, \ Palettes\, \English\}, \NotationPalette.nb\] ]; then I do get the NotationPalette to open. -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 ==== Subject: Mathematica: how to set the format of binary numbers in plotting? I use BinaryReadList[filename, \Integer16\] to bring in an array of numbers. I then do a bunch of operations on these numbers and then try to plot them. They should be signed integers and interpreted in 2's complement but apparently they have been converted to unsigned binary as far as I can tell -- and the plots are horrible. Can someone tell me how you can specify the interpretation (signed or ==== Subject: Re: Updated my RootSearch package Finally, one last message (sorry for the apparent spamming). I -- having never had to do it before, but it worked -- finally deleted the warning at the top of RootSearch.m, to the effect that one should never edit the file, as it'll be saved anew each time the \parent\ notebok is run. Even though that particular text is in \comment\ed code (that is, enclosed in matching (* pairs ), it apparently does something, as upon its deletion, the package does just as it's supposed to, even on my linux installation. Hopefully, this will help someone else someday; it has me! Curtis Osterhoudt > > First, thank you for your work over the years on Mathematica. I'm a >relatively new user of Mathematica, but I'm always happy when I notice >that you've given some input (or, better, a notebook or package) about a >problem. > I've downloaded and installed your new RootSearch.m file, and am >trying to run the examples notebook. The package is correctly installed >and loads correctly (I think) because I can query its various functions; >in addition, if I call RootSearch on a function, there are no errors >generated. However, even in the cases in your example notebook, >RootSearch returns empty lists where it should return the roots of the >functions. I will go through the RootSearch.m file in a bit more detail >later, to see what I'm doing wrong, or if there is an extra semicolon >somewhere (or something!) but wanted to post this in case there's a >quick fix. > > Curtis O. > > > > >>I just updated my RootSearch package which is posted on MathSource. >>You can get it from >> http://library.wolfram.com/infocenter/MathSource/4482/ >> >>The new version is more robust. >> >> Ted Ersek >> reply to: ted.ersek@navy.mil >> >> >> >> >> >> >> > > > -- PGP Key ID: 0x235FDED1 Please avoid sending me Word or PowerPoint attachments. http://www.gnu.org/philosophy/no-word-attachments.html ==== Subject: Re: Updated my RootSearch package Earlier I posted a message about not getting Ted's updated RootSearch package to work. I'm sorry I did -- it works just fine on my Windows installations of Mathematica (I'd tried it on a linux installation). I'll have to check and see what I was doing wrong before; the package is a gem! Curtis O. >I just updated my RootSearch package which is posted on MathSource. >You can get it from > http://library.wolfram.com/infocenter/MathSource/4482/ > >The new version is more robust. > > Ted Ersek > reply to: ted.ersek@navy.mil > > > > > -- PGP Key ID: 0x235FDED1 Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html --------------050208000204080005030703 filename=\gardyloo.vcf\ begin:vcard fn:Curtis Osterhoudt n:Osterhoudt;Curtis email;internet:gardyloo@mail.wsu.edu note: PGP Key ID: 0x235FDED1 version:2.1 end:vcard --------------050208000204080005030703-- ==== Subject: Re: Updated my RootSearch package First, thank you for your work over the years on Mathematica. I'm a relatively new user of Mathematica, but I'm always happy when I notice that you've given some input (or, better, a notebook or package) about a problem. I've downloaded and installed your new RootSearch.m file, and am trying to run the examples notebook. The package is correctly installed and loads correctly (I think) because I can query its various functions; in addition, if I call RootSearch on a function, there are no errors generated. However, even in the cases in your example notebook, RootSearch returns empty lists where it should return the roots of the functions. I will go through the RootSearch.m file in a bit more detail later, to see what I'm doing wrong, or if there is an extra semicolon somewhere (or something!) but wanted to post this in case there's a quick fix. Curtis O. >I just updated my RootSearch package which is posted on MathSource. >You can get it from > http://library.wolfram.com/infocenter/MathSource/4482/ > >The new version is more robust. > > Ted Ersek > reply to: ted.ersek@navy.mil > > > > > -- PGP Key ID: 0x235FDED1 Please avoid sending me Word or PowerPoint attachments. http://www.gnu.org/philosophy/no-word-attachments.html ==== Subject: Updated my RootSearch package I just updated my RootSearch package which is posted on MathSource. You can get it from http://library.wolfram.com/infocenter/MathSource/4482/ The new version is more robust. Ted Ersek reply to: ted.ersek@navy.mil ==== Subject: Re: Wrong Integral result for a Piecewise function > > If you try instead > > > g[x_] = FullSimplify[Integrate[UnitStep[2y + 2z - (x - 1)]*UnitStep[x > - 2y - 2z], {y, 0, 1}, {z, 0, 1}]] > > (this takes a while to complete) then > > Plot[g[x],{x,0,5}] > > looks correct. Also > > In[18]:= > NIntegrate[g[x], {x, 0, 5}] > > Out[18]= > 1. > > In[19]:= > Integrate[g[x], {x, 0, 5}] > > Out[19]= > 1 > > This, of course, is the pre-Mathematica 5 way of doing these things > which only goes to confirm that progress is not always improvement ;-) > > Andrzej Kozlowski > Chiba, Japan > In version 5.1.0 this gives an answer which is correct everywhere except at the integer points: In[1]:= g[x_] = Integrate[UnitStep[2*y + 2*z - x + 1]*UnitStep[x - 2*y - 2*z], {y, 0, 1}, {z, 0, 1}] Out[1]= (1/8)*(2*(-1 + (-2 + x)*x)*UnitStep[1 - x] + 2*(-2 + x)^2*UnitStep[2 - x] + 2*(-2 + x)*x*UnitStep[2 - x] - 2*(7 + (-6 + x)*x)*UnitStep[3 - x] - (-5 + x)*UnitStep[5 - x]*(6 - 2*x + (-1 + x)*UnitStep[-3 + x]) + UnitStep[4 - x]*(-4*UnitStep[1 - x/2] + (-4 + x)*(4 - 2*x + x*UnitStep[-2 + x])) + (-3 + x)*UnitStep[3 - x]*(2 - 2*x + (1 + x)*UnitStep[-1 + x]) - 2*(-2 + x^2)*UnitStep[-x] - (-4 + x^2)*UnitStep[2 - x, x]) In[2]:= Reduce[g[x] != If[x == 3, 3/8, 0] + If[0 < x < 1, x^2/8, 0] + If[1 <= x <= \ 2, (1/8)*(-1 + 2*x), 0] + If[2 < x < 3, (1/8)*(-9 + 10*x - 2*x^2), 0] + If[Inequality[3, Less, x, LessEqual, 4], (1/8)*(9 - 2*x), 0] + If[4 < x < 5, (1/8)*(-5 + x)^2, 0]] Out[2]= x == 0 || x == 1 || x == 2 || x == 3 This is always a potential pitfall when the answer is returned as a sum of \ UnitStep terms, e.g. as UnitStep[-x] + (x + 1)*UnitStep[x]. It is likely that the value at x = 0 will be incorrect, because both terms are equal to \ 1 at zero, not just one of them. Thus Limit[g[x], x -> 0] is correct but g[0] isn't. Maxim Rytin m.r@inbox.ru