Subject: Re: Converting Mathematica to MS Word > I have written a technical paper in Mathematica and the publisher has > requested > it be sent in MS Word! (yes, I am rolling my eyes as well). Is this > sort of thing even remotely possible? Have you checked whether they'll not accept an Acrobat (.pdf) file with good enough resolution (eg 1200 or 2400 dpi)? Often they will. And it would look exactly the same. HTH Marc -- Marc Heusser (remove the obvious: CHEERS and MERICAL...until end to reply via email) === Subject: PartitionsP The implementation of PartitionsP uses Euler's pentagonal formula for small n, and the non-recursive Hardy-Ramanujan-Rademacher method for larger n. Does anyone know what large means? I speculate that it's n>5000. --Robert === Subject: Mathematica and TeX I've been trying to generate TeX files from my notebooks, but the result is not as I would like to see it. The resulting ps or pdf layout is not good. It has overfull hboxes and vboxes: the text is not wrapped properly. Is this some setting in Mathematica that I should change? Or do I need to use a different stylesheet for TeX? (I noticed that with saving to HTML it has the same behaviour.) The question thus is: how can I make sure text in a notebook is word wrapped over lines when exporting to TeX or HTML? Erik === Subject: Re: Another bizarre phenomenon >>I had no idea that an expensive, professional-level >>program would have such obvious bugs. > The only obvious bugs are reproducible ones. If you can reliably > reproduce the buggy behaviour you have encountered report it to WRI and > they will most likely fix it. I have sent them notebooks with the bug in place. And this isn't some obscure little bug, this is a dagger right in the heart of the front end if you ever use comments or colored fonts or other slightly non-plain vanilla code. They know about it, because when we presented at the last Mathematica conference we told them again and again. And they haven't fixed it. === Subject: Question about Gomory-Cut for an application I have to find an integer solution. I use the simplex-algorithm and the Gomory-cut. It works fine, but it is to slowly. There are multiply opportunities to make a Gomory-cut. Which Gomory-cuts should I take, to get a solution in shortest time ? Where can I get information about that (in the internet) ? Ulrich === Subject: Null entry in a Graphics list? Is there a Null or a None for Graphics? If I want to accomplish something like g1 = Graphics[---]; g2 = Graphics[---] g3 = If[test, Graphics[---], NoGraphics ]; Show[g1, g2, g3 ]; is there something I can put in for NoGraphics (other than an offscreen Point or a zero-size Point or . . . ) that will be acceptable in subsequent graphics commands === Subject: Re: Null entry in a Graphics list? This is what you want: g3=If[test, Graphics[---], Graphics[{}] ]; Steve Luttrell > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands === Subject: Re: Null entry in a Graphics list? > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands Simply using Graphics[{}] seems to work fine. I was not sure if Mathematica would 'like' a graphical object like that which contains absolutely nothing on which to determine a scale - but it seems to understand! David Bailey === Subject: Re: Null entry in a Graphics list? and the rule NoGraphics :> Sequence[] does not work ? Jens AES/newspost schrieb im Newsbeitrag > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands === Subject: Graphics and Random[] questions Hi Everyone, Well I have 2 questions: 1) I have a notebook which involves manipulating 3d plots. However everytime I run the notebook, after a while I get some kernel errors, and the mathematica kernel just quits. It crashs after a while and does not finsih evaluating all the cells. Is there a problem with my computer? or is it because of the limitation to process (huge amount of) graphics by Mathematica? 2) Random[Real, {-4,4}] gives a uniform distribution. However if I would like to have a binomial distribution or any other kind of distribution, would this be possible as well? If so then how is it done? Namrata Khemka === Subject: Re: Graphics and Random[] questions > 1) I have a notebook which involves manipulating 3d plots. However > everytime I run the notebook, after a while I get some kernel errors, > and the mathematica kernel just quits. It crashs after a while and > does not finsih evaluating all the cells. Is there a problem with my > computer? or is it because of the limitation to process (huge amount > of) graphics by Mathematica? hard to tell without seeing the code... > 2) Random[Real, {-4,4}] gives a uniform distribution. However if I > would like to have a binomial distribution or any other kind of > distribution, would this be possible as well? If so then how is it > done? from the help file. In[2]:= < schrieb im Newsbeitrag > Hi Everyone, > Well I have 2 questions: > 1) I have a notebook which involves manipulating 3d plots. However > everytime I run the notebook, after a while I get some kernel errors, > and the mathematica kernel just quits. It crashs after a while and > does not finsih evaluating all the cells. Is there a problem with my > computer? or is it because of the limitation to process (huge amount > of) graphics by Mathematica? > 2) Random[Real, {-4,4}] gives a uniform distribution. However if I > would like to have a binomial distribution or any other kind of > distribution, would this be possible as well? If so then how is it > done? > Namrata Khemka === Subject: Re: closing notebook cells > As I learned in mathgroup a few years ago I am using the following code > to close automatically my graphics groups. > CloseAnim[]:=(SelectionMove[EvaluationNotebook[],All,GeneratedCell]; > FrontEndTokenExecute[OpenCloseGroup];); > CloseAnim::usage = CloseAnim[]; > For example: > Table[Show[Graphics[ > {Hue[Random[] ],Rectangle[{0,0},{1,1}] > }]],{3}]; > CloseAnim[]; > The problem is that when I only generate a single cell OpenCloseGroup > will generate a beep. > Any idea on how to prevent that beep or test if GeneratedCell selected a > single or several cells? > Luc LinkWrite[$ParentLink, CellInformation[EvaluationNotebook[]]]; Length[LinkRead[$ParentLink]] If the length is greater than 1, then you can use the OpenCloseGroup token. CellInformation[] is new to version 5 and is, in general, a very good way to test various properties of the selection without having to do a NotebookRead[] (which could get very expensive if you have a selection which consumes a lot of memory). John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. === Subject: Re: Univers font for PDF files Unzip the files to your HD, and then copy them one by one to your fonts directory. >I need help, i was able to download the zip file containing the >univers fonts. Then what? >If anyone still needs it: >>href=http://vbnet.mvps.org/files/misc/univers.zip>http://vbnet.mvps.org/ files/misc/univers.zip >>I have the font but cannot find a way to extract it from my PC >>THANK YOU VERY MUCH FOR THE HELP, IT WORKED ON MY PC, THANKS, GOD >>BLESS YOU === Subject: NMaximize woes Hi! I have a function called FindQuality that takes two real parameters and outputs a real value. It is a very complicated set of loops, and it includes an integral which cannot be evaluated analytically (thus, NIntegrate is used). Unfortunately, when I try to call NMaximize[{FindQuality[x,y],GStart<=x<=GEnd,CStart<=y<=CEnd},{x,y}] I get - NIntegrate::inum: Integrand T1[Enr] T2[Enr,(0. y)/(x^2)] Log[(1+e^((U-Enr)/(k_b*T)))/(1+e^((U-Enr-e*V)/(k_b*T)))] is not numerical at {Enr} = {4.69691*10^-19} until the errors are forced to stop. I set the first line of FindQuality to print out its parameters, and, when calling it, the two values(?) printed are x and y. Why doesn't NMaximize call FindQuality with floating point values ? Why does it pass symbols to the function ? As you can see, x and y eventually end up in the integrand, so it's no surprise that the integrand is not numerical, right ? If I call NMaximize and my function prints out its parameters, shouldn't it end up printing out real numbers rather than symbol names ? === Subject: dashing the lines make the plot looks so bad for example, Show[Graphics[{AbsoluteDashing[{10, 5}], Line[{{0, 1}, {1, 0}}], Thickness[0.02], AbsoluteDashing[{5, 10}], Line[{{0, 0}, {1, 1}}]}]]; making it thicker shows the problem even more severely. but it appears to me there is some kinda pattern... i just don't know what it is. below shows this pattern (i think) of dashes showing up rotated every so often. Needs[Graphics`Legend`]; Needs[Graphics`Colors`]; << Graphics`Graphics` Plot[{Sin[x], Cos[x]}, {x, 0, 5Pi}, PlotStyle -> {Red, {Blue, Thickness[0.02] , AbsoluteDashing[{1, 10}]}}, LegendLabel -> this stuff nlooks weird, PlotLegend -> {Sin, Cos}, LegendPosition -> {1.1, -.25}, LegendShadow -> {0, 0}, ImageSize -> 500]; maybe if we get rid of the rotations, then the dashing will improve in appearance. so... is that possible? sean __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com === Subject: Re: dashing the lines make the plot looks so bad on screen or in the printout by a PostScript printer ? Jens sean kim schrieb im Newsbeitrag > for example, > Show[Graphics[{AbsoluteDashing[{10, 5}], Line[{{0, 1}, > {1, 0}}], Thickness[0.02], AbsoluteDashing[{5, 10}], > Line[{{0, 0}, {1, 1}}]}]]; > making it thicker shows the problem even more > severely. > but it appears to me there is some kinda pattern... i > just don't know what it is. > below shows this pattern (i think) of dashes showing > up rotated every so often. > Needs[Graphics`Legend`]; > Needs[Graphics`Colors`]; > << Graphics`Graphics` > Plot[{Sin[x], Cos[x]}, {x, 0, 5Pi}, PlotStyle -> {Red, > {Blue, Thickness[0.02] , AbsoluteDashing[{1, 10}]}}, > LegendLabel -> this stuff nlooks weird, PlotLegend > -> {Sin, Cos}, LegendPosition -> {1.1, -.25}, > LegendShadow -> {0, 0}, ImageSize -> 500]; > maybe if we get rid of the rotations, then the dashing > will improve in appearance. so... is that possible? > sean > __________________________________ > Do you Yahoo!? > Check out the new Yahoo! Front Page. > www.yahoo.com === Subject: Re: bimodal distribution in sign of difference of Pi digits] I'm learning to analyze this type of problem. The sum comes down to a cumlative integer probality sum ( Sign is only integer). I simulated it using the (a,b) two simple probabilities of 10 symbols to get (7/18,1/9,7/18) out 90 possible states.( 2*Binomial[10,2]) The result behaves just as the other digits simulations did without using the digits: I also realize that independent probabilities may be an ideal myth as nothing comes from nowhere, but still is is the ideal from such probaility as a thought experiment. Thus, using a pseudorandom that is in any tinture Markov or dependent on it's history is a fault to the simulation. The trouble is we actually lack an ideal probability type pseudorandom. No such algorithm exist as far as I know or have been able to search out in the last 30 years of study. (* simulation of 10's digits equal probabuility (a,b) independently*) (* using (7/18,1/9,7/18) as probabilities that the Sign of the difference is (1,0,-1)*) digits=50000 SeedRandom[Random[Integer,digits]] f[n_]:=f[n]=f[n-1]+Random[Integer,{0,7}]/18-Random[Integer,{0,7}]/18 f[0]=Random[Integer,{0,7}]/18-Random[Integer,{0,7}]/18 a=Table[Floor[f[n]],{n,1,digits}]; ListPlot[a,PlotJoined->True] b=Flatten@{0,Length/@Split[Sort@a], 0} ListPlot[b,PlotJoined->True]; >I don't know. >This method is a new way to investigate Pi digits. >I had done some counts of base ten digits frequencies before this. >I have no real explaination of why the difference is higher in higher number of digits. > The groups of positive Signs should >random. It is Sign[x]-> {-1,0,1} depending on the difference in consecutive >differences. It is the probability of a digit pair: > {a,b}--> Sign[a-b] >p=Probability [a]*Probability[b] >If they are equal as p0: >p->p0^2 >If the Mathematica for such a probability would be: >p0->Random[Integer,{0,9}] as a Distribution >Since this is an straight type probabilty and not a Gaussian >the probabilies are equal and should be over a long term >1/10 each or a total of >p-->1/100 >different for different combinations: > {a>b}->+1,{a-1},{a=b}->0 >at {4/10,4/10,2/10} that gives something like >4/1000,4/1000,2/1000 >I'm not seeing that kind of behavior except for the bimodal >which is expected as > (a=b) is >only about 2/10 of the 1/100 and I'm seeing more zeros than that. >It appears to be a much more complex distribution. >I want to try E and orther irrational numbers by this method as well! >I'm glad you asked as I hadn't thought to do a probability analysis >until now! >I can simulate the probability above in Mathematica > and see what I get > and compare them. >>Quoting Roger Bagula : >> >> >(* Sum of the sign of the differences between the first 2000 digits of Pi*) > >> > >>Shouldn't this behave like a random walk, i.e. the variance >>increases over time? >>jasonp >>------------------------------------------------------ >>This message was sent using BOO.net's Webmail. >>http://www.boo.net/ >> >> -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn === Subject: Re: bimodal distribution in sign of difference of Pi digits] http://news.bbc.co.uk/1/hi/sci/tech/2146295.stm http://www.pnl.gov/energyscience/10-01/art3.htm http://pi.nersc.gov/ I've just trying to answer the question raised by Dr. David Bailey? My answer is a qualified No to his question about Pi digits being random. But they are the best nature non-Markovian Rabndomness we have. As his ( Bailey's) formula gives individual digits using a PSLQ derivation in base 16, It is no they aren't techically dependent base 16 on the previous digits. There are a lot of transcendental numbers and their technology is only just being explored. The estimate is that the number of transcentals is very like that of the rational numbers, but we don't have a Farey tree and it's sequences like in transcendenatls yet. The point is that Pi is a benchmark for randomness. CA 30 just isn't good enough to be. And yes there is a dependence in Pi digits, but it isn't considered algebraic even though PSLQ is used to compute it: http://library.wolfram.com/infocenter/MathSource/4263/ http://mathforum.org/epigone/comp.soft-sys.math.mathematica/jolpoxhen http://www.lbl.gov/Science-Articles/Archive/pi-algorithm.html It can't be algebriac or Pi wouldn't be transcendental. >I'm learning to analyze this type of problem. >The sum comes down to a cumlative integer probality sum ( Sign is only >integer). >I simulated it using the (a,b) two simple probabilities of 10 symbols to >get >(7/18,1/9,7/18) out 90 possible states.( 2*Binomial[10,2]) >The result behaves just as the other digits simulations did without >using the digits: >I also realize that independent probabilities may be an ideal myth >as nothing comes from nowhere, but still is is the ideal from such >probaility as a thought experiment. >Thus, using a pseudorandom that is in any tinture Markov or dependent >on it's history is >a fault to the simulation. >The trouble is we actually lack an ideal probability type pseudorandom. >No such algorithm exist as far as I know > or have been able to search out in the last 30 years of study. >(* simulation of 10's digits equal probabuility (a,b) independently*) >(* using (7/18,1/9,7/18) as probabilities that the Sign of the >difference is (1,0,-1)*) >digits=50000 >SeedRandom[Random[Integer,digits]] >f[n_]:=f[n]=f[n-1]+Random[Integer,{0,7}]/18-Random[Integer,{0,7}]/18 >f[0]=Random[Integer,{0,7}]/18-Random[Integer,{0,7}]/18 >a=Table[Floor[f[n]],{n,1,digits}]; >ListPlot[a,PlotJoined->True] >b=Flatten@{0,Length/@Split[Sort@a], 0} >ListPlot[b,PlotJoined->True]; >>I don't know. >>This method is a new way to investigate Pi digits. >>I had done some counts of base ten digits frequencies before this. >>I have no real explaination of why the difference is higher in higher number of digits. >>The groups of positive Signs should >>random. It is Sign[x]-> {-1,0,1} depending on the difference in consecutive >>differences. It is the probability of a digit pair: >>{a,b}--> Sign[a-b] >>p=Probability [a]*Probability[b] >>If they are equal as p0: >>p->p0^2 >>If the Mathematica for such a probability would be: >>p0->Random[Integer,{0,9}] as a Distribution >>Since this is an straight type probabilty and not a Gaussian >>the probabilies are equal and should be over a long term >>1/10 each or a total of >>p-->1/100 >>different for different combinations: >>{a>b}->+1,{a-1},{a=b}->0 >>at {4/10,4/10,2/10} that gives something like >>4/1000,4/1000,2/1000 >>I'm not seeing that kind of behavior except for the bimodal >>which is expected as >>(a=b) is >>only about 2/10 of the 1/100 and I'm seeing more zeros than that. >>It appears to be a much more complex distribution. >>I want to try E and orther irrational numbers by this method as well! >>I'm glad you asked as I hadn't thought to do a probability analysis >>until now! >>I can simulate the probability above in Mathematica >>and see what I get >>and compare them. >> >Quoting Roger Bagula : > > >>(* Sum of the sign of the differences between the first 2000 digits of Pi*) >> >> >> >> >Shouldn't this behave like a random walk, i.e. the variance >increases over time? >jasonp >------------------------------------------------------ >This message was sent using BOO.net's Webmail. >http://www.boo.net/ > > >> -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn === Subject: Re: bimodal distribution in sign of difference of Pi digits] The correct probability is {40/90,10/19,40/90) for the Sign types (1,0,-1). I made a subtraction mistake. The model of the probabilities becomes: ( with no zero state ) f[n_]:=f[n]=f[n-1]+Random[Integer,{1,40}]/90-Random[Integer,{1,40}]/90 f[0]=Random[Integer,{1,40}]/90-Random[Integer,{1,40}]/90 My friend has used stepwise calculation in Mathematica to go to a very high number of Pi digits ( 10 of millions) and the deviations from zero still remains and grows. It appears there is no ideal of randomness that can be reached by our current methods of calculation. >I'm learning to analyze this type of problem. >The sum comes down to a cumlative integer probality sum ( Sign is only >integer). >I simulated it using the (a,b) two simple probabilities of 10 symbols to >get >(7/18,1/9,7/18) out 90 possible states.( 2*Binomial[10,2]) >The result behaves just as the other digits simulations did without >using the digits: >I also realize that independent probabilities may be an ideal myth >as nothing comes from nowhere, but still is is the ideal from such >probaility as a thought experiment. >Thus, using a pseudorandom that is in any tinture Markov or dependent >on it's history is >a fault to the simulation. >The trouble is we actually lack an ideal probability type pseudorandom. >No such algorithm exist as far as I know > or have been able to search out in the last 30 years of study. >(* simulation of 10's digits equal probabuility (a,b) independently*) >(* using (7/18,1/9,7/18) as probabilities that the Sign of the >difference is (1,0,-1)*) >digits=50000 >SeedRandom[Random[Integer,digits]] >f[n_]:=f[n]=f[n-1]+Random[Integer,{0,7}]/18-Random[Integer,{0,7}]/18 >f[0]=Random[Integer,{0,7}]/18-Random[Integer,{0,7}]/18 >a=Table[Floor[f[n]],{n,1,digits}]; >ListPlot[a,PlotJoined->True] >b=Flatten@{0,Length/@Split[Sort@a], 0} >ListPlot[b,PlotJoined->True]; >>I don't know. >>This method is a new way to investigate Pi digits. >>I had done some counts of base ten digits frequencies before this. >>I have no real explaination of why the difference is higher in higher number of digits. >>The groups of positive Signs should >>random. It is Sign[x]-> {-1,0,1} depending on the difference in consecutive >>differences. It is the probability of a digit pair: >>{a,b}--> Sign[a-b] >>p=Probability [a]*Probability[b] >>If they are equal as p0: >>p->p0^2 >>If the Mathematica for such a probability would be: >>p0->Random[Integer,{0,9}] as a Distribution >>Since this is an straight type probabilty and not a Gaussian >>the probabilies are equal and should be over a long term >>1/10 each or a total of >>p-->1/100 >>different for different combinations: >>{a>b}->+1,{a-1},{a=b}->0 >>at {4/10,4/10,2/10} that gives something like >>4/1000,4/1000,2/1000 >>I'm not seeing that kind of behavior except for the bimodal >>which is expected as >>(a=b) is >>only about 2/10 of the 1/100 and I'm seeing more zeros than that. >>It appears to be a much more complex distribution. >>I want to try E and orther irrational numbers by this method as well! >>I'm glad you asked as I hadn't thought to do a probability analysis >>until now! >>I can simulate the probability above in Mathematica >>and see what I get >>and compare them. >> >Quoting Roger Bagula : > > >>(* Sum of the sign of the differences between the first 2000 digits of Pi*) >> >> >> >> >Shouldn't this behave like a random walk, i.e. the variance >increases over time? >jasonp >------------------------------------------------------ >This message was sent using BOO.net's Webmail. >http://www.boo.net/ > > >> -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn === Subject: Garbage collection problem To anyone who can help me, I've written a small simulator to model the system I'm studying. It works nicely. Now I'm wrapping that simulator in a set of Do[] loops to generate maps of its behavior. Unfortunately, long runs quickly fill my After a good bit of debugging, I have isolated (at least half of of) the memory problem to my use of a StoppingTest inside NDSolve. Example: (* Setup *) eq={9.8*(0.99*Cos[qS[t]] + 0.01*Cos[qH[t] + qS[t]]) - 0.01*Sin[qH[t]]*qH'[t]*qS'[t] - 0.01*Sin[qH[t]]* qH'[t]*(qH'[t] + qS'[t]) + (0.001 + 0.01*Cos[qH[t]])* qH''[t] + (0.982 + 0.02*Cos[qH[t]])*qS''[t] == 0, 0.1*Cos[qH[t] + qS[t]] + 0.01*Sin[qH[t]]*qS'[t]^2 + 0.001*qH''[t] + (0.001 + 0.01*Cos[qH[t]])*qS''[t] == 0, qS[0] == 1.71, qS'[0] == -1.01, qH[0] == 2.84, qH'[0] == 1.1}; vars={qS[t], qH[t], qS'[t], qH'[t]}; test=qH[t] >= Pi && 2*Cos[qH[t]/2]*Cos[qH[t]/2 + qS[t]]*Sin[Pi/180] + Cos[Pi/180]*(Cos[qS[t]]*Sin[qH[t]] + (1 + Cos[qH[t]])* Sin[qS[t]]) < -0.01 && Cos[qH[t] + qS[t]]* Derivative[1][qH][t] + (Cos[qS[t]] + Cos[qH[t] + qS[t]])* Derivative[1][qS][t] < -0.01 || Abs[qH[t]] < Pi/6 || Sin[qS[t]] < 1/4; $HistoryLength=0; (* end *) (* example a *) Do[ soln=NDSolve[eq,vars,{t,0,2}][[1]]; , {20}]; MemoryInUse[] (* end *) (* example b *) Do[ soln=NDSolve[eq,vars,{t,0,2},StoppingTest->test][[1]]; , {20}]; MemoryInUse[] (* end *) To reproduce this, start a fresh kernel. Execute the setup code, and then repeatedly run example a or b. When I repeatedly run example a, MemoryInUse[] quickly converges to a constant value, as expected. However, each run of example b results in an increase in memory consumption. Why? How can I fix/avoid this behavior? I stripped out some other logic, but all I really want are a few numbers from the last several solns of each run, to observe convergence properties. Daniel === Subject: Re: Garbage collection problem and example b. In[34]:= run[do_]:= Module[{}, Do[ soln=NDSolve[eq,vars,{t,0,2},StoppingTest->test][[1]]; , {do}]] In[37]:= run[200] MemoryInUse[] Out[38]= 8540856 In[34]:= run[do_]:= Module[{}, Do[ soln=NDSolve[eq,vars,{t,0,2},StoppingTest->test][[1]]; , {do}]] In[39]:= run[20] MemoryInUse[] Out[40]= 8625976 === Subject: Re: Garbage collection problem flank the routine in Module[] and keep things local. In[13]:= (* Setup *) run[do_]:=Do[ Module[{}, eq={9.8*(0.99*Cos[qS[t]] + 0.01*Cos[qH[t] + qS[t]]) - 0.01*Sin[qH[t]]*qH'[t]*qS'[t] - 0.01*Sin[qH[t]]* qH'[t]*(qH'[t] + qS'[t]) + (0.001 + 0.01*Cos[qH[t]])* qH''[t] + (0.982 + 0.02*Cos[qH[t]])*qS''[t] == 0, 0.1*Cos[qH[t] + qS[t]] + 0.01*Sin[qH[t]]*qS'[t]^2 + 0.001*qH''[t] + (0.001 + 0.01*Cos[qH[t]])*qS''[t] == 0, qS[0] == 1.71, qS'[0] == -1.01, qH[0] == 2.84, qH'[0] == 1.1}; vars={qS[t], qH[t], qS'[t], qH'[t]}; test=qH[t] >= Pi && 2*Cos[qH[t]/2]*Cos[qH[t]/2 + qS[t]]*Sin[Pi/180] + Cos[Pi/180]*(Cos[qS[t]]*Sin[qH[t]] + (1 + Cos[qH[t]])* Sin[qS[t]]) < -0.01 && Cos[qH[t] + qS[t]]* Derivative[1][qH][t] + (Cos[qS[t]] + Cos[qH[t] + qS[t]])* Derivative[1][qS][t] < -0.01 || Abs[qH[t]] < Pi/6 || Sin[qS[t]] < 1/4; $HistoryLength=0; ], {do}] (* end *) In[20]:= run[2000]; MemoryInUse[] Out[21]= 2944448 In[24]:= run[2]; MemoryInUse[] Out[25]= 2944448 > To anyone who can help me, > I've written a small simulator to model the system I'm studying. It > works nicely. Now I'm wrapping that simulator in a set of Do[] loops to > generate maps of its behavior. Unfortunately, long runs quickly fill my > After a good bit of debugging, I have isolated (at least half of of) the > memory problem to my use of a StoppingTest inside NDSolve. > Example: > (* Setup *) > eq={9.8*(0.99*Cos[qS[t]] + 0.01*Cos[qH[t] + qS[t]]) - > 0.01*Sin[qH[t]]*qH'[t]*qS'[t] - > 0.01*Sin[qH[t]]* > qH'[t]*(qH'[t] + qS'[t]) + (0.001 + 0.01*Cos[qH[t]])* > qH''[t] + (0.982 + 0.02*Cos[qH[t]])*qS''[t] == 0, > 0.1*Cos[qH[t] + qS[t]] + 0.01*Sin[qH[t]]*qS'[t]^2 + > 0.001*qH''[t] + (0.001 + 0.01*Cos[qH[t]])*qS''[t] == 0, > qS[0] == 1.71, > qS'[0] == -1.01, > qH[0] == 2.84, > qH'[0] == 1.1}; > vars={qS[t], qH[t], qS'[t], qH'[t]}; > test=qH[t] >= Pi && > 2*Cos[qH[t]/2]*Cos[qH[t]/2 + qS[t]]*Sin[Pi/180] + > Cos[Pi/180]*(Cos[qS[t]]*Sin[qH[t]] + (1 + Cos[qH[t]])* > Sin[qS[t]]) < -0.01 && > Cos[qH[t] + qS[t]]* > Derivative[1][qH][t] + (Cos[qS[t]] + Cos[qH[t] + qS[t]])* > Derivative[1][qS][t] < -0.01 || Abs[qH[t]] < Pi/6 || > Sin[qS[t]] < 1/4; > $HistoryLength=0; > (* end *) > (* example a *) > Do[ > soln=NDSolve[eq,vars,{t,0,2}][[1]]; > , > {20}]; > MemoryInUse[] > (* end *) > (* example b *) > Do[ > soln=NDSolve[eq,vars,{t,0,2},StoppingTest->test][[1]]; > , > {20}]; > MemoryInUse[] > (* end *) > To reproduce this, start a fresh kernel. Execute the setup code, and > then repeatedly run example a or b. When I repeatedly run example a, > MemoryInUse[] quickly converges to a constant value, as expected. > However, each run of example b results in an increase in memory > consumption. Why? How can I fix/avoid this behavior? I stripped out > some other logic, but all I really want are a few numbers from the last > several solns of each run, to observe convergence properties. > Daniel === Subject: Re: bimodal ditribution form counting signs of Pi digits differences >I did it to the maximum my version/ machine lets me using the >method I understood best. The two lists of digits are not the same( >Pi digits seem to vary more than the Random[Integer,{0.9}] do at >this level). I'm sure somebody with a later version 5.0 and a >faster machine can do better, but it still appears that Pi is a >better pseudorandom than the built in, I think ot at least >different in kind. What you showed was the output from your manipulation of the output from Random[Integer, {0,9}] is decidedly not equivalent to a uniform distribution. But there is no reason to expect this to be uniform. And this in no way supports your comment Pi is a better pseudorandom than the built in. One way (not the best way) to test whether the digits of Pi are random would be to compare these digits to the output of pseudorandom number generator. And while this method was apparently what you intended to do based on your comments, that is not what your code did. Your code considered the distribution of cummulative sums of Sign[u1-u2] where u1, u2 were randomly chosen from 0-9. If you want to compare the distribution of the digits of Pi to the output of Random[Integer, {0,9}] a reasonably test would be a two sample Kolmogorov-Smirnov test. This test is specifically designed to test whether two samples come from the same distribution or not. There are several reasons why comparing the digits of Pi to the output of a given psuedorandom number generator is not the best approach to determining whether the digits of Pi are random or not. The most important is not knowing how closely the output of the pseudorandom number generator matches a uniform distribution. Since the uniform distribution is well known and has easily computed properties, the better approach would be to test the digits of Pi to see if they have properties in common with what should be expected. Knuth in ACP Vol 2 discusses several different empirical and theoretical tests that can be used to compare the output of any given pseudorandom number generator to a uniform distribution. The same test could be used to test the hypothesis the digits of Pi are random. For example, looking at the first 1000 digits of Pi and using a one sample KS test, the relevant test statistic is: d = ({First[#1], Length[#1]} & ) /@ Split[Sort[First[RealDigits[N[Pi, 1000]]]]]; N[Sqrt[1000]*Max[Abs[Rest[FoldList[ Plus, 0, Last /@ d/1000]] - Range[10]/10]]] 0.4743416490252569 And from a table of the KS statistic 90% of the test statistic will be less than 1.068 So, the conclusion has to be the first 1000 digits of Pi show no evidence of not being from a uniform distribution. Do note, the KS test is one of many that could be used and is not the most efficient. -- To reply via email subtract one hundred and four === Subject: Re: 3D plotting problem > I find myself unable to make a 3D plot of the atomic > 2p orbital > f_z(2p,x,y,z;a)=z*Exp[-a*Sqrt[x^2+y^2+z^2]]. > As far as I can understand, 'ContourPlot3D' is the > only option, but it gives either an empty plot box or > a flat sheet. > Can anyone suggest a way out? Paul Abbott, and Jim Williams, available in Notebook form (with and without graphics) at http://physics.uwa.edu.au/pub/Orbitals relevant. Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul@physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul === Subject: Re: Re: 3D plotting problem Documentation is unclear on what ContourPlot3D actually does--until you get to the example. You also get an empty box if you replace Cos[...] with 1-Cos[...], simply because 1-Cos[...] is never zero in the range. But this gives a surface: ContourPlot3D[3 - Cosh[Sqrt[ x^2 + y^2 + z^2]], {x, -2, 2}, {y, 0, 2}, {z, -2, 2}] and so does this: ContourPlot3D[1.01 - Cosh[Sqrt[x^2 + y^2 + z^2]], {x, -2, 2}, {y, 0, 2}, {z, -2, 2}] That's a weird one. Bobby > I am sorry that I was not clear enough about the nature of my problem, > which I will try to illustrate by the following example: > If 'Cos' is replaced by 'Cosh' in the command > ContourPlot3D[Cos[Sqrt[x^2+y^2+z^2]],{x,-2,2},{y,0,2},{z,-2,2}] > an empty plot box appears. > It seems to me that it is problematic to make 3D contour plots > involving exponential functions, and I hope somebody can suggest > a remedy for this. > Henning Heiberg-Andersen >>I find myself unable to make a 3D plot of the atomic 2p orbital >>f_z(2p,x,y,z;a)=z*Exp[-a*Sqrt[x^2+y^2+z^2]]. >>As far as I can understand, 'ContourPlot3D' is the only option, but >>it gives either an empty plot box or a flat sheet. >>Can anyone suggest a way out? >> You did not make it clear exactly what you tried to plot. If it was the expression you posted, then try re-writting your function as >> f[x_, y_, z_, a_] := z*Exp[-a*Sqrt[x^2 + y^2 + z^2]] >> Here, I've eliminated the _z from the function name as Mathematica doesn't allow underscore characters in function names f_z is interpeted by Mathematica to be any expression with Head z given a name f, not what you want. >> Changed the ( to [ to corespond to proper Mathematica syntax >> dropped 2p from the arguements since it does not appear on the rhs >> added a underscore to all of the other arguments. Using x_ is interpreted by Mathematica as being any valid expression and is given a local name of x >> Replaced Set (=) with DelayedSet (:=) >> -- >> To reply via email subtract one hundred and four -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: 3D plotting problem a) learn the correct syntax, i.e, fz[a_][2p,x_,y_,z_]=z*Exp[-a*Sqrt[x^2+y^2+z^2]] b) set the Contours option in ContourPlot3D[] to an non zero value Jens Henning Heiberg-Andersen schrieb im > I find myself unable to make a 3D plot of the atomic > 2p orbital > f_z(2p,x,y,z;a)=z*Exp[-a*Sqrt[x^2+y^2+z^2]]. > As far as I can understand, 'ContourPlot3D' is the > only option, but it gives either an empty plot box or > a flat sheet. > Can anyone suggest a way out? > Henning Heiberg-Andersen === Subject: Re: Null entry in a Graphics list? do you mean DisplayFunction-> Identity ? then to recover it in show. DisplayFunction->$DisplayFunction > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics > (other than an > offscreen Point or a zero-size Point or . . . ) that > will be acceptable > in subsequent graphics commands __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com === Subject: How to include images and graphics in Mathematica How do one include graphics into mathematica without using Import[...] and Show[]? I've seen several Wolfram screendumps showing notebooks with images but no input-line to insert the image. The reason why I want this is to write design reports with images and math in dosument with nice formatting. Christopher Grinde === Subject: Problems about Graphics I used to paste the graphics generated by Mathematica on my reports written with Microsoft Word, but I also have two problem : 1. The graphics always become bigger than it is in Mathematica notebook, and I'll have to resize it to 85% so that it will looks just the same size as it is in Mathematica. But at the beginning as I used Mathematica there's no such problem; I can't remember exactly when this problem first happened. 2. The curves are not as smooth as they should be. No matter what I do there's always sawtooth with it. === Subject: Re: Re: newbie question on functions >> Yes, of course you can save the result of a calculation. For example: >> result=intensity[4.,5.] > For the original newbie poster: > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] > Same general principle applies more broadly. Actually in this particular case you are wrong. You are confusing AppendTo with simple Append. AppendTo[list, expr] is in fact enough and is equivalent to list=Append[list,expr] Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ === Subject: Re: Help with a calculation > I' m here asking for some help with the following calculation: > $sum_{r=0}^{3}operatorname{Re}left( left( alpha_{3,r}^{ast}% > -alpha_{4,r}^{ast}right) left( alpha_{2,r}e^{-iphi_{r}}-alpha > _{1,r}e^{iphi_{r}}right) right) =2sqrt{2}$ > $sum_{r=0}^{3}alpha_{j,r}alpha_{k,r}^{ast}=delta_{j,k}$ with > $j,k=1,2,3,4$ > $sum_{j=1}^{4}leftvert alpha_{j,r}rightvert ^{2}=1$ for $r=0,1,2,3$ > Is Mathematica able to find solutions? > In case of affirmative answer, how do I program Mathematica for this task? Your question is a mathematical one, not really a Mathematica question. Your last two equations are simply the requirement that the 4x4 matrix A = Table[alpha[j,r], {j,4}, {r,0,3}] is a unitary matrix of determinant one, i.e., an element of SU(4). The dimension of SU(n) is n^2 - 1 and so a parameterization of SU(4) has 15 generators. (This is a significant reduction: writing the real and imaginary part of alpha[j,r] = x[j,r] + I y[j,r], one has 32 non-independent parameters). See, e.g, A parametrization of bipartite systems based on SU(4) Euler angles by T Tilma, M Byrd and E C G Sudarshan, J. Phys. A: Math. Gen. 35 No 48 (6 December 2002) 10445-10465. The first equation relates the values of phi[r], r = 0,1,2,3, but the phi[r] are not determined by this equation. See the Notebook appended below for a simpler example. > Apologies, in the case my question is in some way naive. And let me guess the application: some computation involving two qubit density matrices? Paul CreatedBy='Mathematica 5.0' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 10375, 324]*) (*NotebookOutlinePosition[ 11013, 346]*) (* CellTagsIndexPosition[ 10969, 342]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[SU(2) Example, Section], Cell[Introduce the following definitions:, Text], Cell[BoxData[ (TraditionalForm`[Alpha]_(n_, r_) := x_(n, r) + [ImaginaryI] y_(n, r))], Input], Cell[BoxData[ (TraditionalForm`(x_^*) := x /. [InvisibleSpace]Complex[a_, b_] [RuleDelayed] Complex[a, (-b)])], Input], Cell[BoxData[ (TraditionalForm`x_^[Dagger] := (x^*)^T)], Input], Cell[TextData[{ The general , Cell[BoxData[ (TraditionalForm`SU(2))]], matrix has the form , Cell[BoxData[ FormBox[ RowBox[{(, GridBox[{ {[Alpha], [Beta]}, {(-([Beta]^*)), ([Alpha]^*)} }], )}], TraditionalForm]]], with the constraint , Cell[BoxData[ (TraditionalForm`[LeftBracketingBar][Alpha] [RightBracketingBar]^2 + [LeftBracketingBar][Beta] [RightBracketingBar]^2 [LongEqual] 1)]], . Hence we set }], Text], Cell[BoxData[ (TraditionalForm`([Alpha] /: [Alpha]_(2, 0) = (-( [Alpha]_(1, 1)%*));))], Input], Cell[and, Text], Cell[BoxData[ (TraditionalForm`([Alpha] /: [Alpha]_(2, 1) = ([Alpha]_(1, 0)%*);))], Input], Cell[Your second and third equations are, Text], Cell[CellGroupData[{ Cell[BoxData[ (TraditionalForm`Table[ ComplexExpand[[Sum]+(r = 0)%1( [Alpha]_(j, r)) ([Alpha]_(k, r)%*)], {j, 2}, {k, 2}] [Equal] IdentityMatrix[2])], Input], Cell[BoxData[ FormBox[ RowBox[{ RowBox[{(, [NoBreak], GridBox[{ {(x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2), 0}, { 0, (x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2)} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}], [LongEqual], RowBox[{(, [NoBreak], GridBox[{ {1, 0}, {0, 1} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}]}], TraditionalForm]], Output] }, Open ]], Cell[and, Text], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ RowBox[{Table, [, RowBox[{ RowBox[{([Sum]+(j = 1)%2( [Alpha]_(j, r)) ([Alpha]_(j, r)%*)), [Equal], FormBox[1, TraditionalForm]}], ,, ({r, 0, 1})}], ]}], //, Simplify}], //, Union}], TraditionalForm]], Input], Cell[BoxData[ (TraditionalForm`{x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2 [LongEqual] 1})], Output] }, Open ]], Cell[TextData[{ With the single constraint, , Cell[BoxData[ (TraditionalForm`x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2 [LongEqual] 1)]], , we have 3 independent parameters as required for , Cell[BoxData[ (TraditionalForm`SU(2))]], . Alternatively, your second and third equations are equivalent to }], Text], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ RowBox[{(, [NoBreak], GridBox[{ {([Alpha]_(1, 0)), ([Alpha]_(1, 1))}, {([Alpha]_(2, 0)), ([Alpha]_(2, 1))} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}], ., SuperscriptBox[ RowBox[{(, [NoBreak], GridBox[{ {([Alpha]_(1, 0)), ([Alpha]_(1, 1))}, {([Alpha]_(2, 0)), ([Alpha]_(2, 1))} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}], [Dagger]]}], //, Simplify}], TraditionalForm]], Input], Cell[BoxData[ FormBox[ RowBox[{(, [NoBreak], GridBox[{ {(x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2), 0}, { 0, (x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2)} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}], TraditionalForm]], Output] }, Open ]], Cell[and, Text], Cell[CellGroupData[{ Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox[ RowBox[{(, [NoBreak], GridBox[{ {([Alpha]_(1, 0)), ([Alpha]_(1, 1))}, {([Alpha]_(2, 0)), ([Alpha]_(2, 1))} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}], [Dagger]], ., RowBox[{(, [NoBreak], GridBox[{ {([Alpha]_(1, 0)), ([Alpha]_(1, 1))}, {([Alpha]_(2, 0)), ([Alpha]_(2, 1))} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}]}], //, Simplify}], TraditionalForm]], Input], Cell[BoxData[ FormBox[ RowBox[{(, [NoBreak], GridBox[{ {(x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2), 0}, { 0, (x_(1, 0)%2 + x_(1, 1)%2 + y_(1, 0)%2 + y_(1, 1)%2)} }, RowSpacings->1, ColumnSpacings->1, ColumnAlignments->{Left}], [NoBreak], )}], TraditionalForm]], Output] }, Open ]], Cell[< Here is a simpler equation (involving just two complex parameters) of the type you are interested in: >, Text], Cell[CellGroupData[{ Cell[BoxData[ (TraditionalForm`eqn = [Sum]+(r = 0)%1 (([Alpha]_(2, r) [ExponentialE]^((-[ImaginaryI]) [Phi]_r) - [Alpha]_(1, r) [ExponentialE]^([ImaginaryI] [Phi]_r))) [Equal] 2 @ 2)], Input], Cell[BoxData[ (TraditionalForm`[ExponentialE]^((-[ImaginaryI]) [Phi]_1) ((x_(1, 0) - [ImaginaryI] y_(1, 0))) - [ExponentialE]^([ImaginaryI] [Phi]_0) ((x_(1, 0) + [ImaginaryI] y_(1, 0))) + [ExponentialE]^((-[ImaginaryI]) [Phi]_0) (([ImaginaryI] y_(1, 1) - x_(1, 1))) - [ExponentialE]^([ImaginaryI] [Phi]_1) ((x_(1, 1) + [ImaginaryI] y_(1, 1))) [LongEqual] 2 @2)], Output] }, Open ]], Cell[Here are the real and imaginary parts of this equation:, Text], Cell[CellGroupData[{ Cell[BoxData[ (TraditionalForm`(Collect[ ComplexExpand /@ (Re /@ #), {cos(_), sin(_)}] &) /@ eqn)], Input], Cell[BoxData[ (TraditionalForm`(cos([Phi]_0)) (((-x_(1, 0)) - x_(1, 1))) + (cos([Phi]_1)) ((x_(1, 0) - x_(1, 1))) + (sin([Phi]_1)) ((y_(1, 1) - y_(1, 0))) + (sin([Phi]_0)) ((y_(1, 0) + y_(1, 1))) [LongEqual] 2 @2)], Output] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ (TraditionalForm`(Collect[ ComplexExpand /@ (Im /@ #), {cos(_), sin(_)}] &) /@ eqn)], Input], Cell[BoxData[ (TraditionalForm`(sin([Phi]_1)) (((-x_(1, 0)) - x_(1, 1))) + (sin([Phi]_0)) ((x_(1, 1) - x_(1, 0))) + (cos([Phi]_1)) (((-y_(1, 0)) - y_(1, 1))) + (cos([Phi]_0)) ((y_(1, 1) - y_(1, 0))) [LongEqual] 0)], Output] }, Open ]], Cell[TextData[{ Clearly it is possible to solve this pair of equations for , Cell[BoxData[ (TraditionalForm`[Phi]_0)]], and , Cell[BoxData[ (TraditionalForm`[Phi]_1)]], (since , Cell[BoxData[ (TraditionalForm`(sin^2)([Phi]_r) + (cos^2)([Phi]_r) [LongEqual] 1)]], ) in terms of the parameters , Cell[BoxData[ (TraditionalForm`x_(j, r))]], and , Cell[BoxData[ (TraditionalForm`y_(j, r))]], . }], Text] }, Open ]] }, FrontEndVersion->5.0 for Macintosh, ScreenRectangle->{{0, 1436}, {0, 878}}, WindowSize->{520, 740}, WindowMargins->{{100, Automatic}, {12, Automatic}} ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 32, 0, 69, Section], Cell[1811, 55, 52, 0, 32, Text], Cell[1866, 57, 121, 2, 29, Input], Cell[1990, 61, 152, 3, 28, Input], Cell[2145, 66, 78, 1, 29, Input], Cell[2226, 69, 541, 17, 43, Text], Cell[2770, 88, 120, 2, 30, Input], Cell[2893, 92, 19, 0, 32, Text], Cell[2915, 94, 115, 2, 30, Input], Cell[3033, 98, 51, 0, 32, Text], Cell[CellGroupData[{ Cell[3109, 102, 223, 4, 52, Input], Cell[3335, 108, 756, 21, 51, Output] }, Open ]], Cell[4106, 132, 19, 0, 32, Text], Cell[CellGroupData[{ Cell[4150, 136, 453, 12, 54, Input], Cell[4606, 150, 144, 2, 30, Output] }, Open ]], Cell[4765, 155, 381, 10, 68, Text], Cell[CellGroupData[{ Cell[5171, 169, 832, 20, 46, Input], Cell[6006, 191, 461, 12, 51, Output] }, Open ]], Cell[6482, 206, 19, 0, 32, Text], Cell[CellGroupData[{ Cell[6526, 210, 834, 20, 46, Input], Cell[7363, 232, 461, 12, 51, Output] }, Open ]], Cell[7839, 247, 127, 3, 50, Text], Cell[CellGroupData[{ Cell[7991, 254, 244, 4, 52, Input], Cell[8238, 260, 489, 8, 49, Output] }, Open ]], Cell[8742, 271, 71, 0, 32, Text], Cell[CellGroupData[{ Cell[8838, 275, 136, 3, 28, Input], Cell[8977, 280, 349, 5, 48, Output] }, Open ]], Cell[CellGroupData[{ Cell[9363, 290, 136, 3, 28, Input], Cell[9502, 295, 336, 5, 46, Output] }, Open ]], Cell[9853, 303, 506, 18, 50, Text] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************) -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul@physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul === Subject: Re: NMaximize woes You do not provide enough code to be sure. However, try changing your deinition of FindQuality to FindQuality[LoopVar_?NumericQ, Imax_??NumericQ]:= ... and see if it works better now. Andrzej Kozlowski Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ > Hi! > I'm sorry if this is a repost - I don't think my previous message got > posted, but it may have been. > I have a function called FindQuality which takes two real values and > outputs a single real value. It is a complex collection of loops > (things are iterated until convergence) and includes an integral that > cannot be evaluated analytically. > When I try running it through NMaximize, I get the following error: > NIntegrate::inum: Integrand T1[Enr] T2[Enr,(0.y)/(x^2)] > Log[(1+e^((U-Enr)/(k_b*T)))/(1+e^((U-Enr-eV)/(k_B*T)))] > Except for Enr, which is the variable being integrated over, x, and y, > all other variables are constants. > NMaximize is called as follows: > NMaximize[{FindQuality[x,y],GStart <= x <= GEnd,CStart <= y <= > CEnd},{x,y}] > FindQuality is defined (partially) as follows: > FindQuality[LoopVar_, Imax_] := ( > Print[LoopVar, , Imax]; > ... > As you can see from the error message, the symbols x and y make it > all the way into the integrand. > The Print statement also outputs x y. > Why does NMaximize pass symbols(?) into FindQuality rather than > floating > point values ? I mean, no wonder the function doesn't work ! Or, am I > completely wrong ? Shouldn't the Print statement print out two floating > point values instead of two letters I passed into it anyway ? > I would appreciate any help you can give me ! === Subject: NMaximize woes Hi! I'm sorry if this is a repost - I don't think my previous message got posted, but it may have been. I have a function called FindQuality which takes two real values and outputs a single real value. It is a complex collection of loops (things are iterated until convergence) and includes an integral that cannot be evaluated analytically. When I try running it through NMaximize, I get the following error: NIntegrate::inum: Integrand T1[Enr] T2[Enr,(0.y)/(x^2)] Log[(1+e^((U-Enr)/(k_b*T)))/(1+e^((U-Enr-eV)/(k_B*T)))] Except for Enr, which is the variable being integrated over, x, and y, all other variables are constants. NMaximize is called as follows: NMaximize[{FindQuality[x,y],GStart <= x <= GEnd,CStart <= y <= CEnd},{x,y}] FindQuality is defined (partially) as follows: FindQuality[LoopVar_, Imax_] := ( Print[LoopVar, , Imax]; ... As you can see from the error message, the symbols x and y make it all the way into the integrand. The Print statement also outputs x y. Why does NMaximize pass symbols(?) into FindQuality rather than floating point values ? I mean, no wonder the function doesn't work ! Or, am I completely wrong ? Shouldn't the Print statement print out two floating point values instead of two letters I passed into it anyway ? I would appreciate any help you can give me ! === Subject: Re: Re: Zero divided by a number... all these statements are true as statements about *complex numbers*. Thus instead of saying x/0 is undefined ... he should have said is undefined as a complex number or is not a complex number etc. The word number is ambiguous, and there are some strange people, even some mathematicians, who call things like Infinity numbers but I have never heard of anyone refer to them as complex numbers'. (Complex of course includes real). (Besides, I don't believe that there is anyone, including yourself, who really did not understand what Richard meant.) Andrzej Kozlowski Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ >> Mathematica handles 0 appropriately. x/0 is undefined for any number >> x. > In Mathematica, it is _not_ true that x/0 is undefined for any number > x. > Rather, for any nonzero x, x/0 is defined as ComplexInfinity. >> This is extremely simple to see if only you view division as the >> opposite of multipication. > That view of division is simply inadequate in number systems (such as > the > extended complex numbers) in which division of nonzero quantities by > zero > is defined. >> A/B = C implies that C * B = A. >> 12/4 = 3 because 3*4 = 12. >> 0/7 = 0 because 0*7 = 0. >> 7/0 is undefined because x*0 does not equal 7 for any number x. >> Therefore it has no answer (except undefined). > In Mathematica, 7/0 yields ComplexInfinity, but that certainly does not > imply that 0 * ComplexInfinity = 7. (In fact, 0 * ComplexInfinity is > Indeterminate in Mathematica.) > David Cantrell === Subject: LogListPlot I used MultipleListPlot to plot many list , but how i can change the shape of my points with LogListPlot? === Subject: Re: Re: newbie question on functions AppendTo and PrependTo do change their original lists alpha = {a,b,c}; AppendTo[alpha, d]; alpha {a, b, c, d} PrependTo[alpha, a]; alpha {a, a, b, c, d} Bob Hanlon === > Subject: Re: newbie question on functions > Yes, of course you can save the result of a calculation. For example: > > result=intensity[4.,5.] > For the original newbie poster: > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] > Same general principle applies more broadly. Bob Hanlon Chantilly, VA === Subject: Re: Null entry in a Graphics list? g1 = Graphics[Line[{{0,0},{0,.5}}]]; g2 = Graphics[Line[{{0,0},{1,0}}]]; g3=If[False,Graphics[Line[{{0,0},{1,.5}}]],Graphics[{}]]; Show[g1,g2,g3]; Bob Hanlon === > Subject: Null entry in a Graphics list? > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands === Subject: Re: questions Re your question 2: The Statistics packages have many built-in distributions. Needs[Statistics`DiscreteDistributions`]; Needs[Graphics`Graphics`]; n=100; p=1/10; dist= BinomialDistribution[n, p]; Mean[dist] 10 data1=Table[Random[dist], {200}]; Mean[data1]//N 10.26 Histogram[data1]; data2=RandomArray[dist, {200}]; Mean[data2]//N 10.015 Histogram[data2]; Bob Hanlon === > Subject: questions > Hi Everyone, > Well I have 2 questions: > 1) I have a notebook which involves manipulating 3d plots. However > everytime I run the notebook, after a while I get some kernel errors, > and the mathematica kernel just quits. It crashs after a while and > does not finsih evaluating all the cells. Is there a problem with my > computer? or is it because of the limitation to process (huge amount > of) graphics by Mathematica? > 2) Random[Real, {-4,4}] gives a uniform distribution. However if I > would like to have a binomial distribution or any other kind of > distribution, would this be possible as well? If so then how is it > done? > Namrata Khemka === Subject: fractal image compression I have a presentation on image compression to give and I 'd like to present (among others), the now forgotten fractal image compression method. Does anyone know a link or a mathematica notebook with this kind of stuff? Any information on fractal image compression in mathematica context would be highly appreciated. === Subject: weird page breaks when printing Hi Out of a sudden, mathematica starts breaking pages at stupid places when I print my notebooks. I probably did set a page break marker at these points with a mistype, but I have no clue as how to remove them. Can someone tell me how I can find out if there are page breaks markers somewhere? This sort of annoys me. T. -- Thomas Guignard Laboratory of Electromagnetics and Acoustics Swiss Federal Institute of Technology, Lausanne === Subject: Re: Re: Hide Mathematica kernel window Err, isn't there a button on the top right hand side of your window which when pressed minimizes the window??? If you are talking about the Messages window that keeps popping up, then have a look at Edit->Preferences->GlobalOptions->MessageOptions{WarningAction} and associated settings. Yas > Open windows cramp my desktop. Is there a way to hide mathematica > Anyone? -- === Subject: Re: Null entry in a Graphics list? g1 = Plot[Sin[x], {x, 0, 8}]; g2 = Plot[Cos[x], {x, 0, 8}]; g3 := If[test, Plot[x^2/64, {x, 0, 8}], Graphics[{}]]; but this also seems to work... g3 := If[test, Plot[x^2/64, {x, 0, 8}], {}]; test = True; Show[g1, g2, g3]; test = False; Show[g1, g2, g3]; David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Is there a Null or a None for Graphics? If I want to accomplish something like g1 = Graphics[---]; g2 = Graphics[---] g3 = If[test, Graphics[---], NoGraphics ]; Show[g1, g2, g3 ]; is there something I can put in for NoGraphics (other than an offscreen Point or a zero-size Point or . . . ) that will be acceptable in subsequent graphics commands === Subject: Re: Re: Hide Mathematica kernel window When I work on Windows98 the KERNEL window is always automatically minimized. So I don't understand the reason for your question. A front end notebook window can be minimized just by clicking the minimize button in the title bar. It doesn't go to the task bar but goes to a button right next to the task bar. Maybe you could give more information? David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ > Open windows cramp my desktop. Is there a way to hide mathematica Anyone? === Subject: Re: Re: Hide Mathematica kernel window What version of Mathematica and what OS? Ever since I can remember, under various versions of Mathematica and releases of Windows, the kernel window IS minimized, automatically. >>Open windows cramp my desktop. Is there a way to hide mathematica > Anyone? -- 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: Hide Mathematica kernel window On my machine (WinXP), the kernel appears only as a button on the taskbar. I set the taskbar to automatically hide itself, so there's no issue at all. Bobby >> Open windows cramp my desktop. Is there a way to hide mathematica > Anyone? -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Hide Mathematica kernel window > Open windows cramp my desktop. Is there a way to hide mathematica Anyone? === Subject: Re: Hide Mathematica kernel window > Open windows cramp my desktop. Is there a way to hide mathematica > Anyone? Of course I know how to minimize windows and kernel is minimized anyway. Furthermore, there is not way to maximize it. What I meant however is not to minimize, but minimize to system tray, which is located to the right bottom corner of desktop (by clock) or hide totally so that one can see it as a process if one opens the task manager. Kernel window bears no function (except may be to force shut down evaluation when mathematica stops responding to ALT+.) and I do not see why it would be kept on desktop. May be it is beautiful. === Subject: How to force Mathematica to treat a number as positive and real? I'd like to do some symbolic computation with parameters. These parameters (named, e.g. a) are always *real-valued* and positive. I managed to tell Mathematica that a is a real number by using: a/:Im[a]=0; This works since the response to Re[a] is now a (and not Re[a] which is the general result when one does not use the above definition of a). Now, I would like to do a similar thing, forcing Mathematica to assume that a is a positive number. I want that the result of Abs[a] is equal to a. I tried: a/:Positive[a]=True; but it does not work. Does anybody know how I can do this? Rainer === Subject: Re: Re: Zero divided by a number... > In Mathematica, it is _not_ true that x/0 is undefined for any number x. > Rather, for any nonzero x, x/0 is defined as ComplexInfinity. You mean for any x, zero or not. Let's not confuse Mathematica's result for an expression with a useful mathematical definition of it. x/0 is undefined, no matter WHAT Mathemematica does with the expression. Consider this: Simplify[x y/x] y Simplify[ComplexInfinity y/ComplexInfinity] Indeterminate As you can see, ComplexInfinity isn't a full-fledged member of the algebraic system. The same conclusion follows from the fact that 0*ComplexInfinity isn't zero. (Zero times ANYTHING meaningful is zero.) As another example, Gamma[-5] returns ComplexInfinity, but that doesn't mean defining Gamma that way (into the extended complex plane) removes the discontinuity -- which is what we'd like from a meaningful extension of Gamma. Bobby >> Mathematica handles 0 appropriately. x/0 is undefined for any number >> x. > In Mathematica, it is _not_ true that x/0 is undefined for any number x. > Rather, for any nonzero x, x/0 is defined as ComplexInfinity. >> This is extremely simple to see if only you view division as the >> opposite of multipication. > That view of division is simply inadequate in number systems (such as the > extended complex numbers) in which division of nonzero quantities by zero > is defined. >> A/B = C implies that C * B = A. >> 12/4 = 3 because 3*4 = 12. >> 0/7 = 0 because 0*7 = 0. >> 7/0 is undefined because x*0 does not equal 7 for any number x. >> Therefore it has no answer (except undefined). > In Mathematica, 7/0 yields ComplexInfinity, but that certainly does not > imply that 0 * ComplexInfinity = 7. (In fact, 0 * ComplexInfinity is > Indeterminate in Mathematica.) > David Cantrell -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Zero divided by a number... > Mathematica handles 0 appropriately. x/0 is undefined for any number > x. In Mathematica, it is _not_ true that x/0 is undefined for any number x. Rather, for any nonzero x, x/0 is defined as ComplexInfinity. > This is extremely simple to see if only you view division as the > opposite of multipication. That view of division is simply inadequate in number systems (such as the extended complex numbers) in which division of nonzero quantities by zero is defined. > A/B = C implies that C * B = A. > 12/4 = 3 because 3*4 = 12. > 0/7 = 0 because 0*7 = 0. > 7/0 is undefined because x*0 does not equal 7 for any number x. > Therefore it has no answer (except undefined). In Mathematica, 7/0 yields ComplexInfinity, but that certainly does not imply that 0 * ComplexInfinity = 7. (In fact, 0 * ComplexInfinity is Indeterminate in Mathematica.) David Cantrell === Subject: Re: Re: Zero divided by a number... Amen, Richard. Mathematics doesn't deal with nothing. Zero and the empty set, yes, but nothing? No. Bobby > I think that you have been mislead about mathematics in general. > Mathematics has nothing to do with God or nature. Mathematics is > defined by man and has only the requirement that it be internally > consistent. > Zero is NOT nothing. It is a number. Mathematitians have made > definitions and rules regarding 0. Those rules define 0, not nature. > Mathematica handles 0 appropriately. x/0 is undefined for any number > x. > This is extremely simple to see if only you view division as the > opposite of multipication. > A/B = C implies that C * B = A. > 12/4 = 3 because 3*4 = 12. > 0/7 = 0 because 0*7 = 0. > 7/0 is undefined because x*0 does not equal 7 for any number x. > Therefore it has no answer (except undefined). > You were exactly wrong when you said, logic goes out the window with > mathematics. It is just the opposite. Mathematics IS logic and vice > versa. What mathematics is NOT is tricks with numbers or anything to > do with God or nature. > Logic takes rules and definitions and builds upon them. Division by > zero is undefined, and when Mathematica tells you that something is > undefined, it is not just a glitch or a failure to understand > something. It is telling you that you have evaluated something that is > truely undefined. And that means undefined logically and > intentionally--not as an oversight. > -Richard >> why is it logical to divide zero by a number, but it is not logical > to >> divide a number by zero? It seems to me like dividing nothing by a >> number should be undefined, and dividing a number by nothing should > be >> that number, lest it also be undefined because of the fact that the >> number is divided into zero parts, which is difficult to imagine. > Does >> the number cease to exist, or does it just mean that the number > doen't >> get divided at all? Of course I could argue that Zero itself is not >> defined by nature. Zero is just a place holder representing nothing. >> Logic seems to go out the window when it comes to mathmatics. When >> something doesn't follow the rules of the mathematics game its >> thrown out, or just called undefined. >> Mathematics is only just tricks with numbers. Its not a perfect >> system, and those who believe it to be god are only just fooling >> themselves. Arg...*deep breath* ....sorry. I was abused by a math >> teacher, can you tell? *laughs* -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Regression with missing values >Actually, I didn't want to delete those entries. To be a little bit >more explicit about my data, I have circa 5 independent variables >which place the 6th dependent variable (the analysis result) into a >category. Unfortunately, sometimes there exist data for which 1 of >the 5 independent variables cannot be determined, and thus the data >really can't be placed into a category. It's at this point that I was >hoping it would be possible to still make use of the 6th data variable >(which depends on the first 5 vars) by somehow estimating the >category to which it should belong to. >I know that certain statistical packages deal with such circumstances >without simply deleting the data, but can Mathematica? If in fact Mathematica makes provision for this, are you sure that the technique Mathematica implements is what *you* want to do? You will probably need to deal with the missing data yourself. See the following paper which also has a number of references to further explore the problem: Comparing Regressions When Some Predictor Values Are Missing, Technometrics, Vol. 18, No. 2, May 1976 >Nik >>Can Mathematica handle regression where the dependent variables >>sometimes have missing values? If so, how are these missing values >>to be represented in the data? >> How do you want the missing values treated? Simply ignored? If so, code the missing values in any manner you find suitable to easily distinguish them from valid values and use DeleteCases to delete them from the data matrix given to the regression routine you want to use. >> For example, I have a data file with optical power measurements made in dBm. Valid measurements are negative numbers. So, I used 9999 to replace the missing values. Then I use DeleteCases[data,{_,9999}] to strip these values from the data matrix. === Subject: Plotting scattergram Is there a way to plot a scattergram. I could not find anyting in statistics section, where one would expect to find it. I have two vectors X and Y that I need to plot against each other. As of now I have to export data to excel and do it there which is very === Subject: Re: Hypergeometric functions and Sum error in 5.01? Richard, I think there is nothing wrong here, except that Mathematica seduces people to use a bit more complicated syntax then absolutely necessary. If I define the following two functions: s1[n_, m_] = Gamma[1+n] Hypergeometric2F1[1,m-n,-n,2]/(Gamma[1+m] Gamma[1-m+n]) s2[n_, m_] := Total[Table[Binomial[n - i, m]2^i, {i, 0, n - m}]] then both s1[3,1] and s2[3,1] give the same result that is 11. Note that for s2 I use delayed definition, because I do not want Mathematica to do anything before n and m have been completely specified! In your original post Sum was embedded in Table. I would not recommend that, because Sum is sometimes a simple programming construct doing summation as it is done in a procedural language, but Sum is also a function that does a lot of symbolic things, and you just do not know what is happening especially if you combine them with Replace. However, I think the real killer in your original post was how you evaluated your s1. If you use first one substitution for n, then another for m, Mathematica tries to generate intermediate results and can be derailed (see ComplexInfinity). However, if you simply evalute Gamma[1 + n]Hypergeometric2F1[1, m - n, -n, 2]/(Gamma[1 + m] Gamma[ 1 - m + n]) /. {n -> 3, m -> 1} with simultanious substitution of n and m, then you get the right answer. I hope this helps. Peter > Mathematica 5.01 produces the following: > In[1]:= s1=Sum[Binomial[n-i,m]2^i,{i,0,n-m}] > Out[1]= Gamma[1+n] Hypergeometric2F1[1,m-n,-n,2] / (Gamma[1+m] Gamma[1-m+n]) > In[2]:= Table[{s1,Sum[Binomial[n-i,m]2^i,{i,0,n-m}]}/.n¨3,{m,1,3}] > Out[2]= {{-5,11},{-11,5},{-15,1}} > Out[2] compares Mathematica's closed form with actual values. There appears to be an error in the rules used by Sum when simplifying this expression. > Richard Ollerton > r.ollerton@uws.edu.au === Subject: Re: Hypergeometric functions and Sum error in 5.01? > Mathematica 5.01 produces the following: > In[1]:= s1=Sum[Binomial[n-i,m]2^i,{i,0,n-m}] > Out[1]= Gamma[1+n] Hypergeometric2F1[1,m-n,-n,2] / (Gamma[1+m] > Gamma[1-m+n]) > In[2]:= Table[{s1,Sum[Binomial[n-i,m]2^i,{i,0,n-m}]}/.n¨3,{m,1,3}] I presume you mean n -> 3 (rather than n¨3, which makes no sense to me). > Out[2]= {{-5,11},{-11,5},{-15,1}} > Out[2] compares Mathematica's closed form with actual values. There > appears to be an error in the rules used by Sum when simplifying this >expression. Richard Ollerton > r.ollerton@uws.edu.au I haven't thought enough about your Out[2] to be able to say what is going wrong, but I doubt that it's what you think. Please consider In[3]:= Table[{s1, Sum[Binomial[n - i, m]2^i, {i, 0, n - m}]}, {m, 1, 3}, {n, 3, 3}] Out[3]= {{{11, 11}}, {{5, 5}}, {{1, 1}}} which seems to vindicate s1, at least in these three cases. > It gets worse. Much worse. > This result is undefined for n==3 (for all m, presumably): I certainly don't think of ComplexInfinity as being undefined. But it is bizarre that Mathematica implies that ComplexInfinity is the result _regardless of m_. > s1 = Sum[Binomial[n - i, m]*2^i, {i, 0, n - m}] > % /. n -> 3 > (Gamma[1 + n]*Hypergeometric2F1[1, m - n, -n, 2])/(Gamma[1 + m]*Gamma[1 - > m + n]) > ComplexInfinity > That makes sense, as the Gamma function has nasty poles at zero and the > negative integers. It has nothing to do with poles of the Gamma function. Rather, it has to do with In[4]:= Hypergeometric2F1[1, m - n, -n, 2] /. n -> 3 Out[4]= ComplexInfinity But Out[4] is misleading since it makes it seem as if the result should be ComplexInfinity _regadless of m_. To see that that is not the case, consider In[5]:= Hypergeometric2F1[1, m - n, -n, 2] /. {m -> 1, n -> 3} Out[5]= 11/3 > Yet substituting 3 for n in the original expression gives (for all m, > presumably): > Sum[Binomial[3 - i, m]*2^i, {i, 0, 3 - m}] Bizarre! I wonder what causes that bug. > But substituting specific values for m, we have: > Sum[Binomial[3-i,1]2^i,{i,0,3-1}] > Sum[Binomial[3-i,2]2^i,{i,0,3-2}] > Sum[Binomial[3-i,3]2^i,{i,0,3-3}] > 11 > So we have three wildly different values for the same thing (for n==3 and > a given value of m). > Looking at the definition of Binomial, of course we have: > Binomial[0, 3] == Gamma[0 + 1]/(Gamma[3 + 1]*Gamma[0 - 3 + 1]) > True > But look at the second term in the denominator: > Gamma[0-3+1] > ComplexInfinity But that's probably irrelevant to Richard's problem. He dealt with Binomial[n-i,m] and his index i went from 0 to n-m. Presumably then, n >= m for him, and so the first argument of his Binomial was always at least as big as the second argument. If that is the case, we never get ComplexInfinity. David Cantrell === Subject: covariance, eigenvalues I have a random vector of length 15000 by 1. I have 130 samples of this vector and I would like to estimate the covariance matrix. Is there a built-in function in mathematica to do that ? If there is, can it handle a covariance matrix of size 15000 by 15000? If I can get that matrix the next step is an eigenvalue decomposition. Are there any built-in functions to compute eigenvalues and eigenvectors of a given matrix ? and again, is it possible to use these functions for a matrix of size 15000 by 15000? I would appreciate any suggestions (related to mathematica or some other options) Cagdas === Subject: Re: closing notebook cells CellInformation[] - that sounds wonderful. But I have searched in help, the Wolfram site and Google, and also entered ??CellInformation, and I do not find any information anywhere! Please inform, how do I use it? Ingolf Dahl Sweden >-----Original Message----- === >Subject: closing notebook cells >> As I learned in mathgroup a few years ago I am using the following code >> to close automatically my graphics groups. >> CloseAnim[]:=(SelectionMove[EvaluationNotebook[],All,GeneratedCell]; >> FrontEndTokenExecute[OpenCloseGroup];); >> CloseAnim::usage = CloseAnim[]; >> For example: >> Table[Show[Graphics[ >> {Hue[Random[] ],Rectangle[{0,0},{1,1}] >> }]],{3}]; >> CloseAnim[]; >> The problem is that when I only generate a single cell OpenCloseGroup >> will generate a beep. >> Any idea on how to prevent that beep or test if GeneratedCell selected a >> single or several cells? >> Luc >LinkWrite[$ParentLink, CellInformation[EvaluationNotebook[]]]; >Length[LinkRead[$ParentLink]] >If the length is greater than 1, then you can use the OpenCloseGroup token. >CellInformation[] is new to version 5 and is, in general, a very good way >to test various properties of the selection without having to do a >NotebookRead[] (which could get very expensive if you have a selection >which consumes a lot of memory). >John Fultz >jfultz@wolfram.com >User Interface Group >Wolfram Research, Inc. === Subject: Re: bimodal ditribution form counting signs of Pi digits differences re :b-normal->Prng pseudorandomness - Pi-Hacks post: 1. Re: Digest Number 488 ________________________________________________________________________ ________________________________________________________________________ Message: 1 === Subject: Re: Digest Number 488 > My primary post egroup is my own true number theory group. > Roger, I'm curious how pi/2 can be related to an infinite sum of the orbital trajectories of the quadratic iterator in its chaotic regime but can't find a reference to this. I understand you work in this field. Do you know about this? I thought David Bailey might so I contacted him as he deals with this. Perhaps you are aware already of his work. These are the references he sent me which you might be interested in if not (I didn't see any mention of the quadratic iterator at least in the first paper). http://crd.lbl.gov/~dhbailey/dhbpapers/baicran.pdf A related paper is: http://crd.lbl.gov/~dhbailey/dhbpapers/bcnormal.pdf Dominic >>Just looking at the distribution of digits {0,1,3,4,5} as -1 >>amd {5,6,7,8,9} as 1. >> >Presumably you mean {0,1,2,3,4} and {5,6,7,8,9}? >>As cumlative sum function of the same sort as I used with the sign. >>It should in the case of equal probability of the digits tend to >>a sum of zero. Variaiations as away from zero would probably be >>function of Sqrt[n] plus and minus as a friend pointed out for the >>other distribution. >>Still the >>Random [Integer,{0,9}] >>would be the logical null hypothesis distribution ( using a random seed >>of somesort. >>The idea is to try to make a measure for cumlative digit randomness. >> >If I understand you corrrectly this is a very standard test and will >not yield anything better than the tests that have alrady been >extensively performed in both cases. You can find a number of >considerably subtler tests in Chapter 3, Volume II of Knuth's The Art >of Computer Programming. Since then many more powerful tests have been >designed, particulalry by George Marsaglia. They have all been used on >the Wolfram CA generator and on the digits of Pi. >>Since it is an interesting question, >>comparing two pseudorandom methods would seem >>to tell us more about both of them? >>It is a thought experient that came up with some strange >>results. >>I just noticed that they didn't look right. >> >The problem is with the meaning of look right. What size of samples >have you used ? What sort of statistical analysis did you subject your >results to? Most of all, have you looked at any serious analysis of >these algorithms? For example, the statistical properties of the >Wolfram CA algorithm (which is what Random[Integer, {0,9}] is) were >already analysed in Wolfram's original paper Random Sequence >Generation by Cellular Automata, in Advances in Applied Mathematics >1986, reprinted in Wolfram's collected papers Cellular Automata and >Complexity, 1994. It's only when you examine such sources and compare >that with your results and still find that they don't look right this >matter might become interesting. At the moment it looks exaclty like >Bobby Treat described it: a waste of time. >Andrzej Kozlowski >>I had in the past sort of half heartedly counted distribution of >>individual digits >>with no reall telling effect. >>This Sign difference method seemed a better way to test the randomness, >>I think I've hit on a better way than that: >>Just looking at the distribution of digits {0,1,3,4,5} as -1 >>amd {5,6,7,8,9} as 1. >>As cumlative sum function of the same sort as I used with the sign. >>It should in the case of equal probability of the digits tend to >>a sum of zero. Variaiations as away from zero would probably be >>function of Sqrt[n] plus and minus as a friend pointed out for the >>other distribution. >>Still the >>Random [Integer,{0,9}] >>would be the logical null hypothesis distribution ( using a random seed >>of somesort. >>The idea is to try to make a measure for cumlative digit randomness. >>Since it is an interesting question, >>comparing two pseudorandom methods would seem >>to tell us more about both of them? >>It is a thought experient that came up with some strange >>results. >>I just noticed that they didn't look right. >> >*This message was transferred with a trial version of CommuniGate(tm) >Pro* >Actually, Random[Integer,{0,9}] unlike Random[] already uses the >Wolfram CA algorithm, so it will not benefit form the >RandomReplacement package. >On the other hand the Wolfram CA algorithm has undergone very >demanding testing for randomness (or rather, pseudo-randomness, >which is the case of computers is essentially the same thing) and as >far as I know has passed them all with flying colours. Therefore I >find it hard to believe that someone would find something wrong with >this famous generator using such simple methods; it's rather like >finding a trivial counterexample to a long established theorem. >Still such things do happen from time to time so if it is the case >this time ... Roger Bagula is going to be famous ;-) >Of course it is well known that Pi is an extremely good >pseudo-random number generator, although as far as I know nobody >can prove anything about it. There has been a long standing >conjecture that the digits of Pi give an inifinity-distributed >10-ary sequence though I don't think anybody ever managed to make >any progress on this matter. However, my knowledge of these these is >very dated; in fact it goes back to volume 2 of Knuth's ACP, but I >assume that if somebody may to prove something spectacular in this >area I would have heard about it. The same is true of course about >discovering non-randomness in Wolfram's CA algorithm, though I would >expect this to be a considerably easier task than proving anything >at all about the randomness of the digits of Pi. >Andrzej Kozlowski >Chiba, Japan >http://www.akikoz.net/~andrzej/ >http://www.mimuw.edu.pl/~akoz/ > >>Like the digits of Pi, Random[Integer,{0,9}] is not random--it's >>pseudo-random at best. Google for Andrzej Kozlowski's >>RandomReplacement, go to his web-page, download the package, and see >> if it helps your situation. >> >>Meanwhile, here's an improvement on Don Taylor's method: >> >>digits = 100000; >>h = Rest@# - Most@# &; >>Timing[rdpi = RealDigits[Pi, 10, digits][[1]]; >> frdpi = Drop[rdpi, -1]; >> lrdpi = Drop[rdpi, 1]; >> s = Drop[FoldList[Plus, 0, Sign[Thread[Subtract[lrdpi, frdpi]]]], >> 1]; >> taylor = Table[{n, s[[n + 1]]}, {n, 0, digits - 2}];] >>Timing[brt4 = Transpose@{ >> Range[0, digits - 2], Rest@FoldList[Plus, 0, >> Sign@h@First@RealDigits[Pi, 10, digits]]};] >>brt4 == taylor >> >>{0.469 Second,Null} >> >>{0.171 Second,Null} >> >>True >> >> >> >> >Don Taylor already improved the timoing with this: >Timing[rdpi=RealDigits[Pi,10,Digits][[1]]; > frdpi=Drop[rdpi,-1]; > lrdpi=Drop[rdpi,1]; > s=Drop[FoldList[Plus,0,Sign[Thread[Subtract[lrdpi,frdpi]]]],1]; > Table[{n,s[[n+1]]},{n,0,Digits-2}]] > rdpi=RealDigits[Pi,10,Digits][[1]];frdpi=Drop[rdpi,-1]; >lrdpi=Drop[rdpi,1]; >Drop[FoldList[Plus,{ >-1,0},Map[{1,#}&,Sign[Thread[Subtract[lrdpi,frdpi]]]]],1] > >The problem is when I use >Random[Integer,{0,9}] >as a simulation of the Pi digits array, >I get a worse distribution ... less like what I should get >theoretically >for a truly random distribution of digits. >The Pi digits are more like what probability predicts. >That's what I asked you help with. >You definitely know more about statitical distriubutions in some >ways >than I do. >Don and I think it may be that the ca Random of Mathematica isn't >working right >in this case. >Do tried simulationg the Sign[] difference as >Random[Integer,{-1,1}] >but that cuts out the bimodal/ trimodal {a,b} probability. > >You are an extremely good Mathematica programmer. > > > > >>Below I've provided a version of your program using Dynamic >>Programming, plus another method of my own. Your code recalculates >> the >>same summands repeatedly. The first difference >>Floor@Mod[10Pi,10]-Floor@Mod[Pi,10] is calculated 2000 times to get >>{f[1],..., f[2000]. Dynamic programming eliminates the >>duplications. >> >>In addition, there's a tremendous amount of waste involved because, >>for instance, calculating the 2000th term requires computing Pi to >>2000 digits (or so), but getting the 1999th term required computing >>only one fewer digits. The two computations are completely >>separate, >>each of them starting from scratch. My method eliminates THAT >>wasted >>effort. (It assumes you know in advance how far you'll go, of >>course.) >> >>Here's a timing directly after Quit. Calculating again will give >>faster times (because Mathematica caches certain results, I >>suppose). >> >>ClearAll[f, g] >>n = 5000; >>Timing[mine = >> Rest@FoldList[Plus, 0, Sign /@ ListCorrelate[{-1, >> 1}, First@RealDigits[Pi, 10, n + 2]]];] >>Timing[yours = Block[{$MaxExtraPrecision = n}, >> g[i_] := Sign[Floor@Mod[10^(i + 1)*Pi, 10] - >>Floor@Mod[10^i*Pi, 10]]; >> f[0] = g[0]; >> f[m_] := f[m] = f[m - 1] + g@m; >> f /@ Range[0, n] >> ];] >>mine == yours >> >>{3.797 Second,Null} >> >>{0.016 Second,Null} >> >>True >> >>The original code's Table statement took 10.4 seconds for 500 >>terms, >>44 seconds for 1000, 103.6 seconds for 1500, and 195.2 seconds for >>2000. I didn't take it to 5000, as I did in the timing above. >> >>It's all a waste of time, but at least you can waste a lot LESS >>time. >> >>Bobby >> >> >> >> >This program is real slow on my machine. >Show a lean toward positive differences that is slight at 2000 >digits. > >Digits=2000 >$MaxExtraPrecision = Digits >(* Sum of the sign of the differences between the first 2000 >digits >of Pi*) >f[m_]=Sum[Sign[Floor[Mod[10^(n+1)*Pi,10]]- >Floor[Mod[10^n*Pi,10]]],{n,0,m}] >a=Table[{n,f[n]},{n,0,Digits-1}]; >ListPlot[a,PlotJoined->True] >b=Table[a[[n]][[2]],{n,1,Dimensions[a][[1]]}]; >(* distribution of the noise that results*) >c=Table[Count[b,m],{m,-12,12}] >ListPlot[c,PlotJoined->True] > >Respectfully, Roger L. Bagula >tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca >92040-2905,tel: >619-5610814 : >alternative email: rlbtftn@netscape.net >URL : http://home.earthlink.net/~tftn > > > > > > >> >> >> >> >>-- >>DrBob@bigfoot.com >>www.eclecticdreams.net >> >> >> >> > >>-- >>Respectfully, Roger L. Bagula >>tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: >>619-5610814 : >>alternative email: rlbtftn@netscape.net >>URL : http://home.earthlink.net/~tftn >> -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn === Subject: Re: Re: bimodal ditribution form counting signs of Pi digits differences Why isn't the KS table built into Mathematica, I wonder? Or is it, somewhere? Bobby >> I did it to the maximum my version/ machine lets me using the >> method I understood best. The two lists of digits are not the same( >> Pi digits seem to vary more than the Random[Integer,{0.9}] do at >> this level). I'm sure somebody with a later version 5.0 and a >> faster machine can do better, but it still appears that Pi is a >> better pseudorandom than the built in, I think ot at least >> different in kind. > What you showed was the output from your manipulation of the output from Random[Integer, {0,9}] is decidedly not equivalent to a uniform distribution. But there is no reason to expect this to be uniform. And this in no way supports your comment Pi is a better pseudorandom than the built in. > One way (not the best way) to test whether the digits of Pi are random would be to compare these digits to the output of pseudorandom number generator. And while this method was apparently what you intended to do based on your comments, that is not what your code did. Your code considered the distribution of cummulative sums of Sign[u1-u2] where u1, u2 were randomly chosen from 0-9. If you want to compare the distribution of the digits of Pi to the output of Random[Integer, {0,9}] a reasonably test would be a two sample Kolmogorov-Smirnov test. This test is specifically designed to test whether two samples come from the same distribution or not. > There are several reasons why comparing the digits of Pi to the output of a given psuedorandom number generator is not the best approach to determining whether the digits of Pi are random or not. The most important is not knowing how closely the output of the pseudorandom number generator matches a uniform distribution. > Since the uniform distribution is well known and has easily computed properties, the better approach would be to test the digits of Pi to see if they have properties in common with what should be expected. > Knuth in ACP Vol 2 discusses several different empirical and theoretical tests that can be used to compare the output of any given pseudorandom number generator to a uniform distribution. The same test could be used to test the hypothesis the digits of Pi are random. > For example, looking at the first 1000 digits of Pi and using a one sample KS test, the relevant test statistic is: > d = ({First[#1], Length[#1]} & ) /@ > Split[Sort[First[RealDigits[N[Pi, 1000]]]]]; >N[Sqrt[1000]*Max[Abs[Rest[FoldList[ > Plus, 0, Last /@ d/1000]] - Range[10]/10]]] > 0.4743416490252569 > And from a table of the KS statistic 90% of the test statistic will be less than 1.068 > So, the conclusion has to be the first 1000 digits of Pi show no evidence of not being from a uniform distribution. > Do note, the KS test is one of many that could be used and is not the most efficient. > -- > To reply via email subtract one hundred and four -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Re: bimodal ditribution form counting signs of Pi digits differences >> It appears that both this version and the built in ( rule 30 based) >> random are Markov based ( depend on their own previous history ) >> to produce randomness. It appears that Pi by measure doesn't and is, >> thus, more ideally random. The 1000th digit of Pi is completely determined by (a) the number 1000 and (b) the number Pi -- of which the first 999 digits are a part. How can you say, then, that it doesn't depend on the first 999 digits? > By my experiments the traditional pseudorandom > seems more random than the rule 30 based version. You're just looking at pictures of finite samples. That proves nothing, and anyway, they DON'T seem more random (to anybody but you). The point is that (a) If Pi digits ARE pseudo-random in all the ways we'd like them to be, there's still no proof of it -- whereas the properties of CA-30 are mathematically proven. (b) Computing Pi digits is MUCH less efficient than CA-30 and other standard generators. If we need a billion random variates, this is a very bad way to get them -- especially if we're not looking for small integers. (c) These questions have been studied to death by experts. Bobby > It appears that both this version and the built in ( rule 30 based) > random are Markov based ( depend on their own previous history ) > to produce randomness. > It appears that Pi by measure doesn't and is, thus, more ideally random. > Questions associated with all such dependent randomness ( not just rule 30) > are well known. > By my experiments the traditional pseudorandom > seems more random than the rule 30 based version. > But still less than the ideal for which Pi seems better suited? > I've been told that my experimentation with this area of thought for my > own personal > gratification is futile. > It seems mostly that there is a doctrinaire tide in place and if it > questions > Mathematica's integrity it is futile. > That doctrinaire tide is not a scientific > or mathematical attitude that stand up to any critical comment. > Association with such thought patterns is personally repulsive for me as > well. > Many current professional level development systems > give access to more than one way to produce pseudorandom > numbers for simulations. It is well known that not all such > randomness systems are equal in their measures of randomness. > Suppression of personal research for doctrinaire reasons > is one of the worst results of a commerial enterprise > in a scientific sense. >> A second crack at a null hypothesis using an >> independent pseudorandom generator. >> Results from this generator are more variable than the Mathematica built in >> as you can change both the seed start number and the irrational it is >> based on. >> It too gives a different result than the Pi digits. >> Mathematica code: >> Clear[r,s,a,c1,d1] >> s=5 >> (*Pseudorandom number algorithm from Forcasting on Your >> Microcomuter,nickell, tab books, 1983*) >> SeedRandom[123] >> r[n_Integer]:=r[n]=Mod[(E+r[n-1])^s,1] >> r[0]=Random[] >> digits =50000 >> a=Table[Mod[Floor[10*r[n]],10],{n,1,digits}]; >> c1=Drop[FoldList[Plus,0,Sign[Drop[a,1]-Drop[a,-1]]],1]; >> ListPlot[c1,PlotJoined->True]; >> (* Rowe Count*) >> d1=Flatten@{0,Length/@Split[Sort@c1], 0} >> ListPlot[d1,PlotJoined->True]; > This program is real slow on my machine. > Show a lean toward positive differences that is slight at 2000 digits. > Digits=2000 > $MaxExtraPrecision = Digits > (* Sum of the sign of the differences between the first 2000 digits of Pi*) > f[m_]=Sum[Sign[Floor[Mod[10^(n+1)*Pi,10]]-Floor[Mod[10^n*Pi,10]]],{n,0,m}] > a=Table[{n,f[n]},{n,0,Digits-1}]; > ListPlot[a,PlotJoined->True] > b=Table[a[[n]][[2]],{n,1,Dimensions[a][[1]]}]; > (* distribution of the noise that results*) > c=Table[Count[b,m],{m,-12,12}] > ListPlot[c,PlotJoined->True] > Respectfully, Roger L. Bagula > tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : > alternative email: rlbtftn@netscape.net > URL : http://home.earthlink.net/~tftn -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: bimodal ditribution form counting signs of Pi digits differences It appears that both this version and the built in ( rule 30 based) random are Markov based ( depend on their own previous history ) to produce randomness. It appears that Pi by measure doesn't and is, thus, more ideally random. Questions associated with all such dependent randomness ( not just rule 30) are well known. By my experiments the traditional pseudorandom seems more random than the rule 30 based version. But still less than the ideal for which Pi seems better suited? I've been told that my experimentation with this area of thought for my own personal gratification is futile. It seems mostly that there is a doctrinaire tide in place and if it questions Mathematica's integrity it is futile. That doctrinaire tide is not a scientific or mathematical attitude that stand up to any critical comment. Association with such thought patterns is personally repulsive for me as well. Many current professional level development systems give access to more than one way to produce pseudorandom numbers for simulations. It is well known that not all such randomness systems are equal in their measures of randomness. Suppression of personal research for doctrinaire reasons is one of the worst results of a commerial enterprise in a scientific sense. >A second crack at a null hypothesis using an >independent pseudorandom generator. >Results from this generator are more variable than the Mathematica built in > as you can change both the seed start number and the irrational it is >based on. >It too gives a different result than the Pi digits. >Mathematica code: >Clear[r,s,a,c1,d1] >s=5 >(*Pseudorandom number algorithm from Forcasting on Your >Microcomuter,nickell, tab books, 1983*) >SeedRandom[123] >r[n_Integer]:=r[n]=Mod[(E+r[n-1])^s,1] >r[0]=Random[] >digits =50000 >a=Table[Mod[Floor[10*r[n]],10],{n,1,digits}]; >c1=Drop[FoldList[Plus,0,Sign[Drop[a,1]-Drop[a,-1]]],1]; >ListPlot[c1,PlotJoined->True]; >(* Rowe Count*) >d1=Flatten@{0,Length/@Split[Sort@c1], 0} >ListPlot[d1,PlotJoined->True]; >>This program is real slow on my machine. >>Show a lean toward positive differences that is slight at 2000 digits. >>Digits=2000 >>$MaxExtraPrecision = Digits >>(* Sum of the sign of the differences between the first 2000 digits of Pi*) >>f[m_]=Sum[Sign[Floor[Mod[10^(n+1)*Pi,10]]-Floor[Mod[10^n*Pi,10]]],{n,0,m}] >>a=Table[{n,f[n]},{n,0,Digits-1}]; >>ListPlot[a,PlotJoined->True] >>b=Table[a[[n]][[2]],{n,1,Dimensions[a][[1]]}]; >>(* distribution of the noise that results*) >>c=Table[Count[b,m],{m,-12,12}] >>ListPlot[c,PlotJoined->True] >>Respectfully, Roger L. Bagula >>tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : >>alternative email: rlbtftn@netscape.net >>URL : http://home.earthlink.net/~tftn >> -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn === Subject: Re: closing notebook cells I've already said most of what you need to know. The output is largely self-explanatory. It takes a notebook argument and returns a list of lists...one for each cell in the selection (only one if you've only selected a single cell or the content of a cell). Each list contains rules with various bits of information about the thing that's selected (similar to the way NotebookInformation[] works). The rules currently returned are... Style - the cell's style ContentData - the type of cell (e.g. GraphicsData, BoxData, TextData) Evaluating - boolean, whether the cell is in the evaluation queue Rendering - boolean, whether the cell is in the rendering queue NeedsRendering - boolean, whether the cell would need to be rendered if displayed CursorPosition - the position of the cursor, could be CellBracket or a list of numbers representing the content selection FirstCellInGroup - boolean, is the cell a head cell of a group CellSerialNumber - unique numerical ID for the cell Formatted - boolean, whether the cell or the cell expression is being displayed InlineCellPosition - if selection is in inline cell, then the cell's position relative to the topmost cell Of course, since this is part of the undocumented packet interface, we reserve the right to make changes to it. I hope to see this or something like it promoted to a documented function similar to NotebookInformation[] in the future. John Fultz jfultz@wolfram.com User Interface Group Wolfram Research, Inc. > CellInformation[] - that sounds wonderful. But I have searched in help, > the > Wolfram site and Google, and also entered > ??CellInformation, and I do not find any information anywhere! Please > inform, how do I use it? > Ingolf Dahl > Sweden >> -----Original Message----- === >> Subject: closing notebook cells > As I learned in mathgroup a few years ago I am using the following > code > to close automatically my graphics groups. > CloseAnim[]:=(SelectionMove[EvaluationNotebook[],All,GeneratedCell]; > FrontEndTokenExecute[OpenCloseGroup];); > CloseAnim::usage = CloseAnim[]; > For example: > Table[Show[Graphics[ > {Hue[Random[] ],Rectangle[{0,0},{1,1}] > }]],{3}]; > CloseAnim[]; > The problem is that when I only generate a single cell > OpenCloseGroup > will generate a beep. > Any idea on how to prevent that beep or test if GeneratedCell > selected a > single or several cells? > Luc >> LinkWrite[$ParentLink, CellInformation[EvaluationNotebook[]]]; >> Length[LinkRead[$ParentLink]] >> If the length is greater than 1, then you can use the OpenCloseGroup >> token. >> CellInformation[] is new to version 5 and is, in general, a very good >> way >> to test various properties of the selection without having to do a >> NotebookRead[] (which could get very expensive if you have a selection >> which consumes a lot of memory). >> John Fultz >> jfultz@wolfram.com >> User Interface Group >> Wolfram Research, Inc. === Subject: Re: Re: newbie question on functions You probably meant to use Append in your example of unexpected behaviour, since AppendTo works as one might hope. junk={1,2,3}; Append[junk,4] {1,2,3,4} junk {1,2,3} But AppendTo actually does what its name suggests: junk={1,2,3}; AppendTo[junk,4] {1,2,3,4} junk {1,2,3,4} christopherpurcell@mac.com AIM/iChatAV: cffrc >> Yes, of course you can save the result of a calculation. For example: >> result=intensity[4.,5.] > For the original newbie poster: > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] > Same general principle applies more broadly. === Subject: Re: Re: newbie question on functions > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] That's exactly wrong. For example: list={a,b} AppendTo[list,c]; list {a,b} {a,b,c} Bobby >> Yes, of course you can save the result of a calculation. For example: >> result=intensity[4.,5.] > For the original newbie poster: > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] > Same general principle applies more broadly. -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: newbie question on functions > Yes, of course you can save the result of a calculation. For example: > result=intensity[4.,5.] For the original newbie poster: For newbies, or less expert users like me, it's easy to think that something like AppendTo[list, expr] is a command that will do what it says: append expr to list. Takes a few bad experiences to realize that you actually have to say list = AppendTo[list,expr] Same general principle applies more broadly. === Subject: Set Options I am trying to convert a mathematica cell in to fortranform to run it in fortran. However I may have messed up the output text display by playing with the set options ..How do I return to the default setting pratik Desai === Subject: Re: plot variance(s) has more or less the same idea. > Input1: data = Table[Sin[x], {x, 0, 2[Pi]}]; > Input 2: p1 = ListPlot[data, > PlotStyle -> {Red, PointSize[0.03]}, DisplayFunction -> Identity]; > Input 3: p2 = Plot[Sin[x], {x, 0, 2[Pi]}, DisplayFunction -> Identity]; > Input 4: Show[p1, p2, DisplayFunction -> $DisplayFunction]; > Steven Shippee > slshippee@comcast.net > 360-493-8353 === Subject: Re: plot variance(s) because you should type data = Table[{x, Sin[x]}, {x, 0, 2[Pi]}]; Plot[Sin[x], {x, 0, 2Pi }, Epilog -> ({RGBColor[1, 0, 0], PointSize[0.03], Point[#]} & /@ data)] Jens Steven Shippee schrieb im Newsbeitrag > Input1: data = Table[Sin[x], {x, 0, 2[Pi]}]; > Input 2: p1 = ListPlot[data, > PlotStyle -> {Red, PointSize[0.03]}, DisplayFunction -> Identity]; > Input 3: p2 = Plot[Sin[x], {x, 0, 2[Pi]}, DisplayFunction -> Identity]; > Input 4: Show[p1, p2, DisplayFunction -> $DisplayFunction]; > Steven Shippee > slshippee@comcast.net > 360-493-8353 === Subject: Re: bimodal distribution in sign of difference of Pi digits] >I'm learning to analyze this type of problem. The sum comes down to >a cumlative integer probality sum ( Sign is only integer). I >simulated it using the (a,b) two simple probabilities of 10 symbols >to get (7/18,1/9,7/18) out 90 possible states. This is an error. If you have 10 distinct digits then there are 100 possible pairs of thoose digits. It should be obvious the integers from 0 t0 99 reflect this fact, i.e., Table[IntegerDigits[n, 10, 2], {n, 0, 99}] == Union[Table[IntegerDigits[n, 10, 2], {n, 0, 99}]] True showing as should be expected there are no duplicates If you wanted, you could use this to compute the probability of finding various values in the cumulative sums you formed in your earlier posts. For example, the first digit of the cumulative sum must be one of {-1,0,1} with the probabilities given above. and Union[Apply[Plus, Flatten[Outer[List, {-1, 0, 1}, {-1, 0, 1}], 1], {1}]] gives {-2, -1, 0, 1, 2} the only possible values for the second sum. And the probabilities will be {81/400,9/100,83/200,9/100,81/400} This could be continued to compute the exact probability for the cumulative sums of any desired number of random digits but clearly the compuational difficulty rapidly increases with the number of random digits chosen. But even without actually computing the probabilities, the first few make it clear the probabilites of each value are not constant. That is the distribution of cumulative sums will not be uniform. So while your comment >I also realize that independent probabilities may be an ideal myth >as nothing comes from nowhere, but still is is the ideal from such >probaility as a thought experiment. is true, the deviations you are seeing from a true uniform random number generator have a lot more to your analysis than problems with Random[Integer, {0,9}] -- To reply via email subtract one hundred and four === Subject: Re: Null entry in a Graphics list? Graphics[Line[{{0, 0}, {0, 0}}]] should serve as an adequate Null graphic. e.g. << Graphics`Graphics` << Graphics`Colors` g1 = Graphics[{Red, Line[{{0, 1}, {1, 0}}]}]; g2 = Graphics[{Blue, Line[{{-1, 0}, {0, 1}}]}]; g3[x_] := If[x < 1, Graphics[{Gold, Circle[{0, 0}, x]}], Graphics[{Green, Line[{{0, 0}, {0, 0}}]}]]; Show[g1, g2, g3[1.3]] Yas > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands === Subject: Re: Null entry in a Graphics list? For example: Needs[Graphics`] plotter[f_, overlayPoints_] := DisplayTogether[Plot[f@x, {x, 0, 10}], ReleaseHold@Graphics@{Red, PointSize[.03], If[overlayPoints, Table[Point@{x, f@x}, {x, 0, 10, .5}], HoldForm@Sequence[]]}] plotter[#Sin[#] &, True] plotter[#Sin[#] &, False] or plotter[f_, overlayPoints_] := DisplayTogether[Plot[f@x, {x, 0, 10}], ReleaseHold@If[ overlayPoints, Graphics@{Red, PointSize[.03], Table[Point@{x, f@x}, {x, 0, 10, .5}]}, HoldForm@Sequence[]]] plotter[#Sin[#] &, True] plotter[#Sin[#] &, False] Bobby > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: Null entry in a Graphics list? > Is there a Null or a None for Graphics? > If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > Show[g1, g2, g3 ]; > is there something I can put in for NoGraphics (other than an > offscreen Point or a zero-size Point or . . . ) that will be acceptable > in subsequent graphics commands The empty list {} should work. For example: g1 = Plot[ x^2, {x, -1, 1}, DisplayFunction -> Identity]; g2 = Plot[x^3, {x, -1, 1}, DisplayFunction -> Identity]; g3 := If[t, g1, {}] t = True; Show[g3, g2, DisplayFunction -> $DisplayFunction] (two graphs) t=False; Show[g3,g2,DisplayFunction->$DisplayFunction] (one graph) Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ === Subject: Re: Null entry in a Graphics list? Replace NoGraphics with Sequence[] Ingolf Dahl Sweden >-----Original Message----- === >Subject: Null entry in a Graphics list? >Is there a Null or a None for Graphics? >If I want to accomplish something like > g1 = Graphics[---]; > g2 = Graphics[---] > g3 = If[test, Graphics[---], NoGraphics ]; > > Show[g1, g2, g3 ]; >is there something I can put in for NoGraphics (other than an >offscreen Point or a zero-size Point or . . . ) that will be acceptable >in subsequent graphics commands === Subject: Re: bimodal ditribution form counting signs of Pi digits differences >Why isn't the KS table built into Mathematica, I wonder? Or is it, >somewhere? As far as I know, the KS table is not built in to Mathematica nor is it a function in any of the packages that come in the standard distribution. FWIW, 1/2Log[1/(1-p)] - 1/(6 Sqrt[n]) is a good approximation to the pth percentile point for the KS statistic with an error O[1/n] for n>30 -- To reply via email subtract one hundred and four === Subject: Re: IEEE single precision number. G'day, If your problem is that binary files aren't being read fast enough, then have a look at, http://library.wolfram.com/infocenter/MathSource/354/ for the fast binary files package. The syntax is the same as in the standard Utilities`BinaryFiles` package. Yas > Looking at the internet I found this email: > ***************************************************************** > I want to convert a group/stream of Bytes to various internal > Mathematica numerical types, particularly into Real (machine precision > number). The motivation is the fast reading of binary files. > I don't want to deal with the Std Package > Utilities`BinaryFiles`ReadBinary or Developer'BinaryImport, which do > have the conversion utilities (e.g. into Real32, etc), since they are > SLOW or otherwise clunky. > When employing the suggested fast reading of binary files: > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > There are numerous means of reading data into Mathematica from binary > files. However, most of them are too slow. Through experience and > some newsgroup research, I've found the fast easy way: > stream = OpenRead[Cals9, DOSTextFormat -> False]; > (* Note: this DOSTextFormat->False option is key to using > ReadList[] in binary mode; otherwise, it wants to digest text. Readin > Byte chunks, then post-format. Remarkably, the DosTextFormat option > is not mentioned/discussed anywhere in the Mathematica book or Help > Browser *) > SetStreamPosition[stream, 78*131072]; > (* Position to desired read starting location within file...count > is in Bytes, and is index base = 0 *). > data = ReadList[stream, Byte, 131072]; > (* Reads 131072 Bytes into linear List data *) > Close[stream]; > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > you end up with a list of Bytes. Converting it to 16-bit integers is > easy: > data = Map[(#1[[1]] + 256*#1[[2]] & ), Partition[data, 2]]; > (* takes original Byte List data and makes 16-bit words, writing > over List data. Result is half-as-long List of words. *) > ...but how would one convert it to real numbers (given that every 4 > bytes comprises an IEEE single-precision number)? > franki at aerodyne.com > ***************************************************************** > Does anyone no the answer, because I have exactly the same problem! > Vangelis Marinakis. === Subject: Re: IEEE single precision number. > Looking at the internet I found this email: > ***************************************************************** > I want to convert a group/stream of Bytes to various internal > Mathematica numerical types, particularly into Real (machine precision > number). The motivation is the fast reading of binary files. > I don't want to deal with the Std Package > Utilities`BinaryFiles`ReadBinary or Developer'BinaryImport, which do > have the conversion utilities (e.g. into Real32, etc), since they are > SLOW or otherwise clunky. > When employing the suggested fast reading of binary files: > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > There are numerous means of reading data into Mathematica from binary > files. However, most of them are too slow. Through experience and > some newsgroup research, I've found the fast easy way: > stream = OpenRead[Cals9, DOSTextFormat -> False]; > (* Note: this DOSTextFormat->False option is key to using > ReadList[] in binary mode; otherwise, it wants to digest text. Readin > Byte chunks, then post-format. Remarkably, the DosTextFormat option > is not mentioned/discussed anywhere in the Mathematica book or Help > Browser *) > SetStreamPosition[stream, 78*131072]; > (* Position to desired read starting location within file...count > is in Bytes, and is index base = 0 *). > data = ReadList[stream, Byte, 131072]; > (* Reads 131072 Bytes into linear List data *) > Close[stream]; > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > you end up with a list of Bytes. Converting it to 16-bit integers is > easy: > data = Map[(#1[[1]] + 256*#1[[2]] & ), Partition[data, 2]]; > (* takes original Byte List data and makes 16-bit words, writing > over List data. Result is half-as-long List of words. *) > ...but how would one convert it to real numbers (given that every 4 > bytes comprises an IEEE single-precision number)? > franki at aerodyne.com > ***************************************************************** > Does anyone no the answer, because I have exactly the same problem! > Vangelis Marinakis. Based upon http://www.wordiq.com/definition/IEEE_754 Let's say you have the bytes coming as normalized binary representations, and you have them as strings in a list like {00110000,....,10100011} then you can join four together with fourbytestrings = Map[StringJoin, Partition[bytestrings, 4]] Let's say one of them is : In[146]:= byte4 = 11000010111011010100 000000000000 The first digit gives the sign: In[189]:= If[StringTake[byte4,1 ]==1,-1,1] Out[189]= -1 The digits between 2 and 9 gives the biased exponential. That exponential will help to separate the integer part from the fraction Here is that substring: In[149]:= StringTake[byte4, {2, 9}] Out[149]= 10000101 Here is the exponential with the bias=127 removed: In[203]:= IntegerDigits[ ToExpression[StringTake[ byte4, {2, 9}]]], 2] - 127 Out[203]= 6 This method of mine works only if this shift above is between 0 and 23. It will not work for a 4byte like 10001101010101001001101100111111 where the shift is -101. Then you can slice the rest of byte4 into two: In[208]:= st1 = StringJoin[1, StringTake[byte4, {10, 10 + shift - 1}]] Out[208]= 1110110 In[213]:= st2 = StringTake[byte4, {10 + shift, 32}] Out[213]= 10100000000000000 Then you can create two sets containing the digits of the above two variables and another two lists containing the appropriate powers of two: In[169]:= st1set = ToExpression[ Characters[st1]] Out[169]= {1, 1, 1, 0, 1, 1, 0} In[170]:= st2set = ToExpression[ Characters[st2]] Out[170]= {1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} In[171]:= twowhole = Table[2^i, {i, Length[st1set] - 1, 0, -1}] Out[171]= {64, 32, 16, 8, 4, 2, 1} In[180]:= twofraction = Table[2^(-i), {i, 1, Length[st2set]}] Out[180]= {1/2, 1/4, 1/8, 1/16, 1/32, 1/64, 1/128, 1/256, 1/512, 1/1024, 1/2048, 1/4096, 1/8192, 1/16384, 1/32768, 1/65536, 1/131072} Then you Inner them pairwise and add them together and multiply it with the right sign In[246]:= N[If[StringTake[byte4, 1] == 1, -1, 1]* (Inner[Times, st1set, twowhole, Plus] + Inner[Times, st2set, twofraction, Plus])] Out[246]= -118.625 All in one: In[263]:= N[If[StringTake[byte4, 1] == 1, -1, 1]* (Inner[Times, ToExpression[ Characters[StringJoin[ 1, StringTake[ byte4, {10, 10 + IntegerDigits[ ToExpression[ StringTake[byte4, { 2, 9}]]], 2] - 127 - 1}]]]], Table[2^i, {i, Length[ToExpression[ Characters[ StringJoin[1, StringTake[byte4, {10, 10 + IntegerDigits[ ToExpression[ StringTake[byte4, {2, 9}]]], 2] - 127 - 1}]]]]] - 1, 0, -1}], Plus] + Inner[Times, ToExpression[ Characters[StringTake[ byte4, IntegerDigits[ ToExpression[ StringTake[byte4, {2, 9}]]], 2] - 127, 32}]]], Table[2^(-i), {i, 1, Length[ToExpression[ Characters[ StringTake[byte4, IntegerDigits[ ToExpression[ StringTake[byte4, {2, 9}]]], 2] - 127, 32}]]]]}], Plus])] Out[263]= -118.625 As I said it works just for particular cases, but it might gives you the insight how to do it for all. If you have a list of fourbytes than you can replace all the byte4-s with #, put an & to the end of the expression and Map it to the list of fourbytes. J.87nos ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice) === Subject: IEEE single precision number. Looking at the internet I found this email: ***************************************************************** I want to convert a group/stream of Bytes to various internal Mathematica numerical types, particularly into Real (machine precision number). The motivation is the fast reading of binary files. I don't want to deal with the Std Package Utilities`BinaryFiles`ReadBinary or Developer'BinaryImport, which do have the conversion utilities (e.g. into Real32, etc), since they are SLOW or otherwise clunky. When employing the suggested fast reading of binary files: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ There are numerous means of reading data into Mathematica from binary files. However, most of them are too slow. Through experience and some newsgroup research, I've found the fast easy way: stream = OpenRead[Cals9, DOSTextFormat -> False]; (* Note: this DOSTextFormat->False option is key to using ReadList[] in binary mode; otherwise, it wants to digest text. Readin Byte chunks, then post-format. Remarkably, the DosTextFormat option is not mentioned/discussed anywhere in the Mathematica book or Help Browser *) SetStreamPosition[stream, 78*131072]; (* Position to desired read starting location within file...count is in Bytes, and is index base = 0 *). data = ReadList[stream, Byte, 131072]; (* Reads 131072 Bytes into linear List data *) Close[stream]; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ you end up with a list of Bytes. Converting it to 16-bit integers is easy: data = Map[(#1[[1]] + 256*#1[[2]] & ), Partition[data, 2]]; (* takes original Byte List data and makes 16-bit words, writing over List data. Result is half-as-long List of words. *) ...but how would one convert it to real numbers (given that every 4 bytes comprises an IEEE single-precision number)? franki at aerodyne.com ***************************************************************** Does anyone no the answer, because I have exactly the same problem! Vangelis Marinakis. From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!atl-c02.usenetserver.com!news.usenetserver.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Bob Hanlon Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 09:49:00 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: hanlonr@cox.net Lines: 47 NNTP-Posting-Date: 14 Nov 2004 09:46:11 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=2g6^k0lCUKfdC]6\m4AY8lC_A=>8kQj6mhHXa^^g6TZdLCE^3V]_2EeEFiONJ7[GofDN[K3MkDWTe X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51328 Use Sign seq=Table[Random[Integer,10],{10^6}]; Take[seq,20] {9,7,1,3,3,1,5,6,6,9,6,8,6,0,5,6,8,2,3,10} Timing[newseq=1+Quotient[#,#+1,1]&@seq;Take[newseq,20]] {0.24 Second,{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1}} Timing[newseq=Sign@seq;Take[newseq,20]] {0.06 Second,{1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1}} Bob Hanlon > > From: "Carl K. Woll" > Date: 2004/11/13 Sat AM 04:40:26 EST > To: mathgroup@smc.vnet.net > Subject: Challenge: Fastest method to convert positive integers to 1 in a long list > > Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers in a > long sequence of nonnegative integers to 1, so that the sequence consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.cwix.com!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Matrix Dot Product Date: Sun, 14 Nov 2004 09:54:07 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 54 NNTP-Posting-Date: 14 Nov 2004 09:51:17 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=P8kQj6MMOj3YM9`=aH^<6aGdoo5TLEFiONJ7[GoFUN8LOP8G6BJ X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51333 You're in luck! Mathematica will do it. Here are two sample 2 x 2 matrices. matA = Array[a, {2, 2}] {{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}} matB = Array[b, {2, 2}] {{b[1, 1], b[1, 2]}, {b[2, 1], b[2, 2]}} Then matrix multiplication is just performed with the 'dot' product. matA.matB {{a[1, 1] b[1, 1] + a[1, 2] b[2, 1], a[1, 1] b[1, 2] + a[1, 2] b[2, 2]}, {a[2, 1] b[1, 1] + a[2, 2] b[2, 1], a[2, 1] b[1, 2] + a[2, 2] b[2, 2]}} Check out Help/List and Matrices/Matrix Operations for more information and examples. David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: MacDonald, Calum (MAT) [mailto:C.A.MacDonald@gcal.ac.uk] Hi I was wondering if someone could please help me with a command for calculating the dot product of two (NxN) matrices. For example, for two (2x2) matrices, A and B, we define the dot product as: A(1,1)*B(1,1) + A(2,1)*B(2,1) + A(1,2)*B(1,2) + A(2,2)*B(2,2) i.e. we multiply corresponding entries of the matrices and sum these values. It is easy to write this in a loop but for large matrices the calculation is rather slow. Is there a Mathematica function that I can call that will allow me to do this faster? Thanks Calum From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: DrBob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: next Prime method from sci.math post Date: Sun, 14 Nov 2004 09:57:09 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA01018@smc.vnet.net> Reply-To: drbob@bigfoot.com Lines: 68 NNTP-Posting-Date: 14 Nov 2004 09:54:20 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=]nSCDZ>InR7ZL\8J]nbWk?C_A=>8kQj6=MOj3YM9`=a8>Nf`US;7g=:EFiONJ7[Go6NeH>:4ha[k0 X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51336 Roger, The range of your f function includes most integers (10000 of the first 10042, for instance): Clear[f] digits = 10000; f[n_] := Floor[n + Log[n]^2/2] z=f/@Range@digits; Length@z Through[{Min,Max}@z] 10000 {1,10042} ...so OF COURSE the range includes most primes. That is, most primes are f[n] for some n. (Using the word "most" very loosely.) But here's an f function that doesn't miss any at all!!! Clear[f] digits=10000; f[n_]:=n a=Rest@Union@Table[If[PrimeQ@f@n,f[n],0],{n,1,digits}]; b=Prime@Range@Length@a; Complement[b,a] {} All primes fit that pattern, so I'm thinking of naming it the "Treat-Bagula prime finder function". What do you think? Bobby On Sat, 13 Nov 2004 04:40:19 -0500 (EST), Roger Bagula wrote: > I read a post several days ago that said you could find a prime between > n and n+Log[n]^2. > ( there also seems to be a NextPrime[] function in Mathematica that I > wasn't aware of) > I tried the average of the two and it works very well > such that there are only a few primes that don't fit that pattern: > > (* Primes that aren't at the average of n and n+Log[n]^2 *) > Clear[f] > digits=10000 > f[n_]:=Floor[n+Log[n]^2/2] > a=Delete[Union[Table[If[PrimeQ[f[n]]==True,f[n],0],{n,1,digits}]],1]; > b=Table[Prime[n],{n,1,Dimensions[a][[1]]}]; > Complement[b,a] > {5,37,97,421,673,2659,3407,3847,7703} > Respectfully, Roger L. Bagula > > tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : > alternative email: rlbtftn@netscape.net > URL : http://home.earthlink.net/~tftn > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: next Prime method from sci.math post Date: Sat, 13 Nov 2004 09:58:51 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: tftn@earthlink.net Lines: 21 NNTP-Posting-Date: 13 Nov 2004 09:56:01 GMT NNTP-Posting-Host: 58bfd4ba.news.twtelecom.net X-Trace: DXC=SZah<@SGn2CQ95GXZ`^XPAC_A=>8kQj6MhHXa^^g6TZD1e2KC15Y Newsgroups: comp.soft-sys.math.mathematica Subject: Re: TraditionalForm of expressions WITHOUT evaluating. Date: Sun, 14 Nov 2004 10:04:16 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA00968@smc.vnet.net> Lines: 45 NNTP-Posting-Date: 14 Nov 2004 10:01:27 GMT NNTP-Posting-Host: 5bbf2f9f.news.twtelecom.net X-Trace: DXC=b78kQj6mMOj3YM9`=ahQFVcK^QMbnkEFiONJ7[GofXE8B3FTO5Xh X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51343 First you may use a text cells so evaluation does not take place. If you need this expression within an input cell, just select the required text with the mouse and then press Ctrl-Shift-T (for traditional). Your second question sound more like system dependent. Are you using Linux, Windows or MacOS? yehuda Nacho wrote: >Hello. > >I would like to ask you how to do the following. > >I want to input some expressions (in InputForm or StandardForm) and >display them in TraditionalForm but without evaluating them. > >For example, if I do: > >2+2 == 4 // TraditionalForm > >I obtain "True" in a nice font ;) but not the "2+2 = 4". > >The expression I want to do is more complicated, with integrals, but >basicly it is the same, for example: > >Integrate[x,{x,2,3}] //TraditionalForm > >Returns 5/2, but I want the Integral symbol with the limits and the >dx. > > > >Also, related to this, anybody knowns how to export a graphic, cell, >or Traditionalform expression to a bitmap with the resulution I want >and smoothed? For example, a 1024x768 graph with the lines smoothed, >or an integral with smoothed font in a resolution to be included in a >image. > >Thanks a lot for your answers. > >Best regards. > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: TraditionalForm of expressions WITHOUT evaluating. Date: Sun, 14 Nov 2004 09:53:06 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 46 NNTP-Posting-Date: 14 Nov 2004 09:50:17 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=P8kQj6MMOj3YM9`=aHco=dW1mZJ3BEFiONJ7[GoF4>XCa?T8CkN X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51332 Try using HoldForm. HoldForm[Integrate[x, {x, 2, 3}]] // TraditionalForm David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ From: Nacho [mailto:ncc1701zzz@hotmail.com] Hello. I would like to ask you how to do the following. I want to input some expressions (in InputForm or StandardForm) and display them in TraditionalForm but without evaluating them. For example, if I do: 2+2 == 4 // TraditionalForm I obtain "True" in a nice font ;) but not the "2+2 = 4". The expression I want to do is more complicated, with integrals, but basicly it is the same, for example: Integrate[x,{x,2,3}] //TraditionalForm Returns 5/2, but I want the Integral symbol with the limits and the dx. Also, related to this, anybody knowns how to export a graphic, cell, or Traditionalform expression to a bitmap with the resulution I want and smoothed? For example, a 1024x768 graph with the lines smoothed, or an integral with smoothed font in a resolution to be included in a image. Thanks a lot for your answers. Best regards. From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: jmt Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Accumulating error counts? Date: Sun, 14 Nov 2004 10:09:23 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA01031@smc.vnet.net> Lines: 24 NNTP-Posting-Date: 14 Nov 2004 10:06:33 GMT NNTP-Posting-Host: 5bbf2f9f.news.twtelecom.net X-Trace: DXC=@Xj;iAkXQlEJAGY9:Pa>5EC_A=>8kQj6MMOj3YM9`=aH>k5;YbS4 I'd like to turn off certain error messages like > > NIntegrate::ncvb: NIntegrate failed to converge > NIntegrate::slwcon: Numerical integration converging too slowly > > using Off[], but accumulate a count of the total number of times the > message occurred in a sequence of calculations. How do I get at that > number? > > (Better yet, I'd like to know the number of times it could have > occurred, as well as the number of times it did occur.) From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: AES/newspost Newsgroups: comp.soft-sys.math.mathematica Subject: Accumulating error counts? Date: Sat, 13 Nov 2004 10:01:53 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 12 NNTP-Posting-Date: 13 Nov 2004 09:59:03 GMT NNTP-Posting-Host: 58bfd4ba.news.twtelecom.net X-Trace: DXC=YQW`>^LEOM`o6SgMaR>^JiC_A=>8kQj6m=_1NR_H?JPm^:T@Q3 Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Plot and axes Date: Mon, 15 Nov 2004 01:26:25 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411140931.EAA14535@smc.vnet.net> Lines: 28 NNTP-Posting-Date: 15 Nov 2004 01:23:35 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=_<5H;ZMVL4c4kSL3l`8\3hC_A=>8kQj6mMOj3YM9`=ah>Nf`US;7g=jEFiONJ7[GofMNIEBQTio]n X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51352 Use the Ticks option Plot[f[x],{x,-4,4},Ticks->{Range[-4,4],Automatic}]. If can change the values of the grid lines in a similar fashion yehuda Steven Shippee wrote: >I would like to get the marks on my "x" axis to show as '1, 2, 3, 4', just >like the "y" axis, but by default they show as '2,4' - is there an easy way >to find this in the help files? > >coordaxes = >Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, >GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; > >I did an >Options[Plot] > >but could not figure out how to do it from there. > >Thanks in advance, > >Steven Shippee >slshippee@comcast.net > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Steven Shippee" Newsgroups: comp.soft-sys.math.mathematica Subject: Plot and axes Date: Sun, 14 Nov 2004 10:02:14 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 19 NNTP-Posting-Date: 14 Nov 2004 09:59:25 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=8mV[1XChM>AM`dM`1WSIFFC_A=>8kQj6MhHXa^^g6TZDLCE^3V]_2EEEFiONJ7[GoF1CjmOWXkKKM X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51341 I would like to get the marks on my "x" axis to show as '1, 2, 3, 4', just like the "y" axis, but by default they show as '2,4' - is there an easy way to find this in the help files? coordaxes = Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; I did an Options[Plot] but could not figure out how to do it from there. Thanks in advance, Steven Shippee slshippee@comcast.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Peter Pein Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Plot and axes Date: Mon, 15 Nov 2004 01:29:28 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 32 NNTP-Posting-Date: 15 Nov 2004 01:26:38 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=h5COKUB3MMYNEg=@eQK2QZC_A=>8kQj6]MOj3YM9`=aX]dW`deQWQE^EFiONJ7[GoV@Y?J]XDj I would like to get the marks on my "x" axis to show as '1, 2, 3, 4', just > like the "y" axis, but by default they show as '2,4' - is there an easy way > to find this in the help files? > > coordaxes = > Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, > GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; > > I did an > Options[Plot] > > but could not figure out how to do it from there. > > Thanks in advance, > > Steven Shippee > slshippee@comcast.net > See Mathematica-Book 2.9.5 Labeling Two­Dimensional Graphics Use the Ticks option: Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400, Ticks -> (Range[Floor[#1], Floor[#2]] &)]; -- Peter Pein Berlin From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Bob Hanlon Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Plot and axes Date: Mon, 15 Nov 2004 01:27:26 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: hanlonr@cox.net Lines: 43 NNTP-Posting-Date: 15 Nov 2004 01:24:36 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=_<5H;ZMVL43I]9knNJ:Q55C_A=>8kQj6=hHXa^^g6TZ41e2KC15Y{{-4,4},{-4,4}}, Frame->False,GridLines->Automatic, AspectRatio->1,ImageSize->400]; or manually specify the Gridlines Plot[0,{x,-4,4},PlotRange->{-4,4}, Frame->False, GridLines->{Range[-4,4],Range[-4,4]}, AspectRatio->1,ImageSize->400]; Bob Hanlon > > From: "Steven Shippee" > Date: 2004/11/14 Sun AM 04:31:08 EST > To: mathgroup@smc.vnet.net > Subject: Plot and axes > > > I would like to get the marks on my "x" axis to show as '1, 2, 3, 4', just > like the "y" axis, but by default they show as '2,4' - is there an easy way > to find this in the help files? > > coordaxes = > Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, > GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; > > I did an > Options[Plot] > > but could not figure out how to do it from there. > > Thanks in advance, > > Steven Shippee > slshippee@comcast.net > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!prodigy.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "David Park" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Plot and axes Date: Mon, 15 Nov 2004 01:28:27 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 79 NNTP-Posting-Date: 15 Nov 2004 01:25:37 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=h5COKUB3MMI^0S5=_@A1nOC_A=>8kQj6MhHXa^^g6TZDdH4leX5AV6DEFiONJ7[GoFYiHB<>cgG4L X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51354 Steven, Specify the ticks and grids as follows. Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, Ticks -> {Range[-4, 4, 1], Range[-4, 4, 1]}, GridLines -> {Range[-4, 4, 1], Range[-4, 4, 1]}, AspectRatio -> .9, ImageSize -> 400]; There are two small problems with that. Why is the AspectRatio 0.9 instead of Automatic or 1. Wouldn't a square grid be preferable in this case, which I guess is just making a piece of graph paper. A second problem is in using Axes instead of a Frame. The grid lines hide the minus signs on the negative y axis, and also the tick labels are in the middle of the graph paper where they can interfer with a plotted graph. If you page through Science magazine, say, it is nearly impossible to find a graph with axes and tick labels in the middle of the graph. A Frame resolves these problems. Plot[0, {x, -4, 4}, PlotRange -> {{-4, 4}, {-4, 4}}1.05, Frame -> True, Axes -> False, FrameTicks -> {Range[-4, 4, 1], Range[-4, 4, 1], None, None}, GridLines -> {Range[-4, 4, 1], Range[-4, 4, 1]}, AspectRatio -> Automatic, ImageSize -> 400]; Also, if you just want to make graph paper, it can be done without the artifice of plotting a zero function. Here I label only every other tick to make the graph paper less cluttered. Show[Graphics[{}], PlotRange -> {{-4, 4}, {-4, 4}}1.05, Frame -> True, Axes -> False, FrameTicks -> {Range[-4, 4, 2], Range[-4, 4, 2], None, None}, GridLines -> {Range[-4, 4, 1], Range[-4, 4, 1]}, AspectRatio -> Automatic, ImageSize -> 400]; David Park djmp@earthlink.net http://home.earthlink.net/~djmp/ -----Original Message----- From: Steven Shippee [mailto:slshippee@comcast.net] Subject: Plot and axes I would like to get the marks on my "x" axis to show as '1, 2, 3, 4', just like the "y" axis, but by default they show as '2,4' - is there an easy way to find this in the help files? coordaxes = Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; I did an Options[Plot] but could not figure out how to do it from there. Thanks in advance, Steven Shippee slshippee@comcast.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!atl-c02.usenetserver.com!news.usenetserver.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Bill Rowe Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Plot and axes Date: Mon, 15 Nov 2004 01:31:29 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 20 NNTP-Posting-Date: 15 Nov 2004 01:28:39 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=YZ:A_=[f[4lE0G1fKX\WG`C_A=>8kQj6mm^eQlV`f18gI1=fT8m`o1eR`?7ATL[?ekN^Nn5S@@9ie X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51357 On 11/14/04 at 4:31 AM, slshippee@comcast.net (Steven Shippee) wrote: >I would like to get the marks on my "x" axis to show as '1, 2, 3, >4', just like the "y" axis, but by default they show as '2,4' - is >there an easy way to find this in the help files? >coordaxes = Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> >False, GridLines -> Automatic, AspectRatio -> .9, ImageSize -> >400]; Does this do what you are looking for? Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, GridLines -> Automatic, AspectRatio -> 0.9, ImageSize -> 400, Ticks -> {Range[-4, 4], Automatic}]; -- To reply via email subtract one hundred and four From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "symbio" Newsgroups: comp.soft-sys.math.mathematica Subject: execution problem Date: Mon, 15 Nov 2004 01:32:30 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: "symbio" Lines: 5 NNTP-Posting-Date: 15 Nov 2004 01:29:40 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=YZ:A_=[f[48kQj6=m^eQlV`f187I1=fT8m`o15R`?7ATL[?e;QL5dY;j2W_? X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51358 A mysterious problem happens, has anyone experienced this and what is the solution. I have a notebook with cell expressions, when I hit shift-Enter, it doesn't execute, but if I add a space then shift-enter, then it will execute. What is the problem? From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Bob Hanlon Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Poles and Complex Factoring Date: Mon, 15 Nov 2004 01:34:31 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: hanlonr@cox.net Lines: 80 NNTP-Posting-Date: 15 Nov 2004 01:31:41 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=4Q>RbP06N0LOF>SMdW9>gJC_A=>8kQj6MhHXa^^g6TZDcZ4EA:kUDCAEFiONJ7[GoFanSll\\;0_C X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51360 Your solution does not check out (x-2-Sqrt[10])(x-2+Sqrt[10])//ExpandAll -6 - 4*x + x^2 (-b + Sqrt[b^2-4*a*c])/(2a) /. {a->1,b->2,c->10} -1 + 3*I Using Factor as previously posted by several posters: Factor[x^2+2x+10,GaussianIntegers->True] ((1 - 3*I) + x)*((1 + 3*I) + x) Or equating terms: Union[(x-a)(x-b) /. Solve[Thread[CoefficientList[#, x]&/@ (x^2 + 2x + 10 == (x-a)(x-b))], {a,b}]] {((1 - 3*I) + x)*((1 + 3*I) + x)} Bob Hanlon > > From: godfreyau2003@hotmail.com (Godfrey) > Date: 2004/11/14 Sun AM 04:30:12 EST > To: mathgroup@smc.vnet.net > Subject: Poles and Complex Factoring > > On 11 Feb 1997 01:29:40 -0500, peter wrote: >Dear All, > >I know how to calculate the residue of a fuction using Mathematica, but how > can I >use Mathematica to calculate the order of a complex pole? > >It would also be nice for Mathematica to tell me if a particular singularity > is an >essential singularity, removable singularity or a pole...but this is > not >necessary; just icing on the cake. > >Also, is there a way to factor polynomials with imaginary roots? >Something like: > > Factor[ x^2 + 2x + 10 ] = (x - 1 + 4.5 I)(x - 1 - 4.5 I) > >Much thanks in advance! > >Peter > >-- >Birthdays are good for you: A federal funded project has recently > determined >that people with the most number of birthdays will live the > longest..... >-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+- =><=-+-+-=><=-+-+-=><=-+-+-=><=- > I BOYCOTT ANY COMPANY THAT USES MASS ADVERTISING ON THE INTERNET > > Let x^2 + 2x + 10 = (x-a)(x-b) > Obviously, a and b are the roots of the equation x^2 + 2x + 10 = 0 > ------ (*) > By quadratic forumula, we can find that the roots of (*)=2+sqrt(10) or > 2-sqrt(10) > Therefore, > x^2 + 2x + 10 = {x-[2+sqrt(10)]}{x-[2-sqrt(10)]} > ie. x^2 + 2x + 10 = [x-2-sqrt(10)][x-2+sqrt(10)] > > Factorization of other polynomials with imaginary roots can be done in > the same way. > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "tgarza01@prodigy.net.mx" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Plot and axes Date: Mon, 15 Nov 2004 01:35:31 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: tgarza01@prodigy.net.mx Lines: 43 NNTP-Posting-Date: 15 Nov 2004 01:32:42 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=4Q>RbP06N0\4JR]SmgOleWC_A=>8kQj6]MOj3YM9`=aX]dW`deQWQE^EFiONJ7[GoVE7EiWb7j8PU X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51361 You can always define how the marks along the axes should appear in your graph. Use Ticks: In[1]:= coordaxes = Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, Ticks->{Range[-4,4],Range[-4,4]}, GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; Tomas Garza Mexico City Original Message: ----------------- From: Steven Shippee slshippee@comcast.net Subject: Plot and axes I would like to get the marks on my "x" axis to show as '1, 2, 3, 4', just like the "y" axis, but by default they show as '2,4' - is there an easy way to find this in the help files? coordaxes = Plot[0, {x, -4, 4}, PlotRange -> {-4, 4}, Frame -> False, GridLines -> Automatic, AspectRatio -> .9, ImageSize -> 400]; I did an Options[Plot] but could not figure out how to do it from there. Thanks in advance, Steven Shippee slshippee@comcast.net -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ . From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Alan" Newsgroups: comp.soft-sys.math.mathematica Subject: Clearing local variables and Memory Leaks Date: Mon, 15 Nov 2004 01:37:33 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 23 NNTP-Posting-Date: 15 Nov 2004 01:34:43 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=_3h@\f7BBWjB0NmY4I[PAgC_A=>8kQj6mm^eQlV`f18gI1=fT8m`o1eR`?7ATL[?eknU3WIIDAg^b X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51363 I had some long computations that used more and more memory. The advice from someone at WRI responding to a similar problem in an old newsgroup post was to clear local variables in Modules before leaving them. I added a Clear statement to each Module, just before my Return, where I clear every local variable except the one I am returning. Sure enough, this solved my problem. My questions: I am still puzzled as to why it would be dangerous for this behavior to be automatic? That is, once Mathematica has calculated what will be returned, what would go wrong if it cleared every local variable just before returning. If it's *not* dangerous, is there some easy way to force it to happen globally? From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news-FFM2.ecrc.net!news.m-online.net!newsfeed.stueberl.de!news.mailgate.org!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Andrzej Kozlowski Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Poles and Complex Factoring Date: Mon, 15 Nov 2004 08:26:10 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 105 NNTP-Posting-Date: 15 Nov 2004 08:23:19 GMT NNTP-Posting-Host: 7d960482.news.twtelecom.net X-Trace: DXC=R\2RLjajf>d[aEn11>@JieC_A=>8kQj6mMOj3YM9`=ah>k5;YbS4 1 - 3*I, d -> 1 + 3*I}, {c -> 1 + 3*I, d -> 1 - 3*I}} In[2]:= Union[(x + c)*(x + d) /. %] Out[2]= {(x + (1 - 3*I))*(x + (1 + 3*I))} Andrzej Kozlowski On 15 Nov 2004, at 10:15, Bob Hanlon wrote: > Your solution does not check out > > (x-2-Sqrt[10])(x-2+Sqrt[10])//ExpandAll > > -6 - 4*x + x^2 > > (-b + Sqrt[b^2-4*a*c])/(2a) /. {a->1,b->2,c->10} > > -1 + 3*I > > Using Factor as previously posted by several posters: > > Factor[x^2+2x+10,GaussianIntegers->True] > > ((1 - 3*I) + x)*((1 + 3*I) + x) > > Or equating terms: > > Union[(x-a)(x-b) /. Solve[Thread[CoefficientList[#, x]&/@ > (x^2 + 2x + 10 == (x-a)(x-b))], > {a,b}]] > > {((1 - 3*I) + x)*((1 + 3*I) + x)} > > > Bob Hanlon > >> >> From: godfreyau2003@hotmail.com (Godfrey) >> Date: 2004/11/14 Sun AM 04:30:12 EST >> To: mathgroup@smc.vnet.net >> Subject: Poles and Complex Factoring >> >> On 11 Feb 1997 01:29:40 -0500, peter wrote: > Dear All, > > I know how to calculate the residue of a fuction using Mathematica, > but > how >> can I > use Mathematica to calculate the order of a complex pole? > > It would also be nice for Mathematica to tell me if a particular > singularity >> is an > essential singularity, removable singularity or a pole...but this is >> not > necessary; just icing on the cake. > > Also, is there a way to factor polynomials with imaginary roots? > Something like: > > Factor[ x^2 + 2x + 10 ] = (x - 1 + 4.5 I)(x - 1 - 4.5 I) > > Much thanks in advance! > > Peter > > -- > Birthdays are good for you: A federal funded project has recently >> determined > that people with the most number of birthdays will live the >> longest..... > -=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+- > =><=-+-+-=><=-+-+-=><=-+-+-=><=- > I BOYCOTT ANY COMPANY THAT USES MASS ADVERTISING ON THE > INTERNET >> >> Let x^2 + 2x + 10 = (x-a)(x-b) >> Obviously, a and b are the roots of the equation x^2 + 2x + 10 = 0 >> ------ (*) >> By quadratic forumula, we can find that the roots of (*)=2+sqrt(10) or >> 2-sqrt(10) >> Therefore, >> x^2 + 2x + 10 = {x-[2+sqrt(10)]}{x-[2-sqrt(10)]} >> ie. x^2 + 2x + 10 = [x-2-sqrt(10)][x-2+sqrt(10)] >> >> Factorization of other polynomials with imaginary roots can be done in >> the same way. >> >> > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.visi.com!transit-1.news.visi.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: DrBob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: copy and paste Date: Mon, 15 Nov 2004 08:27:15 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411150115.UAA24987@smc.vnet.net> Reply-To: drbob@bigfoot.com Lines: 25 NNTP-Posting-Date: 15 Nov 2004 08:24:24 GMT NNTP-Posting-Host: 7d960482.news.twtelecom.net X-Trace: DXC==NWgik1CDh032fYY\=>JD;C_A=>8kQj6=MOj3YM9`=a8>k5;YbS4 wrote: > This is a very simple question, but I'm finding it difficult to find the > answer, can you please help? I want to copy the text output of some > expressions all at once to notepad, but I get all this other stuff I don't > want to get copied along such as invisible characters, and output #x, etc.. > Can anyone tell me how I can just do a text copy and paste please? By the > way I've tried all the copy As options, and paste as options, nothing works. > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "symbio" Newsgroups: comp.soft-sys.math.mathematica Subject: copy and paste Date: Mon, 15 Nov 2004 01:33:30 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: "symbio" Lines: 7 NNTP-Posting-Date: 15 Nov 2004 01:30:40 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=4EQlGLhacQ5KU3]3@_L3F>C_A=>8kQj6=m^eQlV`f187I1=fT8m`o15R`?7ATL[?e;PfHZhBA@7I: X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51359 This is a very simple question, but I'm finding it difficult to find the answer, can you please help? I want to copy the text output of some expressions all at once to notepad, but I get all this other stuff I don't want to get copied along such as invisible characters, and output #x, etc.. Can anyone tell me how I can just do a text copy and paste please? By the way I've tried all the copy As options, and paste as options, nothing works. From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.maxwell.syr.edu!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: DrBob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: copy and paste Date: Wed, 17 Nov 2004 07:25:25 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411160156.UAA10082@smc.vnet.net> Reply-To: drbob@bigfoot.com Lines: 28 NNTP-Posting-Date: 17 Nov 2004 07:22:34 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=T32Gb2FnQ4^QZDch=kU29[C_A=>8kQj6]MOj3YM9`=aX>Nf`US;7g=ZEFiONJ7[GoVU@mNFXJ[o0X X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51388 I didn't write the palette -- it was posted by Omega Consulting many months ago. Bobby On Mon, 15 Nov 2004 20:56:44 -0500 (EST), Peter Pein wrote: > symbio wrote: >> This is a very simple question, but I'm finding it difficult to find the >> answer, can you please help? I want to copy the text output of some >> expressions all at once to notepad, but I get all this other stuff I don't >> want to get copied along such as invisible characters, and output #x, etc.. >> Can anyone tell me how I can just do a text copy and paste please? By the >> way I've tried all the copy As options, and paste as options, nothing works. >> > If you want to copy as plain text, use either the menu: Edit->Copy As->Plain > Text or download (, install and use) the "Copy as InputForm"-Palette written by > DrBob at http://www.eclecticdreams.net/ > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Peter Pein Newsgroups: comp.soft-sys.math.mathematica Subject: Re: copy and paste Date: Tue, 16 Nov 2004 01:57:22 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 12 NNTP-Posting-Date: 16 Nov 2004 01:54:32 GMT NNTP-Posting-Host: 080842e0.news.twtelecom.net X-Trace: DXC=96e=IOJTnE2?S;kZ6A3^O6C_A=>8kQj6=MOj3YM9`=a8co=dW1mZJ32EFiONJ7[Go6\=YEMVQG^1: X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51374 symbio wrote: > This is a very simple question, but I'm finding it difficult to find the > answer, can you please help? I want to copy the text output of some > expressions all at once to notepad, but I get all this other stuff I don't > want to get copied along such as invisible characters, and output #x, etc.. > Can anyone tell me how I can just do a text copy and paste please? By the > way I've tried all the copy As options, and paste as options, nothing works. > If you want to copy as plain text, use either the menu: Edit->Copy As->Plain Text or download (, install and use) the "Copy as InputForm"-Palette written by DrBob at http://www.eclecticdreams.net/ From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Andrzej Kozlowski Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: Counting Runs Date: Mon, 15 Nov 2004 08:33:25 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <001601c4c8d4$6aecc3e0$6400a8c0@Main> <006b01c4c998$29b9a220$6400a8c0@Main> <200411140930.EAA14521@smc.vnet.net> Lines: 52 NNTP-Posting-Date: 15 Nov 2004 08:30:34 GMT NNTP-Posting-Host: 7d960482.news.twtelecom.net X-Trace: DXC==Jd6GEimS3Vc2Q2mco@>IVC_A=>8kQj6]MOj3YM9`=aX>Nf`US;7g=ZEFiONJ7[GoVZo6EhAUDTlZ X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51372 >> I think Abs, Tr, and BitXor are very fast because they are probably >> optimized for integer input and the use of packed arrays. > > I don't think an optimization for integers can be effective if > functions take time to CHECK whether the array contains only integers. > Is that precomputed for packed arrays, somehow? > > Bobby Yes, that's precisely what packed arrays do. Actually you can check precisely the effect of packed arrays in this case: << "Developer`" runs[int_, data_] := Module[{modlist}, modlist = Sign[Abs[data - int]]; Tr[BitXor[modlist, RotateRight[modlist]]]/2 + 1 - BitOr[modlist[[1]], modlist[[-1]]]] runs1[int_, data_] := Module[{modlist, dt = FromPackedArray[data]}, modlist = FromPackedArray[Sign[Abs[dt - int]]]; Tr[BitXor[modlist, RotateRight[modlist]]]/2 + 1 - BitOr[modlist[[1]], modlist[[-1]]]] seq = Table[Random[Integer, 10], {10^6}]; Timing[runs[3, seq]] {0.4299999999999997*Second, 83183} Timing[runs1[3, seq]] {0.9299999999999997*Second, 83183} So just over 50% performance increase. Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "Fred Simons" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: Counting Runs Date: Mon, 15 Nov 2004 01:30:28 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA01037@smc.vnet.net> Lines: 40 NNTP-Posting-Date: 15 Nov 2004 01:27:38 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=VAfhZo:Ea[WmmJjon<[c^_C_A=>8kQj6]=_1NR_H?JP]^:T@Q3 Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Counting Runs Date: Sun, 14 Nov 2004 09:59:12 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <001601c4c8d4$6aecc3e0$6400a8c0@Main> <006b01c4c998$29b9a220$6400a8c0@Main> Reply-To: drbob@bigfoot.com Lines: 43 NNTP-Posting-Date: 14 Nov 2004 09:56:23 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=Z9hmdTLJ7=ncJhQ8kQj6m=_1NR_H?JPm^:T@Q3 I think Abs, Tr, and BitXor are very fast because they are probably > optimized for integer input and the use of packed arrays. I don't think an optimization for integers can be effective if functions take time to CHECK whether the array contains only integers. Is that precomputed for packed arrays, somehow? Bobby On Sat, 13 Nov 2004 10:47:59 -0500, Carl K. Woll wrote: > Hi Bob, > > I think Abs, Tr, and BitXor are very fast because they are probably > optimized for integer input and the use of packed arrays. On the other hand, > I doubt that there are any such optimizations for integers or packed arrays > for the functions Part, Split and Sort. > > At any rate, Andrzej Kozlowsky has kindly provided an improvement, so that > the following runs function is almost twice as fast as my previous one. > > runs[int_,data_]:=Module[{modlist}, > modlist=Sign[Abs[data-int]]; > Tr[BitXor[modlist,RotateRight[modlist]]]/2+1-BitOr[modlist[[1]],modlist[[-1]]]]Carl Woll----- Original Message -----From: "DrBob" To: "Carl K. Woll" Sent: Saturday, November 13, 2004 3:44 AMSubject: Re: Counting Runs> Carl,>> Here are timings for substeps of "runs" and "hanlonTreat":>> data = sample[10^6];> Timing[{Timing[s = data - 1; Subtract],> Timing[s = Abs[s]; Abs],> Timing[(Abs[Quotient[#1, #1 + 1, 1]] & )[s];> Abs[Quotient]]}]> Timing[(Abs[Quotient[#1, #1 + 1, 1]] & )[Abs[data - 1]];> modlist]> Timing[runs[1, data]; runs]> Timing[{Timing[s = Split[data]; Print[Length[s]]; Split],> Timing[s = s[[All,1]]; Part], Timing[s = Sort[s]; Sort],> Timing[s = Split[s]; Split],> Timing[({First[#1], Length[#1]} & ) /@ s; Map]}]> Timing[hanlonTreat[data]; hanlonTreat]>> {0.11 Second,{{0.032 Second,Subtract},{0. Second,Abs},{> 0.078 Second,Abs[Quotient]}}}> {0.125 Second,modlist}> {0.125 Second,runs}> 687139> ! > {0.656 Second,{{0.25 Second,> Split},{0.156 Second,Part},{0.187 Second,> Sort},{0.063 Second,Split},{0. Second,Map}}}> {0.641 Second,hanlonTreat}>> Within "hanlonTreat", it appears that Split, Part, and Sort are eachslower than "runs" in its entirety, even though Part and Split are operatingon a shorter list than "data". Meanwhile, "runs" is making five passesthrough "data" or an equally long list.>> Part takes 2/3 as much time as Sort, but Abs, Tr, BitXor, and RotateRighttake almost no time at all.>> A lot of this seems very counterintuitive.>> If WRI made it clear what functions are well-optimized and which are not,it would be very helpful.>> Bobby>> On Fri, 12 Nov 2004 11:26:48 -0500, Carl K. Woll wrote:> Hi all,>> This problem reminded me of one from a couple years ago where we neededto>> count the occurences of a 1 followed by a 0 in a list of 1s and 0s.Knowing>> how many times a 1 is followed by a 0 essentially tells you how many ! > runsof>> 1s there are. There the fastest method ended up using Tr and > BitXor.>> This suggests that we can count the number of runs of any particularinteger>> in a sequence of integers if we can convert the sequence to 1s for that>> integer and 0s for everything else. Doing this conversion turned out tobe>> troublesome, but I managed to come up with a method that is pretty fast.If>> the sequence is data, then the following expression will have 1s for the>> integer int and 0s for everything else:>> Abs@Quotient[#,#+1,1]&@Abs[data-int]>> Now that we have an expression of just 1s and 0s, we can count how manyruns>> of 1s there are. The following function counts the number of runs of intin>> the sequence data:>> runs[int_,data_]:=Module[{modlist},>> modlist=Abs@Quotient[#,#+1,1]&@Abs[data-int];>>Tr[BitXor[modlist,RotateRight[modlist]]]/2+BitAnd[modlist[[1]],modlist[[-1]]]]For a sequence of a million integers, the above runs function can findthenumber of runs of a single integer about 7 to 10 or more times faster (onmymachine) than your han! > lonTreat function can find the number of runs ofallthe integers, depending on how many different integers are in thesequence.So, if there are fewer than 7 different integers it would be fasterto usethe above runs function to find the occurrences of all the runs.Itturns out that going from Abs[data-int] which has 0s for every occurenceofint and positive integers for the other integers to 1s for int and 0sforeverything else takes the majority of the time (over 75%). A nicechallengewould be to come up with a faster method to convert a sequence of0s andpositive integers to 0s and 1s, where 1 replaces every positiveinteger.I'll post this challenge in another thread.Carl Woll"DrBob" wrote in messagenews:!> cm!>> hvag$prj$1@smc.vnet.net...> I've updated my notebook again, under theRun Counts link at:>> http://eclecticdreams.net/DrBob/mathematica.htm>> I'mnot sure whether solver performance depends mostly on the number ofruns, orthe number of different values in! > a data list. The two are somewhatinverselyrelated, of course.>> The f > astest solvers are brt4 (using Frequencies) andhanlonTreat (hanlon3,with Part instead of Map).>> Bobby>> On Fri, 5 Nov 200420:33:23 -0500, János wrote:> It must be machine orOS dependent.>> I re-discovered Hanlon3 method :) and ran it with Bobby'snewest. I>> don't have Bobby's data so I generated random didgits in the0-9 range>> Here are the results:>> In[28]:=>> v =Table[Random[Integer,>> {0, 9}], {i, 1, 10^7}];>> In[29]:=>>Timing[({First[#1],>> Length[#1]} & ) /@>> Split[Sort[First /@>>Split[v]]]]>> Out[29]=>> {35.58*Second, {{0, 898901},>> {1, 899397}, {2,901191},>> {3, 899449!> },!>> {4, 900824},>> {5, 900262}, {6, 899338},>> {7, 900293}, {8, 9>> 00196},>> {9, 901311}}}>> In[32]:=>> Timing[({First[#1],>>Length[#1]} & ) /@>> Split[Sort[Split[v][[All,>> 1]]]]]>>Out[32]=>> {38.67999999999998*Second,>> {{0, 898901}, {1, 899397},>>{2, 901191}, {3, 899449},>> {4, 900824}, {5, 900262},>>! > {6, 899338},{7, 900293},>> {8, 900196}, {9, 901311}}}>> My machine is a 1.25Ghz G4with 2G Ram and with OSX 10.3.5.>> János>> On Nov 5, 2004, at 7:38 PM,DrBob wrote:> I found an even faster (rather obvious) solution:>>hanlonTreat[v_] := {First@#, Length@#} & /@ Split@Sort[Split[v][[All,>1]]]>> It about 80% faster than hanlon4.>> Bobby>> On Fri, 05Nov 2004 17:16:56 -0600, DrBob wrote:> I timed theposted methods except Andrzej's -- it's the only one that>> works only for+1/-1 data -- plus a couple of my own that I haven't>> posted. DavidPark's method seems the same as the fastest method,>> hanlon3. I modifiedall methods to return !> a !>> pair {x, number of runs>> in x} for each x in the data.>> Two ofBob Hanlon's methods beat all the rest of us -- but one of his>> is theslowest method, too.>> I've posted a notebook at the Run Counts linkat:>> http://eclecticdreams.net/DrBob/mathematica.h! > tm>>Bobby>> On Fri, 5 Nov 2004 02:17:54 -0500 (EST), Selwy > n Hollis>> wrote:> Hi Greg,>> Thefollowing seems to work pretty well:>> runscount[lst_?VectorQ]:=> Module[{elems, flips, counts},> elems =Union[lst];> flips = Cases[Partition[lst, 2, 1], {x_, y_} /; x=!= y];> counts = {#, Count[Most[flips], {#, _}]} & /@elems;> {x1, x2} = Last[flips];> counts /. {{x1,y_} -> {x1, y+1}, {x2, y_} -> {x2, y+1}}]>> Example:>>Table[Random[Integer, {1, 5}], {20}]> runscount[%]>> {2,2, 3, 1, 3, 2, 2, 3, 1, 1, 2, 3, 1, 1, 3, 1, 1, 2,!> 2!>> , 2}>> {{1, 4}, {2, 4}, {3, 5}}> -----> Selwyn Hollis> http://www.appliedsymbols.com> (edit reply-to toreply)> On Nov 4, 2004, at 1:50 AM, Gregory Lypnywrote:> Looking for an elegant way to count runs to numbers in aseries.>> Suppose I have a list of ones and negative ones such as>! > >v={1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,1}.>> I'd like to create a functionthat counts the number of runs of 1s>> and>> -1s, which in this caseis 3 and 2.>>Greg>> -->DrBob@bigfoot.com>www.eclecticdreams.net>> ------------------------------------------------------------------->> János Löbb>> Yale University School of Medicine>>Department of Pathology>> Phone: 203-737-5204>> Fax: 203-785-7303>>E-mail: janos.lobb@yale.edu>> --> DrBob@bigfoot.com>www.eclecticdreams.net> --> DrBob@bigfoot.com> www.eclecticdreams.net> > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!in.100proofnews.com!in.100proofnews.com!opentransit.net!newsfeed.yul.equant.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Carl K. Woll" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Counting Runs Date: Sun, 14 Nov 2004 09:44:57 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <001601c4c8d4$6aecc3e0$6400a8c0@Main> Lines: 12 NNTP-Posting-Date: 14 Nov 2004 09:42:07 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=hoTKC;AKO;ah`C_A=>8kQj6mhHXa^^g6TZdLCE^3V]_2EeEFiONJ7[Gof4@Fh>hOh\ Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: Counting Runs Date: Mon, 8 Nov 2004 08:21:08 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411070603.BAA18066@smc.vnet.net> Reply-To: drbob@bigfoot.com Lines: 44 NNTP-Posting-Date: 08 Nov 2004 08:18:21 GMT NNTP-Posting-Host: 6ffc1292.news.twtelecom.net X-Trace: DXC=1EknhPEJdcLOF>SMdW9>gJC_A=>8kQj6MhHXa^^g6TZDDFB78Rk0MABEFiONJ7[GoF=B]nh29:_hM X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51177 Highlight any built-in (almost) and press the Help key, and you'll easily find out what it is. I have Needs["Statistics`"] in my Init.m file, so I never load or think about stat packages. I recommend you do the same. I do the same with graphics by including Needs["Graphics`"]. It saves a lot of time. >> Since this the same as one of your other suggestions, how can using this version of Frequencies be faster? I hadn't noticed they were the same; I assumed Frequencies was compiled and optimized. Looking back on the timings again, I notice brt4 and hanlonTreat are within 4% on the largest arrays, with neither of them always winning. They are the two fastest solvers, and the difference seem to be random noise. All that being so, I would use the version with Frequencies. Bobby On Sun, 7 Nov 2004 01:03:46 -0500 (EST), Bill Rowe wrote: > > > On 11/6/04 at 2:08 AM, drbob@bigfoot.com (DrBob) wrote: > >> And the new winner -- for both speed and simplicity -- is: > >> brt4[v_List] := Frequencies@Split[v][[All, 1]] > > Where is the function Frequencies to be found? > > If it is the function found in Statistics`DataManipulation` then that is coded > > {Length[#],First[#]}&/@Split[Sort[list]] > > Since this the same as one of your other suggestions, how can using this version of Frequencies be faster? > -- > To reply via email subtract one hundred and four > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx01.iad01.newshosting.com!news-out.visi.com!transit-1.news.visi.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Bill Rowe Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Counting Runs Date: Sun, 7 Nov 2004 08:14:57 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 16 NNTP-Posting-Date: 07 Nov 2004 08:12:11 GMT NNTP-Posting-Host: 7ff8e4ce.news.twtelecom.net X-Trace: DXC=e@@VXL^E5hbe?MSbgY:QQnC_A=>8kQj6mMOj3YM9`=ahj_P<\9^\B`lEFiONJ7[GofUT5HF5_QO^m X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51162 On 11/6/04 at 2:08 AM, drbob@bigfoot.com (DrBob) wrote: >And the new winner -- for both speed and simplicity -- is: >brt4[v_List] := Frequencies@Split[v][[All, 1]] Where is the function Frequencies to be found? If it is the function found in Statistics`DataManipulation` then that is coded {Length[#],First[#]}&/@Split[Sort[list]] Since this the same as one of your other suggestions, how can using this version of Frequencies be faster? -- To reply via email subtract one hundred and four From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Andrzej Kozlowski Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: Counting Runs Date: Mon, 15 Nov 2004 08:34:26 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 61 NNTP-Posting-Date: 15 Nov 2004 08:31:35 GMT NNTP-Posting-Host: 7d960482.news.twtelecom.net X-Trace: DXC==Jd6GEimS3f3Y[822][L=nC_A=>8kQj6mMOj3YM9`=ah>k5;YbS4kIiaiaf X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51373 Actually, this is not a very good test, since unpacking a large array also takes a non-negligible amount of time. The real effect should be somewhat larger. Andrzej On 15 Nov 2004, at 16:54, Andrzej Kozlowski wrote: > I think Abs, Tr, and BitXor are very fast because they are probably > optimized for integer input and the use of packed arrays. >> >> I don't think an optimization for integers can be effective if >> functions take time to CHECK whether the array contains only >> integers. Is that precomputed for packed arrays, somehow? >> >> Bobby > > > Yes, that's precisely what packed arrays do. Actually you can check > precisely the effect of packed arrays in this case: > > > << "Developer`" > > > runs[int_, data_] := Module[{modlist}, > modlist = Sign[Abs[data - int]]; > Tr[BitXor[modlist, RotateRight[modlist]]]/2 + 1 - > BitOr[modlist[[1]], modlist[[-1]]]] > > > runs1[int_, data_] := > Module[{modlist, dt = FromPackedArray[data]}, > modlist = FromPackedArray[Sign[Abs[dt - int]]]; > Tr[BitXor[modlist, RotateRight[modlist]]]/2 + 1 - > BitOr[modlist[[1]], modlist[[-1]]]] > > > seq = Table[Random[Integer, 10], {10^6}]; > > > Timing[runs[3, seq]] > > > {0.4299999999999997*Second, 83183} > > > Timing[runs1[3, seq]] > > > {0.9299999999999997*Second, 83183} > > So just over 50% performance increase. > > > Andrzej Kozlowski > Chiba, Japan > http://www.akikoz.net/~andrzej/ > http://www.mimuw.edu.pl/~akoz/ > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: DrBob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: Counting Runs Date: Tue, 16 Nov 2004 01:58:24 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 70 NNTP-Posting-Date: 16 Nov 2004 01:55:35 GMT NNTP-Posting-Host: 080842e0.news.twtelecom.net X-Trace: DXC=CN5_A_g9YemfMDbMQQNgfbC_A=>8kQj6mMOj3YM9`=ah]dW`deQWQEnEFiONJ7[Gof;IJbX5Y9\2c X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51375 That seems to prove only that there's an optimization for packed arrays -- not for integer input. Am I missing something? Bobby On Mon, 15 Nov 2004 16:54:37 +0900, Andrzej Kozlowski wrote: > I think Abs, Tr, and BitXor are very fast because they are probably > optimized for integer input and the use of packed arrays. >> >> I don't think an optimization for integers can be effective if >> functions take time to CHECK whether the array contains only integers. >> Is that precomputed for packed arrays, somehow? >> >> Bobby > > > Yes, that's precisely what packed arrays do. Actually you can check > precisely the effect of packed arrays in this case: > > > << "Developer`" > > > runs[int_, data_] := Module[{modlist}, > modlist = Sign[Abs[data - int]]; > Tr[BitXor[modlist, RotateRight[modlist]]]/2 + 1 - > BitOr[modlist[[1]], modlist[[-1]]]] > > > runs1[int_, data_] := > Module[{modlist, dt = FromPackedArray[data]}, > modlist = FromPackedArray[Sign[Abs[dt - int]]]; > Tr[BitXor[modlist, RotateRight[modlist]]]/2 + 1 - > BitOr[modlist[[1]], modlist[[-1]]]] > > > seq = Table[Random[Integer, 10], {10^6}]; > > > Timing[runs[3, seq]] > > > {0.4299999999999997*Second, 83183} > > > Timing[runs1[3, seq]] > > > {0.9299999999999997*Second, 83183} > > So just over 50% performance increase. > > > Andrzej Kozlowski > Chiba, Japan > http://www.akikoz.net/~andrzej/ > http://www.mimuw.edu.pl/~akoz/ > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!in.100proofnews.com!in.100proofnews.com!hamilton.zen.co.uk!zen.net.uk!demorgan.zen.co.uk!195.40.4.120.MISMATCH!easynet-quince!easynet.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Joerg Schaber Newsgroups: comp.soft-sys.math.mathematica Subject: NMinimize options Date: Tue, 16 Nov 2004 02:00:27 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 16 NNTP-Posting-Date: 16 Nov 2004 01:57:38 GMT NNTP-Posting-Host: 080842e0.news.twtelecom.net X-Trace: DXC=2>CXDaI;^TVmmJjon<[c^_C_A=>8kQj6]MOj3YM9`=aXQFVcK^QMbn[EFiONJ7[GoV=lm4gB^jf@V X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51377 Hi, I am using the global optimization method "DifferentialEvolution" and "SimulatedAnnealing" of NMinimize. Unfortunately, even the "Advanced Documentation" is rather scarce and does not explain every option you have to adapt those methods to your problem. Is there more information on these options around or more examples? Specifically I would like to learn more about the options "PenaltyFuntion", "PostProcess" and "PerturbationScale". Another question is whether I can specify just a subset of "SearchPoints" by "InitalPoints"? best, joerg From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!nntp.giganews.com.MISMATCH!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Ian Roberts Newsgroups: comp.soft-sys.math.mathematica Subject: Re: 64 bit cpu and Mathematica on windows. Date: Tue, 16 Nov 2004 02:01:32 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411150115.UAA25002@smc.vnet.net> <200411150817.DAA29819@smc.vnet.net> Lines: 50 NNTP-Posting-Date: 16 Nov 2004 01:58:42 GMT NNTP-Posting-Host: 080842e0.news.twtelecom.net X-Trace: DXC=S9h68kQj6]hHXa^^g6TZTdH4leX5AV6TEFiONJ7[GoV6;YbY:NRYbR X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51378 WRI advertise Mathematica 5 for AMD64, see: http://www.wolfram.com/news/amd64.html. I presume that this is the "Linux (64 bit optimized) " version . They have checked compatibility with SUSE Linux Enterprise Server 8 which supports 64 bit technology, hopefully this means that its OK on SUSE's desktop version; see http://www.suse.com/us/private/products/suse_linux/prof/64bit.html. So it looks as though a cheap 64 bit Mathematica is possible. Has anybody done it? Ian Quantica P/L DrBob wrote: >To see any improvement, I think you'll need a 64-bit version of Windows (not yet released) and a 64-bit version of Mathematica (also not released). > >Bobby > >On Sun, 14 Nov 2004 20:15:24 -0500 (EST), sean kim wrote: > > > >>http://www.wolfram.com/news/sgiirix.html >> >>has info on sgi machines >> >>will Mathematica run faster on a windows machine with 64 bit cpu? >> >>like.. this one. >> >>http://www.emachines.com/products/products.html?prod=eMachines_T3256 >> >>that's only 600 bucks! >> >>or dooes wri need to release a new version of Mathematica that is optimized >>for 64bit windows cpu? >> >>thanks for any insights. >> >> >> >> >> >> > > > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: David Bailey Newsgroups: comp.soft-sys.math.mathematica Subject: Re: 64 bit cpu and Mathematica on windows. Date: Wed, 17 Nov 2004 07:27:26 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411150115.UAA25002@smc.vnet.net> <200411150817.DAA29819@smc.vnet.net> Lines: 23 NNTP-Posting-Date: 17 Nov 2004 07:24:35 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=>:A2`7CZgNlUBBm:>@A=?iC_A=>8kQj6mhHXa^^g6TZdcZ4EA:kUDCaEFiONJ7[Gof9hG1a[D@\0c X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51390 Just a little further information. First, there has been a good, stable beta of Windows XP for AMD64 available (free) for some time. For once, Intel are playing catchup and just starting to produce "64-bit extended" chips that are compatible with the AMD hardware. The AMD 64-bit design is extremely neat for a lot of reasons. In particular, if you run a 64-bit operating system you can run both 32-bit and 64-bit code. 32-bit applications - such as your regular Mathematica for Windows - can then address more or less the whole 4-Gigabyte address space (rather than a typical 1.5G) because the operating system runs in 64-bit mode even when it is servicing 32-bit applications - so it does not use up any of the 4G theoretical limit. The 64 bit Mathematica should be able to address a vast quantity of memory. Of course, to be able to access all this memory it has to be physically present on your machine. I probably sound as though I work for AMD, but I don't - I just like their 64-bit design! David Bailey From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: DrBob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: 64 bit cpu and Mathematica on windows. Date: Mon, 15 Nov 2004 08:28:19 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411150115.UAA25002@smc.vnet.net> Reply-To: drbob@bigfoot.com Lines: 33 NNTP-Posting-Date: 15 Nov 2004 08:25:28 GMT NNTP-Posting-Host: 7d960482.news.twtelecom.net X-Trace: DXC=8DYVC_A=>8kQj6=MOj3YM9`=a8>k5;YbS4 wrote: > http://www.wolfram.com/news/sgiirix.html > > has info on sgi machines > > will Mathematica run faster on a windows machine with 64 bit cpu? > > like.. this one. > > http://www.emachines.com/products/products.html?prod=eMachines_T3256 > > that's only 600 bucks! > > or dooes wri need to release a new version of Mathematica that is optimized > for 64bit windows cpu? > > thanks for any insights. > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: sean_incali@yahoo.com (sean kim) Newsgroups: comp.soft-sys.math.mathematica Subject: 64 bit cpu and Mathematica on windows. Date: Mon, 15 Nov 2004 01:36:32 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 17 NNTP-Posting-Date: 15 Nov 2004 01:33:42 GMT NNTP-Posting-Host: 80a9f8e4.news.twtelecom.net X-Trace: DXC=_3h@\f7BBWZFN@OB;kJQ9VC_A=>8kQj6]MOj3YM9`=aX>k5;YbS4 Newsgroups: comp.soft-sys.math.mathematica Subject: Help in solving PDF equations Date: Tue, 16 Nov 2004 02:02:32 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 18 NNTP-Posting-Date: 16 Nov 2004 01:59:42 GMT NNTP-Posting-Host: 080842e0.news.twtelecom.net X-Trace: DXC=S9h68kQj6mMOj3YM9`=ahj_P<\9^\B`lEFiONJ7[GofoK5VIl<=nDn X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51379 Could anybody please help me in solving the following PDF equation? (p + r/rou)*(1- (Derivative[1, 0][f][x, t])^2 - k * Derivative[0, 1][f][x, t])/Sqrt[1 + (Derivative[1, 0][f][x, t])^2] ==0 with initial or boundary conditions as f[x, 0] == -1 Derivative[0, 1][f][x, 0] == p/k Derivative[1, 0][f][R0, t] == 0 f[x, t] == If[0<= x <=1, Sqrt[1 - x^2]] where, p, k, R0 and rou are constants. Thanks in advance. Wei From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Paul Abbott Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Help in solving PDF equations Date: Wed, 17 Nov 2004 07:26:26 +0000 (UTC) Organization: The University of Western Australia Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 77 NNTP-Posting-Date: 17 Nov 2004 07:23:35 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=>:A2`7CZgNl4kSL3l`8\3hC_A=>8kQj6m=_1NR_H?JPm^:T@Q3, Wei Wang wrote: > Could anybody please help me in solving the following PDF equation? > > (p + r/rou)*(1- (Derivative[1, 0][f][x, t])^2 - k * Derivative[0, 1][f][x, > t])/Sqrt[1 + (Derivative[1, 0][f][x, t])^2] ==0 Clearly, the left-hand side of this expression vanishes if its numerator does: de = (1- Derivative[1, 0][f][x, t]^2 - k Derivative[0, 1][f][x, t]) == 0 and Mathematica can solve this partial differential equation in closed form: sol = DSolve[de, f, {x, t}] > with initial or boundary conditions as > > f[x, 0] == -1 Applying this initial condition f[x, 0] == -1 /. sol one can find the two undetermined coefficients: coefs = SolveAlways[#,x]& /@ % // Union The solution then reads f[x, t] /. sol /. coefs // Flatten // Union {t/k - 1} which is independent of x. Note that the denominator of the original equation reduces to unity as can be seen by evaluating 1 + Derivative[1, 0][f][x, t]^2 /. sol /. coefs > Derivative[0, 1][f][x, 0] == p/k This condition can only be satisfied if p == 1 as can be seen from Derivative[0, 1][f][x, 0] == p/k /. sol /. coefs > Derivative[1, 0][f][R0, t] == 0 This condition is satisfied since f is independent of x, Derivative[1, 0][f][R0, t] == 0 /. sol /. coefs > f[x, t] == If[0<= x <=1, Sqrt[1 - x^2]] This does not make sense to me. The right-hand side does not depend on t. If you mean this to hold for a fixed t then it is incompatible with the general solution determined above. > where, p, k, R0 and rou are constants. The supplied conditions determine p but k, R0, and rou are not determined. Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul@physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: neat sums and pattered randomness Date: Tue, 16 Nov 2004 02:03:33 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: tftn@earthlink.net Lines: 49 NNTP-Posting-Date: 16 Nov 2004 02:00:44 GMT NNTP-Posting-Host: c36b5d71.news.twtelecom.net X-Trace: DXC=;cT0Q]i>ST8RB35k`Hh4L;C_A=>8kQj6=hHXa^^g6TZ41e2KC15YTrue,PlotRange->All] b=Sort[Table[N[x[n],digits],{n,0,digits}]]; ListPlot[b,PlotJoined->True,PlotRange->All] Fit[digits*b,{1,x},x] Clear[x] x[n_]:=x[n]=Mod[x[n-1]*2+If[Mod[n,2]==1,n/(n+1),1/(n+1)],1] x[0]=0 Clear[a,b] a=Table[N[x[n],digits],{n,0,digits}]; ListPlot[a,PlotJoined->True,PlotRange->All] b=Sort[Table[N[x[n],digits],{n,0,digits}]]; ListPlot[b,PlotJoined->True,PlotRange->All] Fit[digits*b,{1,x},x] Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: Re: neat sums and pattered randomness Date: Wed, 17 Nov 2004 07:32:30 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: tftn@earthlink.net Lines: 34 NNTP-Posting-Date: 17 Nov 2004 07:29:39 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=F8kQj6mhHXa^^g6TZd1e2KC15YTrue, PlotRange->All] (* positive version*) Clear[x,y,a,b,s,g,a0] x[n_]:=x[n]=Mod[x[n-1]*2+If[Mod[n,2]==1,2*n/(n^2+1),(-1+n^2)/(n^2+1)],1] y[n_]:=y[n]=Mod[y[n-1]*2+If[Mod[n,2]==1,(-1+n^2)/(n^2+1),2*n/(n^2+1)],1] x[0]=0;y[0]=0; a0=Table[{x[n],y[n]},{n,0, 200}]; ListPlot[a0,PlotJoined->True, PlotRange->All] Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: Re: neat sums and pattered randomness Date: Wed, 17 Nov 2004 07:29:28 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: tftn@earthlink.net Lines: 71 NNTP-Posting-Date: 17 Nov 2004 07:26:37 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=JRjbQVf?YXJD0`7P96diRHC_A=>8kQj6MhHXa^^g6TZD4\7d95FA4RFEFiONJ7[GoFZZT:oho\U`D X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51392 I thought to use a method I just developed for maps on this pair of iterations: (* Pair Iteration gives a Line :y=-x+1*) x[n_]:=x[n]=Mod[x[n-1]*2+If[Mod[n,2]==1,n/(n+1),1/(n+1)],1] y[n_]:=y[n]=Mod[y[n-1]*2+If[Mod[n,2]==1,1/(n+1),n/(n+1)],1] x[0]=0;y[0]=0; a0=Table[{x[n],y[n]},{n,0, 200}]; ListPlot[a0,PlotJoined->True, PlotRange->All] Plot[-x+1,{x,0,1}] Roger Bagula wrote: >In my fractal nonlinear IFS work I have used the rational pair >(n/(n+1),1/(n+1)) >to produce several new fractals. >I know that it behaves very much in IFS like a nonlinear Cantor set. >I made up Log[2] like sums alternating the pairs. >The result is two irrational numbers that are summed to one. >In the iterations based on these sum functions, >I get patterned noise, but they still give a sorted slope of one. >The result appears to be a paired noise pattern. > >(* a pair of sums from rational pairs (n/(1+n),1/(n+1))*) >(* >1st=0.5224031171170045693773071024046350601893524864083449381053044765826974398161552455727317173783003561708929280568165560107397662133885113895083716587179298436322129249418632659176904330363338074199274*) >(* >2nd=0.4775968828829954306226928975953649398106475135916550618946949011157747740696740400208629046092755848038901998264701338775987548167280850721475099467997575850060913783991812218340970953593189635761664*) >(*1st+2nd=1*) >f[n_]=If[Mod[n,2]==1,1/((n+1)*2^n),n/((n+1)*2^n)] >digits=200 >a=Table[N[f[n],digits],{n,1,digits}]; >b=N[Apply[Plus,a],digits] >Clear[f,a,b] >f[n_]=If[Mod[n,2]==1,n/((n+1)*2^n),1/((n+1)*2^n)] >a=Table[N[f[n],digits],{n,1,digits}]; >b=N[Apply[Plus,a],digits] > >(* iterations based on these that have patterns in them*) >x[n_]:=x[n]=Mod[x[n-1]*2+If[Mod[n,2]==1,1/(n+1),n/(n+1)],1] > x[0]=0 >Clear[a,b] >a=Table[N[x[n],digits],{n,0,digits}]; >ListPlot[a,PlotJoined->True,PlotRange->All] >b=Sort[Table[N[x[n],digits],{n,0,digits}]]; >ListPlot[b,PlotJoined->True,PlotRange->All] >Fit[digits*b,{1,x},x] >Clear[x] >x[n_]:=x[n]=Mod[x[n-1]*2+If[Mod[n,2]==1,n/(n+1),1/(n+1)],1] > x[0]=0 >Clear[a,b] >a=Table[N[x[n],digits],{n,0,digits}]; >ListPlot[a,PlotJoined->True,PlotRange->All] >b=Sort[Table[N[x[n],digits],{n,0,digits}]]; >ListPlot[b,PlotJoined->True,PlotRange->All] >Fit[digits*b,{1,x},x] >Respectfully, Roger L. Bagula > >tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : >alternative email: rlbtftn@netscape.net >URL : http://home.earthlink.net/~tftn > > > -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: =?ISO-8859-1?Q?J=E1nos?= Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Tue, 16 Nov 2004 02:04:34 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA01037@smc.vnet.net> Lines: 38 NNTP-Posting-Date: 16 Nov 2004 02:01:44 GMT NNTP-Posting-Host: c36b5d71.news.twtelecom.net X-Trace: DXC=FcRc\:o^Fm5]\7jU_c8kQj6=MOj3YM9`=a8j_P<\9^\B` Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers > in a > long sequence of nonnegative integers to 1, so that the sequence > consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll > > ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice) From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.cwix.com!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Selwyn Hollis Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 09:51:03 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA01037@smc.vnet.net> Lines: 40 NNTP-Posting-Date: 14 Nov 2004 09:48:13 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=We_4QiU`j`L54`^_eAU6dKC_A=>8kQj6MhHXa^^g6TZDLCE^3V]_2EEEFiONJ7[GoFPE Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers > in a > long sequence of nonnegative integers to 1, so that the sequence > consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll This one seems a tad faster: (newseq = Mod[#+2,#+1]&@seq;) // Timing {0.16 Second, Null} versus your (newseq = 1 + Quotient[#,#+1,1]&@seq;) // Timing {0.23 Second, Null} ----- Selwyn Hollis http://www.appliedsymbols.com (edit reply-to to reply) From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Andrzej Kozlowski Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 09:38:50 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411130940.EAA01037@smc.vnet.net> Lines: 35 NNTP-Posting-Date: 14 Nov 2004 09:36:00 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=>1Fdi;L3<[7in68kQj6=hHXa^^g6TZ4DFB78Rk0MA2EFiONJ7[Go6dfah0`Bd2Z7 X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51318 On 13 Nov 2004, at 18:40, Carl K. Woll wrote: > Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers > in a > long sequence of nonnegative integers to 1, so that the sequence > consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll > > > This seems to be very much faster: newseq = Sign[seq]; Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.maxwell.syr.edu!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "Carl K. Woll" Newsgroups: comp.soft-sys.math.mathematica Subject: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sat, 13 Nov 2004 10:02:54 +0000 (UTC) Organization: University of Washington Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 18 NNTP-Posting-Date: 13 Nov 2004 10:00:04 GMT NNTP-Posting-Host: d98115e9.news.twtelecom.net X-Trace: DXC=bNKMafW[EJ>]\7jU_c8kQj6=MOj3YM9`=a8>k5;YbS4 Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 10:03:15 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: "Peltio" Lines: 26 NNTP-Posting-Date: 14 Nov 2004 10:00:26 GMT NNTP-Posting-Host: 5bbf2f9f.news.twtelecom.net X-Trace: DXC=b78kQj6]hHXa^^g6TZTLCE^3V]_2EUEFiONJ7[GoV46E4bO3ceMQ X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51342 "Carl K. Woll" wrote >Inspired by the recent thread on counting runs, I have the following >challenge. Come up with a method to convert all the positive integers in a >long sequence of nonnegative integers to 1, so that the sequence consists >of only 0s and 1s. Let the sequence be given by > >seq = Table[Random[Integer, 10], {10^6}]; > >Then, one technique is > >newseq = 1+Quotient[#,#+1,1]&@seq; > >Can anyone do better? Can't test it right now, but how about newseq = Sign@seq; ? cheers, Peltio From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Peter Pein Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 10:00:13 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 40 NNTP-Posting-Date: 14 Nov 2004 09:57:23 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=YB]R`dOZUff=QP@4D8HBWiC_A=>8kQj6mhHXa^^g6TZdLIK5ZkUUj_mEFiONJ7[Gof`C: Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers in a > long sequence of nonnegative integers to 1, so that the sequence consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll > > Sign[.] is simpler, isn't it? In[1]:= seq = Table[Random[Integer, 10], {10^6}]; In[2]:= t1 = First@Timing[newseq1 = 1 + Quotient[#, # + 1, 1] &@seq;] Out[2]= 0.671 Second In[3]:= t2 = First@Timing[newseq2 = Sign@seq;] Out[3]= 0.12 Second In[4]:= newseq1 == newseq2 t1/t2 Out[4]= True Out[5]= 5.59167 ..it is :-) -- Peter Pein Berlin From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!news.zanker.org!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!uio.no!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: ab_def@prontomail.com (Maxim) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 09:55:08 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 24 NNTP-Posting-Date: 14 Nov 2004 09:52:18 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=H8;Elo:S;1RXl]78kQj6]hHXa^^g6TZTLCE^3V]_2EUEFiONJ7[GoV5id2OPKW42Z X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51334 "Carl K. Woll" wrote in message news:... > Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers in a > long sequence of nonnegative integers to 1, so that the sequence consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll newseq = Sign[seq] Maxim Rytin m.r@inbox.ru From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: bghiggins@ucdavis.edu (Brian Higgins) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 09:52:04 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 33 NNTP-Posting-Date: 14 Nov 2004 09:49:15 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=RI6=3aQaNI`O8kQj6mhHXa^^g6TZdLCE^3V]_2EeEFiONJ7[Gof?o`JmjW=GDn X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51331 This is the best I could to: seq = Table[Random[Integer, 10], {10^6}]; newseq = 1+Quotient[#,#+1,1]&@seq;//Timing {0.16 Second,Null} newseq2 =(If[#>0,1,0]&)/@seq;//Timing {0.5 Second,Null} Brian "Carl K. Woll" wrote in message news:... > Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers in a > long sequence of nonnegative integers to 1, so that the sequence consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? > > Carl Woll From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx01.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "Eckhard Hennig" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Challenge: Fastest method to convert positive integers to 1 in a long list Date: Sun, 14 Nov 2004 09:39:51 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 31 NNTP-Posting-Date: 14 Nov 2004 09:37:01 GMT NNTP-Posting-Host: 5fe82881.news.twtelecom.net X-Trace: DXC=DU2BDP2EFfD6FY=;QK9:lMC_A=>8kQj6MMOj3YM9`=aH>k5;YbS4 schrieb im Newsbeitrag news:cn4m4e$19p$1@smc.vnet.net... > Hi all, > > Inspired by the recent thread on counting runs, I have the following > challenge. Come up with a method to convert all the positive integers in a > long sequence of nonnegative integers to 1, so that the sequence consists of > only 0s and 1s. Let the sequence be given by > > seq = Table[Random[Integer, 10], {10^6}]; > > Then, one technique is > > newseq = 1+Quotient[#,#+1,1]&@seq; > > Can anyone do better? Sign[seq] Best regards, Eckhard -- Dr.-Ing. Eckhard Hennig www.kaninkolo.de/ai aidev \at kaninkolo \dot de From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Wei Wang Newsgroups: comp.soft-sys.math.mathematica Subject: Help in solving PDF equations Date: Wed, 17 Nov 2004 07:21:21 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 19 NNTP-Posting-Date: 17 Nov 2004 07:18:30 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=cYYb6_FPc]SY\fH5G8kQj6]hHXa^^g6TZT4\7d95FA4RVEFiONJ7[GoVHF``4YKfC, Moderator Message-ID: Lines: 10 NNTP-Posting-Date: 17 Nov 2004 07:19:32 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=cYYb6_FPc]3?S;kZ6A3^O6C_A=>8kQj6=MOj3YM9`=a8>Nf`US;7g=:EFiONJ7[Go6Jhg_>bJ[XM3 X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51385 Hallo! How can substitute some values(the zeros of BesselJ function) in this Integrals? j0[n_] := x /. FindRoot[BesselJ[0, x] == 0, {x, n 2.5}] \!\(s\_l = Array[j0, \ 10]\) Integrate[BesselJ[0,s0*r/R] BesselJ[0,s2*r/R]BesselJ[0,s3*r/R],{r,0,R}] where s0, s1,s2,the Zero-Poles of BesselJ. From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Paul Abbott Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Substitute values in functions!!! Date: Thu, 18 Nov 2004 06:46:23 +0000 (UTC) Organization: The University of Western Australia Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 42 NNTP-Posting-Date: 18 Nov 2004 06:43:31 GMT NNTP-Posting-Host: 185fe79c.news.twtelecom.net X-Trace: DXC=L[iEEh^AT8n@8@bBhcc^SjC_A=>8kQj6mMOj3YM9`=ahj_P<\9^\B`lEFiONJ7[Gofkg?h`Ye652` X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51399 In article , davidx@x-mail.net (david Lebonvieux) wrote: > How can substitute some values(the zeros of BesselJ function) in this > Integrals? > j0[n_] := x /. FindRoot[BesselJ[0, x] == 0, {x, n 2.5}] Change this to j0[n_] := FindRoot[BesselJ[0, x] == 0, {x, n*2.5}] so that the result is a replacement rule instead of a value. > \!\(s\_l = Array[j0, \ 10]\) > > Integrate[BesselJ[0,s0*r/R] BesselJ[0,s2*r/R] BesselJ[0,s3*r/R],{r,0,R}] By a change of variables r -> R r, this integral becomes R Integrate[BesselJ[0,s0 r] BesselJ[0,s2 r] BesselJ[0,s3 r],{r,0,1}] > where s0, s1,s2,the Zero-Poles of BesselJ. Substitute the first three zeros into the integrand: Times @@ (BesselJ[0, x r] /. Array[j0, 3]) Compute the integral numerically: R NIntegrate[%, {r, 0, 1}] Cheers, Paul -- Paul Abbott Phone: +61 8 6488 2734 School of Physics, M013 Fax: +61 8 6488 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul@physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Wei Wang Newsgroups: comp.soft-sys.math.mathematica Subject: Help in solving PDE equations Date: Wed, 17 Nov 2004 07:23:24 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 18 NNTP-Posting-Date: 17 Nov 2004 07:20:33 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=?iolB\055OEmgIYXA[dD]JC_A=>8kQj6MhHXa^^g6TZD4\7d95FA4RFEFiONJ7[GoFGW3k=Q[LEgK X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51386 Could anybody please help me in solving the following PDE equation? (p + E * (1 + (Derivative[1, 0][f][x, t])^2)^(1.5)/Derivative[2, 0][f][x, t]) )*(1- (Derivative[1, 0][f][x, t])^2)/Sqrt[1 + (Derivative[1, 0][f][x, t])^2] - k * Derivative[0, 1][f][x, t]==0 with initial or boundary conditions being f[x, 0] == -r Derivative[0, 1][f][x, 0] == p/k Derivative[1, 0][f][R0, t] == 0 f[x, t] == If[0<= x <=r, Sqrt[r^2 - x^2]] where, E, p, k, R0 and r are constants. Thanks in advance. Wei From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "Melko, Mike" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: 64 bit cpu and Mathematica on windows. Date: Wed, 17 Nov 2004 07:24:24 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 82 NNTP-Posting-Date: 17 Nov 2004 07:21:33 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=?iolB\055OEJAGY9:Pa>5EC_A=>8kQj6M=_1NR_H?JPM^:T@Q3G91hP1M X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51387 I just bought a premier subscription/upgrade, and asked a sales representative some questions about this, because I'm toying with the idea of get a dual Opteron. I was told that the current release of Mathematica supports 64 bit on Linux, but is a "Class B" license (which is more expensive). In the next release (5.1, due out any day now), the 64-bit version will be reclassified as "Class A". The news release referred to below, which specifically addresses optimization for Linux on AMD 64, states that "Mathematica 5 is among the first technical computing platforms specifically optimized for the AMD64 architecture--and it delivers impressive performance. The optimized Mathematica port outperforms a regular Linux version of Mathematica on AMD64 systems by up to 50 percent in typical scientific and technical calculations...". I don't think the distro matters, except possibly for testing. Is that correct? Since I'm likely to get Fedora Core 3, I'll have to find out if Wolfram has tested it. Mike Melko -----Original Message----- From: Ian Roberts [mailto:mathgroup@quantica.com.au] Subject: 64 bit cpu and Mathematica on windows. WRI advertise Mathematica 5 for AMD64, see: http://www.wolfram.com/news/amd64.html. I presume that this is the "Linux (64 bit optimized) " version . They have checked compatibility with SUSE Linux Enterprise Server 8 which supports 64 bit technology, hopefully this means that its OK on SUSE's desktop version; see http://www.suse.com/us/private/products/suse_linux/prof/64bit.html. So it looks as though a cheap 64 bit Mathematica is possible. Has anybody done it? Ian Quantica P/L DrBob wrote: >To see any improvement, I think you'll need a 64-bit version of Windows (not yet released) and a 64-bit version of Mathematica (also not released). > >Bobby > >On Sun, 14 Nov 2004 20:15:24 -0500 (EST), sean kim wrote: > > > >>http://www.wolfram.com/news/sgiirix.html >> >>has info on sgi machines >> >>will Mathematica run faster on a windows machine with 64 bit cpu? >> >>like.. this one. >> >>http://www.emachines.com/products/products.html?prod=eMachines_T3256 >> >>that's only 600 bucks! >> >>or dooes wri need to release a new version of Mathematica that is optimized >>for 64bit windows cpu? >> >>thanks for any insights. >> >> >> >> >> >> > > > > > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: bar@ANTYSPAM.ap.krakow.pl Newsgroups: comp.soft-sys.math.mathematica Subject: plot Point with several shapes ? Date: Wed, 17 Nov 2004 07:28:27 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 9 NNTP-Posting-Date: 17 Nov 2004 07:25:36 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=JRjbQVf?YX:M>g;eBlKQM9C_A=>8kQj6=hHXa^^g6TZ4cZ4EA:kUDC1EFiONJ7[Go6g2i@VHGoRm? X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51391 Hi, Can Mathematica plot Point with different shapes ? I used colors to plot field (many points) in XY coordinates. I have to convert my pictures to black&white format regards, Olaf From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Jens-Peer Kuska" Newsgroups: comp.soft-sys.math.mathematica Subject: Re: plot Point with several shapes ? Date: Wed, 24 Nov 2004 07:49:23 +0000 (UTC) Organization: Uni Leipzig Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 21 NNTP-Posting-Date: 24 Nov 2004 07:46:30 GMT NNTP-Posting-Host: f3a2468a.news.twtelecom.net X-Trace: DXC=UO[JL1hALaX8eVDaRa\mCUC_A=>8kQj6]hHXa^^g6TZTDFB78Rk0MAREFiONJ7[GoVi>GL;iUG58Z X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51489 Hi, whiy not use Text["\[FilledTriangleUp}",{x,y}] or any other symbol from the Mathematica fonts ?? Regards Jens schrieb im Newsbeitrag news:cneuir$qa7$1@smc.vnet.net... > Hi, > Can Mathematica plot Point with different shapes ? > > I used colors to plot field (many points) in XY coordinates. > I have to convert my pictures to black&white format > > > regards, Olaf > From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: =?ISO-8859-1?Q?J=E1nos?= Newsgroups: comp.soft-sys.math.mathematica Subject: Re: plot Point with several shapes ? Date: Thu, 18 Nov 2004 06:48:25 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411170720.CAA26820@smc.vnet.net> Lines: 30 NNTP-Posting-Date: 18 Nov 2004 06:45:34 GMT NNTP-Posting-Host: 185fe79c.news.twtelecom.net X-Trace: DXC=J8lX_<9oE@Vc2Q2mco@>IVC_A=>8kQj6]MOj3YM9`=aXco=dW1mZJ3REFiONJ7[GoVD=O^lgB]d4R X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51401 Yes, Look the MultipleListPlot in the add-ons and you will see thing there like: In[7]:= MultipleListPlot[list1, list2, PlotStyle -> {GrayLevel[0], Dashing[{Dot, Dash}]}, SymbolShape -> {PlotSymbol[Triangle], PlotSymbol[Box]}, SymbolStyle -> {GrayLevel[0], GrayLevel[.5]}] János On Nov 17, 2004, at 2:20 AM, bar@ANTYSPAM.ap.krakow.pl wrote: > Hi, > Can Mathematica plot Point with different shapes ? > > I used colors to plot field (many points) in XY coordinates. > I have to convert my pictures to black&white format > > > regards, Olaf > > ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice) From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!atl-c02.usenetserver.com!news.usenetserver.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Peter Pein Newsgroups: comp.soft-sys.math.mathematica Subject: Re: plot Point with several shapes ? Date: Thu, 18 Nov 2004 06:47:24 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 21 NNTP-Posting-Date: 18 Nov 2004 06:44:33 GMT NNTP-Posting-Host: 185fe79c.news.twtelecom.net X-Trace: DXC=L[iEEh^AT8Ncn?\5K_?h9OC_A=>8kQj6MMOj3YM9`=aHco=dW1mZJ3BEFiONJ7[GoFR:b`T;WOS;@ X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51400 bar@ANTYSPAM.ap.krakow.pl wrote: > Hi, > Can Mathematica plot Point with different shapes ? > > I used colors to plot field (many points) in XY coordinates. > I have to convert my pictures to black&white format > > > regards, Olaf > Hi Olaf, AFAIK there is an option SymbolShape for the Function Graphics`MultipleListPlot` (see documentation). Hope this helps -- Peter Pein 10245 Berlin From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news-FFM2.ecrc.net!uio.no!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: the circle map Date: Wed, 17 Nov 2004 07:30:29 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: tftn@earthlink.net Lines: 23 NNTP-Posting-Date: 17 Nov 2004 07:27:38 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=lFLENRUh32XmmJjon<[c^_C_A=>8kQj6]MOj3YM9`=aX>Nf`US;7g=ZEFiONJ7[GoVf5h7FI0ciCV X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51393 I've done a lot of searches on chaos and Mathematica and have never seem this. It is sensative chaos , in both the angle based a0 and the initial starting point. The circle was used by Chua as a starting point in his lectures on Chaos. Clear[x,y,a,b,s,g,a0] (* circle map: from Chaos in Digital Filters ,Chua,Lin, IEEE transactions on Circuits and Systems,vol 35 no 6 June 1988*) (* very sensitive to intial conditions*) a0=Cos[Pi/6]/2; x[n_]:=x[n]=Mod[-a0*x[n-1]-y[n-1],1] y[n_]:=y[n]=Mod[x[n-1],1] x[0]=0.7;y[0]=.65; a=Table[{x[n],y[n]},{n,0, 10000}]; ListPlot[a, PlotRange->All] Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: DrBob Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Re: the circle map Date: Sun, 21 Nov 2004 12:52:05 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <200411200841.DAA08749@smc.vnet.net> Reply-To: drbob@bigfoot.com Lines: 144 NNTP-Posting-Date: 21 Nov 2004 12:49:12 GMT NNTP-Posting-Host: 12529687.news.twtelecom.net X-Trace: DXC=b^a<`Xn]G_:WWH=c`XQl]?C_A=>8kQj6=hHXa^^g6TZ4cZ4EA:kUDC1EFiONJ7[Go6kHP=WI\cPb= X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51449 The mapping {x,y} -> {-a x - y, x} (without Mod or FractionalPart) has determinant one and maps an ellipse into itself for any starting point: Clear[p]; a = 0.41209; m = {{-a, -1}, {1, 0}}; p[n_] := p[n] = m.p[n - 1] p[0] = {0.7, .65}; data = Table[p@n, {n, 0, 10000}]; short = Take[data, 10]; ListPlot[data, PlotRange -> All] Show[Graphics@{Text @@@ Transpose@{Range@Length@short, short}}, Axes -> False] The same thing occurs with Fractional Part, but there are false starts (transient behavior) until the series reaches a point whose corresponding ellipse falls entirely within the square -1 All] Show[Graphics@{Text @@@ Transpose@{Range@Length@short, short}}, Axes -> False] Mod[#,1]& clips to a different square, 0 < x < 1, 0 < y < 1, and it adds numerical instability -- hence the fractal nature. 1139 points isn't enough to see any fractal behavior at all, but the next two points leave the original ellipse behind. (They're at edges of the unit square.) Things get crazy after that. Clear[p]; a = 0.41209; m = {{-a, -1}, {1, 0}}; p[n_] := p[n] = Mod[m.p[n - 1], 1] p[0] = {0.7, .65}; data = Table[p@n, {n, 0, 10000}]; limited = Take[data, 1139]; firstFractal = Take[data, 1141]; ListPlot[data, PlotRange -> All] ListPlot[limited, PlotRange -> All] ListPlot[firstFractal, PlotRange -> All] Points outside the initial ellipse are mapped into OTHER ellipses, but they keep escaping to start new ones. When and if numerical instability occurs depends on p[0] as well as a. Changing a to 0.41208 destroys it, at least in the first 175000 entries (I checked). But change p[0] slightly, and it's back: Clear[p]; a = 0.41208; m = {{-a, -1}, {1, 0}}; p[n_] := p[n] = Mod[m.p[n - 1], 1] p[0] = {0.71, .65}; data = Table[p@n, {n, 0, 10000}]; ListPlot[data, PlotRange -> All] Fitting data to an ellipse isn't too hard: Clear[a, b, c, p]; m = {{-0.41209, -1}, {1, 0}}; p[n_] := p[n] = m . p[n - 1] p[0] = {0.7, 0.65}; data = Table[p[n], {n, 0, 1000}]; onePtError[a_, b_, c_][ {x_, y_}] := (a*x^2 + b*x*y + c*y^2 - 1)^2 error[a_, b_, c_] := Total[onePtError[a, b, c] /@ data] NMinimize[error[a, b, c], {a, b, c}] b/a /. Last[%] {3.0907663843655494*^-28, {a -> 0.9090901239676206, b -> 0.3746269491858168, c -> 0.9090901239676206}} 0.41209000000000007 b/a is the upper-left entry of the m matrix (the original a0), and c == a, so we can do it this way: onePtError[a_, b_][{x_, y_}] := (x^2 + b*x*y + y^2 - a)^2 error[a_, b_] := Total[onePtError[a, b] /@ data] NMinimize[error[a, b], {a, b}] {3.8495156975525818*^-28, {a -> 1.1000009499999996, b -> 0.41209}} We can solve for the ellipse's RHS this way, too: x^2 + b*x*y + y^2 == a /. Thread[{x, y} -> p[0]] /. b -> 0.41209 1.10000095 == a When FractionalPart is used to define p[n], NMinimize still works perfectly if transient points at the beginning of the series are omitted from the error definition. Bobby On Sat, 20 Nov 2004 03:41:36 -0500 (EST), Peter Valko wrote: > Roger, > Can you tell me why is it that in the following code of yours: > > Clear[x, y, n]; > a0 = 0.41209; > x[n_] := x[n] = Mod[-a0*x[n - 1] - y[n - 1], 1]; > y[n_] := y[n] = Mod[x[n - 1], 1] ; > x[0] = 0.7; > y[0] = .65; > a = Table[{x[n], y[n]}, {n, 0, 10000}]; > ListPlot[a, PlotRange -> All] ; > > we get a fractal-like pic, but changing to a0 = 0.41208 we do not? > (And why is that replacing Mod[-,1] by FractionalPart[-] in the above > code will not give the same phenomenon? > > Peter > > > Roger Bagula wrote in message news:... >> I've done a lot of searches on chaos >> and Mathematica and have never seem this. >> It is sensative chaos , in both the angle based a0 and the >> initial starting point. >> The circle was used by Chua as a starting point in his lectures on Chaos. >> >> Clear[x,y,a,b,s,g,a0] >> (* circle map: from Chaos in Digital Filters ,Chua,Lin, >> IEEE transactions on Circuits and Systems,vol 35 no 6 June 1988*) >> (* very sensitive to intial conditions*) >> a0=Cos[Pi/6]/2; >> x[n_]:=x[n]=Mod[-a0*x[n-1]-y[n-1],1] >> y[n_]:=y[n]=Mod[x[n-1],1] >> x[0]=0.7;y[0]=.65; >> a=Table[{x[n],y[n]},{n,0, 10000}]; >> ListPlot[a, PlotRange->All] >> >> Respectfully, Roger L. Bagula >> >> tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : >> alternative email: rlbtftn@netscape.net >> URL : http://home.earthlink.net/~tftn > > > > -- DrBob@bigfoot.com www.eclecticdreams.net From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!newshosting.com!nx01.iad01.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.e.nsc.no!uio.no!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: p-valko@tamu.edu (Peter Valko) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: the circle map Date: Sat, 20 Nov 2004 08:56:22 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 43 NNTP-Posting-Date: 20 Nov 2004 08:53:29 GMT NNTP-Posting-Host: 069dfd28.news.twtelecom.net X-Trace: DXC=6bhCT@18iHAAERA7ingYACC_A=>8kQj6MhHXa^^g6TZDdH4leX5AV6DEFiONJ7[GoFk2J3cB=AD`J X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51411 Roger, Can you tell me why is it that in the following code of yours: Clear[x, y, n]; a0 = 0.41209; x[n_] := x[n] = Mod[-a0*x[n - 1] - y[n - 1], 1]; y[n_] := y[n] = Mod[x[n - 1], 1] ; x[0] = 0.7; y[0] = .65; a = Table[{x[n], y[n]}, {n, 0, 10000}]; ListPlot[a, PlotRange -> All] ; we get a fractal-like pic, but changing to a0 = 0.41208 we do not? (And why is that replacing Mod[-,1] by FractionalPart[-] in the above code will not give the same phenomenon? Peter Roger Bagula wrote in message news:... > I've done a lot of searches on chaos > and Mathematica and have never seem this. > It is sensative chaos , in both the angle based a0 and the > initial starting point. > The circle was used by Chua as a starting point in his lectures on Chaos. > > Clear[x,y,a,b,s,g,a0] > (* circle map: from Chaos in Digital Filters ,Chua,Lin, > IEEE transactions on Circuits and Systems,vol 35 no 6 June 1988*) > (* very sensitive to intial conditions*) > a0=Cos[Pi/6]/2; > x[n_]:=x[n]=Mod[-a0*x[n-1]-y[n-1],1] > y[n_]:=y[n]=Mod[x[n-1],1] > x[0]=0.7;y[0]=.65; > a=Table[{x[n],y[n]},{n,0, 10000}]; > ListPlot[a, PlotRange->All] > > Respectfully, Roger L. Bagula > > tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : > alternative email: rlbtftn@netscape.net > URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Peter Pein Newsgroups: comp.soft-sys.math.mathematica Subject: Re: the circle map Date: Sun, 21 Nov 2004 12:38:54 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 35 NNTP-Posting-Date: 21 Nov 2004 12:36:01 GMT NNTP-Posting-Host: 12529687.news.twtelecom.net X-Trace: DXC=lNh=?ifJ82A\o7M8kQj6MMOj3YM9`=aH2cj046G;VOBEFiONJ7[GoFZ6CRMZ1FXiH X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51436 Peter Valko wrote: > Roger, > Can you tell me why is it that in the following code of yours: > > Clear[x, y, n]; > a0 = 0.41209; > x[n_] := x[n] = Mod[-a0*x[n - 1] - y[n - 1], 1]; > y[n_] := y[n] = Mod[x[n - 1], 1] ; > x[0] = 0.7; > y[0] = .65; > a = Table[{x[n], y[n]}, {n, 0, 10000}]; > ListPlot[a, PlotRange -> All] ; > > we get a fractal-like pic, but changing to a0 = 0.41208 we do not? This behaviour is typical for chaotic systems. See for instance http://mathworld.wolfram.com/LogisticMap.html > (And why is that replacing Mod[-,1] by FractionalPart[-] in the above > code will not give the same phenomenon? (#1[-a0*0.7 - 0.65] & ) /@ { Mod[#1, 1] & , FractionalPart } {0.06153699999999995, -0.938463} > > Peter > > -- Peter Pein 10245 Berlin From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!atl-c02.usenetserver.com!news.usenetserver.com!peer01.cox.net!cox.net!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: Re: the circle map Date: Sun, 21 Nov 2004 12:33:50 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Reply-To: tftn@earthlink.net Lines: 79 NNTP-Posting-Date: 21 Nov 2004 12:30:56 GMT NNTP-Posting-Host: 12529687.news.twtelecom.net X-Trace: DXC=gbB7_1PH^\28W0SG3emHW:C_A=>8kQj6=MOj3YM9`=a82cj046G;VO2EFiONJ7[Go6>i\Rn\RL\;< X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51431 Dear Peter Valko, As I explained map is "sensative" to both the oringinal a0 ( angle) and the initial conditions. It is easy to get the dengerate circle, and not so easy to get some of the pretty effects This also a problem with the Martin map: I got in real trouble in a Martin map egroup I was in because I was trying to get the simple degenete sets, ha, ha. On the fractional part: I've always got : Mod[x.1]=x-Floor[x] to give the same output. If it doesn't, it may be one more problem with the Mod[x,1] algorithm in Mathematica ( to get Modulo ones where continued use of Sqrt[] are involved , you have to use N[ Mod[x,1], digits_accuracy]. It shouldn't be a problem where a number not a function is used like you have been doing. Mathematica has a bad habit of carrying what errors it does make on and building on them if "exact" numbers as symbols in a list are used. Peter Valko wrote: >Roger, >Can you tell me why is it that in the following code of yours: > >Clear[x, y, n]; >a0 = 0.41209; >x[n_] := x[n] = Mod[-a0*x[n - 1] - y[n - 1], 1]; >y[n_] := y[n] = Mod[x[n - 1], 1] ; >x[0] = 0.7; >y[0] = .65; >a = Table[{x[n], y[n]}, {n, 0, 10000}]; >ListPlot[a, PlotRange -> All] ; > >we get a fractal-like pic, but changing to a0 = 0.41208 we do not? >(And why is that replacing Mod[-,1] by FractionalPart[-] in the above >code will not give the same phenomenon? > >Peter > > >Roger Bagula wrote in message news:... > > >>I've done a lot of searches on chaos >> and Mathematica and have never seem this. >>It is sensative chaos , in both the angle based a0 and the >>initial starting point. >>The circle was used by Chua as a starting point in his lectures on Chaos. >> >>Clear[x,y,a,b,s,g,a0] >>(* circle map: from Chaos in Digital Filters ,Chua,Lin, >> IEEE transactions on Circuits and Systems,vol 35 no 6 June 1988*) >> (* very sensitive to intial conditions*) >>a0=Cos[Pi/6]/2; >>x[n_]:=x[n]=Mod[-a0*x[n-1]-y[n-1],1] >>y[n_]:=y[n]=Mod[x[n-1],1] >>x[0]=0.7;y[0]=.65; >>a=Table[{x[n],y[n]},{n,0, 10000}]; >>ListPlot[a, PlotRange->All] >> >>Respectfully, Roger L. Bagula >> >>tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : >>alternative email: rlbtftn@netscape.net >>URL : http://home.earthlink.net/~tftn >> >> > > > -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!prodigy.com!newshosting.com!nx01.iad01.newshosting.com!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: arun_quantum@yahoo.co.in (arun) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: Numerical Left Eigenvectors Date: Wed, 17 Nov 2004 07:31:30 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: <5gcamv$ilc@smc.vnet.net> Lines: 28 NNTP-Posting-Date: 17 Nov 2004 07:28:38 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=FC:Hoo^C_A=>8kQj6]hHXa^^g6TZTLIK5ZkUUj_]EFiONJ7[GoVJ`UkeeM\kEU X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51394 Dear Friend I happend to see ur question. I hope u have got the answer already. If not...Please follow the below... 1. Inverse the right matrix(R) in which the "columns" are right eigen vectors . 2. now this matrix will be the left matrix (L) in which all the "rows" are it`s left eigen vectors. regards Arun On 14 Mar 1997 14:59:27 -0500, Gregory Dwyer wrote: >Greetings - > >When I use the "eigenvector" function to numerically calculate >eigenvectors, Mathematica seems to assume that I always want right >eigenvectors. Is there some way to numerically calculate left eigenvectors? > >Thanks. > >Greg Dwyer. >Entomology, UMASS Amherst >dwyer@ent.umass.edu From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!in.100proofnews.com!in.100proofnews.com!news-out.visi.com!transit-1.news.visi.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: Roger Bagula Newsgroups: comp.soft-sys.math.mathematica Subject: 100 digit base ten primes Date: Wed, 17 Nov 2004 07:33:31 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Reply-To: tftn@earthlink.net Lines: 31 NNTP-Posting-Date: 17 Nov 2004 07:30:40 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=ZWZ_5E4H4NC_A=>8kQj6=hHXa^^g6TZ4LIK5ZkUUj_=EFiONJ7[Go6Nn:1IQoU1A0 X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51396 Clear[a,b,m,m0,m1,m3] (* program for finding primes near 100 digits long base 10 using Mersenne seed points*) (* cryptography length primes*) (* the logically most probable way someone taught*) (* traditional number theory might use find 100 digits primes*) (* short of using a sieve to 100 decimal places*) Table[N[Log[2^Prime[n]]/Log[10]],{n,1,68}] $MaxPrecision=Floor[Log[2^Prime[68]]/Log[10]]+1 m=2^Prime[67]-1 m0=Floor[m+Log[m]^2] (m0-m)/2 m1=2^Prime[68]-1 m3=Floor[m1+Log[m1]^2] (m3-m1)/2 a=Delete[Union[Table[If[PrimeQ[n]==True,n,0],{n,m,m0,2}]],1] Dimensions[a][[1]] (* 1/Log[n] probability test*) N[Dimensions[a][[1]]/((m0-m)/2)-1/Log[m0]] b=Delete[Union[Table[If[PrimeQ[n]==True,n,0],{n,m1,m3,2}]],1] Dimensions[b][[1]] N[Dimensions[b][[1]]/((m3-m1)/2)-1/Log[m3]] PrimeQ[m+Floor[Log[m]^2/2]]==True PrimeQ[m1+Floor[Log[m1]^2/2]]==True Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news-FFM2.ecrc.net!newsfeed.wirehub.nl!newsfeed.multikabel.nl!skynet.be!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: drbob@bigfoot.com (Bobby R. Treat) Newsgroups: comp.soft-sys.math.mathematica Subject: Re: 100 digit base ten primes Date: Thu, 18 Nov 2004 06:50:27 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: References: Lines: 97 NNTP-Posting-Date: 18 Nov 2004 06:47:35 GMT NNTP-Posting-Host: 185fe79c.news.twtelecom.net X-Trace: DXC=Ok`eh2^JeMlfPeRN`>Q>=dC_A=>8kQj6mMOj3YM9`=ahco=dW1mZJ3bEFiONJ7[Gof@B<:h7h@EVb X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51403 The code below demonstrates several things: 1) Yes, there's at least one prime between n and n + Log[n]^2. In fact, there are MANY primes in the range when n is large. 2) The average of those limits (rounded to an integer) almost never delivers a prime number. (It didn't in your own examples.) Exactly half the time it's even, for instance. 3) Searching the entire range is silly if you're searching for a prime; why not stop at the first one you find? 4) The upper bound (and the theorem itself) is irrelevant to a practical search for primes. It puts a bound on how far you'll have to search, but knowing that doesn't change the search method in any way. On another note, Dimensions[a][[1]] is usually computed as Length@a, and evaluating PrimeQ[m+Floor[Log[m]^2/2]]==True is the same result as evaluating PrimeQ[m+Floor[Log[m]^2/2]] That's False in both cases from your post. Here's a test for exponents ranging from 1 to 100: f[n_] = n + Floor[Log[n]^2/2]; g[exp_] = 2^Prime[exp] - 1; select[exp_] := If[PrimeQ[f[g[exp]]], f[g[exp]], Sequence @@ {}] select /@ Range[100] Length[%] {3, 8231, 2361183241434822608057, 3064991081731777716716694054300618367237478244367212221} 4 That's four prime numbers in a hundred tries, no better than random, so let's try replacing f with something else: f[n_] = 2*n - 1; select /@ Range[100] Length[%] {5, 13, 61, 4093, 16381, 1048573, 16777213, 14272476927\ 05959881058285969449495136382746\ 621, 239452428260295134118491722\ 99223580994042798784118781} 9 Or better yet: f[n_]=Prime@n; select/@Range@13 Length@% {5,17,127,709,17851,84011,1742527,7754017,148948133,11891268397, 50685770143,3839726846299,67756520645293} 13 Thirteen out of thirteen. The fourteenth candidate is too large for Mathematica's implementation of Prime. Bobby Roger Bagula wrote in message news:... > Clear[a,b,m,m0,m1,m3] > (* program for finding primes near 100 digits long base 10 using Mersenne > seed points*) > (* cryptography length primes*) > (* the logically most probable way someone taught*) > (* traditional number theory might use find 100 digits primes*) > (* short of using a sieve to 100 decimal places*) > Table[N[Log[2^Prime[n]]/Log[10]],{n,1,68}] > $MaxPrecision=Floor[Log[2^Prime[68]]/Log[10]]+1 > m=2^Prime[67]-1 > m0=Floor[m+Log[m]^2] > (m0-m)/2 > m1=2^Prime[68]-1 > m3=Floor[m1+Log[m1]^2] > (m3-m1)/2 > a=Delete[Union[Table[If[PrimeQ[n]==True,n,0],{n,m,m0,2}]],1] > Dimensions[a][[1]] > (* 1/Log[n] probability test*) > N[Dimensions[a][[1]]/((m0-m)/2)-1/Log[m0]] > b=Delete[Union[Table[If[PrimeQ[n]==True,n,0],{n,m1,m3,2}]],1] > Dimensions[b][[1]] > N[Dimensions[b][[1]]/((m3-m1)/2)-1/Log[m3]] > PrimeQ[m+Floor[Log[m]^2/2]]==True > PrimeQ[m1+Floor[Log[m1]^2/2]]==True > > Respectfully, Roger L. Bagula > > tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : > alternative email: rlbtftn@netscape.net > URL : http://home.earthlink.net/~tftn From ???@??? Fri Jan 01 00:00:00 1999 Path: newsdbm06.news.prodigy.com!newsdst01.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail From: "Melko, Mike" Newsgroups: comp.soft-sys.math.mathematica Subject: RE: 64 bit cpu and Mathematica on windows. Date: Wed, 17 Nov 2004 07:34:32 +0000 (UTC) Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc. Sender: steve@smc.vnet.net Approved: Steven M. Christensen , Moderator Message-ID: Lines: 80 NNTP-Posting-Date: 17 Nov 2004 07:31:41 GMT NNTP-Posting-Host: 7b89377e.news.twtelecom.net X-Trace: DXC=ZC=8kQj6MMOj3YM9`=aH>Nf`US;7g=JEFiONJ7[GoFZ@Xm:Q?]dMN X-Complaints-To: abuse@twtelecom.net Xref: newsmst01a.news.prodigy.com comp.soft-sys.math.mathematica:51397 Another note: The page linked to below, namely http://www.emachines.com/products/products.html?prod=eMachines_T3256 Is for a PC with an Athlon XP processor, which, I'm pretty sure, is 32-it. Another bit of confusion might come from the so-called "AMD Athlon 64". If I'm not mistaken, this is a 32-bit CPU that supports AMD's instruction set for 64-bit applications. So, for example, you could run 64-bit (and 32-bit) Mathematica on it, but it would be slower than on an Opteron, which is AMD's REAL 64-bit CPU. I've been shopping around a little , and this this the settup I currently favor (but with more RAM!): http://www.micronux.com/catalog/product.php?products_id=168 Properly configured, this would be about $1,500. Mike Melko -----Original Message----- From: Ian Roberts [mailto:mathgroup@quantica.com.au] Subject: 64 bit cpu and Mathematica on windows. WRI advertise Mathematica 5 for AMD64, see: http://www.wolfram.com/news/amd64.html. I presume that this is the "Linux (64 bit optimized) " version . They have checked compatibility with SUSE Linux Enterprise Server 8 which supports 64 bit technology, hopefully this means that its OK on SUSE's desktop version; see http://www.suse.com/us/private/products/suse_linux/prof/64bit.html. So it looks as though a cheap 64 bit Mathematica is possible. Has anybody done it? Ian Quantica P/L DrBob wrote: >To see any improvement, I think you'll need a 64-bit version of Windows (not yet released) and a 64-bit version of Mathematica (also not released). > >Bobby > >On Sun, 14 Nov 2004 20:15:24 -0500 (EST), sean kim wrote: > > > >>http://www.wolfram.com/news/sgiirix.html >> >>has info on sgi machines >> >>will Mathematica run faster on a windows machine with 64 bit cpu? >> >>like.. this one. >> >>http://www.emachines.com/products/products.html?prod=eMachines_T3256 >> >>that's only 600 bucks! >> >>or dooes wri need to release a new version of Mathematica that is optimized >>for 64bit windows cpu? >> >>thanks for any insights. >> >> >> >> >> >> > > > > >