A51 == Because it depends on how you get there. For instance,> Limit[(1-x)^(1/x), x->0] gives 1/E, while Limit[(1-x)^(1/x^2), x->0]> gives 0.You are correct. However, that last limit claim is somewhat deceptive.Based on it, one might conclude, incorrectly, that the direction ofapproach to 0 is immaterial. Note that, althoughLimit[(1-x)^(1/x^2), x->0, Direction-> -1] yields 0,Limit[(1-x)^(1/x^2), x->0, Direction-> +1] yields Infinity.Thus, when Mathematica says that Limit[(1-x)^(1/x^2), x->0] is 0, it ismaking a hidden assumption of direction of approach.> In fact, you can construct similar examples in which> 1^Infinity = anything you like.Well, yes, as long as you don't like negative values. David> 1^[Infinity] => Indeterminate, unexpected. Naively expected: 1.> For which reason(s) is 1^[Infinity] defined as Indeterminate?-- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service ==== >>Because it depends on how you get there. For instance,>>Limit[(1-x)^(1/x), x->0] gives 1/E, while Limit[(1-x)^(1/x^2), x->0]>>gives 0.> You are correct. However, that last limit claim is somewhat deceptive.> Based on it, one might conclude, incorrectly, that the direction of> approach to 0 is immaterial. Note that, although> Limit[(1-x)^(1/x^2), x->0, Direction-> -1] yields 0,> Limit[(1-x)^(1/x^2), x->0, Direction-> +1] yields Infinity.> Thus, when Mathematica says that Limit[(1-x)^(1/x^2), x->0] is 0, it is> making a hidden assumption of direction of approach.Actually it seems you've discovered a bug in Limit. If we allow complex values, then Limit[(1-x)^(1/x^2), x->0, Direction-> +1] should be 0, which is evident from the graph of Abs[(1-x)^(1/x^2)]. Mathematica gives Infinity for Limit[Abs[(1-x)^(1/x^2)], x->0, Direction-> +1] as well. If we don't allow complex values, then Limit[(1-x)^(1/x^2), x->0, Direction-> +1] can't exist at all (even as Infinity or -Infinity).>>In fact, you can construct similar examples in which>1^Infinity = anything you like.> Well, yes, as long as you don't like negative values. DavidSome of my favorite numbers are negative, such as (1 + x I)^(I Pi/Log[1 + x I]) = -1Note that this has the form 1^Infinity as x->0.>1^[Infinity] => Indeterminate, unexpected. Naively expected: 1.>>For which reason(s) is 1^[Infinity] defined as Indeterminate?> ==== All I can say about my last post on this topic is: Nevermind. I was looking at the graph of Abs[(1-x)^(1/x^2)] near 1 instead of 0. Aargg.Mathematica's answers (Infinity) for both Limit[Abs[(1-x)^(1/x^2)], x->0, Direction-> +1] and Limit[Abs[(1-x)^(1/x^2)], x->0, Direction-> +1] are correct.---Selwyn> Actually it seems you've discovered a bug in Limit. If we allow complex > values, then Limit[(1-x)^(1/x^2), x->0, Direction-> +1] should be 0, > which is evident from the graph of Abs[(1-x)^(1/x^2)]. Mathematica gives > Infinity for Limit[Abs[(1-x)^(1/x^2)], x->0, Direction-> +1] as well. If > we don't allow complex values, then Limit[(1-x)^(1/x^2), x->0, > Direction-> +1] can't exist at all (even as Infinity or -Infinity). ==== Dear members,There is an equivalent of Or (||) to be used with patterns: Alternative (|). I couldn't find an equivalent for And (&&) and Not (!). I don't know if they don't exist, or it is just that I can`t find them.Julio ==== Is there a possibility that Mathematica gives me a function to givenpairs of values?In other words: I have several pairs like {1, 2}, {2, 4}, {3, 9}. And Iwhat like to know the corresponding function (what is in this exampleobviously f[x]=x^2).TIASven ==== Ok, I thank you for your help. The values {1,2},{2,4},{3,9} were only anexample. And the 2 in the first pair should actually be an 1.... Butthis doesn't matter since you understood the problem. I also knew theproblem, that I have to give something like a model for thefunction... Unfortunatly, I have no idea, how the function looks like. Ithought, that Matematica is maybe able to compare these values withknown functions (and combinings of them). But it looks like there is noway...Anyway, the real pairs of values are:{{0.5,3.45058},{1,5.3352},{1.5,6.9328},{1.8,7.306},{ 1.9,7.2962},{2,7.2163},{2.5,5.8877},{3,3.7307},{3.4464,2.0000 },{4,0.6928},{5,0.04575}}At first, I thougt that the function is something like the densityfunction of the standard normal distribution... Thus, I tried thefollowing function (and lots of modifications):(a + e*x)(2[Pi] Exp[0.5 (c*x^d + b)^2])Unfortunatly, the result wasn't very accurate...I know, that this is not longer a problem a Mathematica, but I justwanted to let you know...Anyway, I thank you all for your help.Sven ==== SvenIt may be obvious to you that 1^2=2 (surely not ?), 2^2=4 and 3^2=9, butto me your pairs look like they were derived from the function f[x]=x+x!(that is Factorial[x], not an x followed by an expression of surprise). But I could not find a Mathematica function to support my argument - orto support yours for that matter.I guess you could try Fit and its related functions ...Mark Westwood> Is there a possibility that Mathematica gives me a function to given> pairs of values?> In other words: I have several pairs like {1, 2}, {2, 4}, {3, 9}. And I> what like to know the corresponding function (what is in this example> obviously f[x]=x^2).> TIA> Sven ==== I have a lot of different files, containing data (already formatted for mathematica) which is supposed to be imported as tables with names derived from the original file name. Problem being: Scan[(StringDrop[#,-4]=Import[#];DeleteFile[#])&, FileNameList] only gives StringDrop protected..... What I also do not like about the above command is, that the data files are deleted. How can I get what I would like to have?Bettina ==== Does anybody know how to install Postscript Fonts Type 1, using Mathematica 4.2 under Mac OSX 10.1.5?-- Daniel AMIGUET Avenue du L.8eman 59 CH 1005 Lausanne +41 21/728 0730 ==== Not sure what you're asking here. Installation of type 1 fonts has nothing to do with Mathematica. You put them in your Library:Fonts folder.A shot in the dark: I have a feeling your difficulty might be related to the FontType option. Open the Option Inspector, show option values for Global, and look under Formatting Options > Font Options > PrivateFontOptions. Change the setting of FontType to Outline.---Selwyn Hollisslhollis@mac.com> Does anybody know how to install Postscript Fonts Type 1, using > Mathematica 4.2 under Mac OSX 10.1.5? ==== Dear members,For long calculations, sometimes a message appears, telling the program is out of disk space. The kernel shuts down.I searched the archives for the list, and found a number of postings on this issue, but none of them solved my problem.I have 1.7 G of free space in my internal hard disk, but also have 22 G free in my Buslink USB external hard drive. I would like to use this space for the calculations.In Windows98 (control panel, system, performance, advanced, virtual memory) there is an option to use this space, but it seems like its either internal disk or external disk. I didn't dare to change it to the external disk, because I received a scary message from W98 (you may not be able to restart your computer).If I change the settings, will I be able to restart the PC? Is there a way to use both disks succesively? Is there a way to use the external one, but without restarting the computer? Is it possible to do this directly from Mathematica?Julio ==== Gareth,I have 64 MB of RAM. If I increase this, do you think I will get animprovemente in Mathematica performance? I thought it used the hard disk asa regular procedure, and not because the computer ran out of RAM.Julio----- Original Message ----- 1) Getting as much real memory as possible. It is pretty cheap right now. 2) Checking your calculations to see if you can reduce the amount ofmemory> used. Depending on what it is that is eating up all the memory, the participants> in this group may be able to help you with (2). Gareth P.S. I note also that you didn't tell us how much real memory you have. If> you don't have much, so that your calculation starts using hard disk space> immediately, it might turn out that with real memory, your calculationdoes> not take as long as you thought... > For long calculations, sometimes a message appears, telling the program> is out of disk space. The kernel shuts down.> I searched the archives for the list, and found a number of postings on> this issue, but none of them solved my problem.> I have 1.7 G of free space in my internal hard disk, but also have 22 G> free in my Buslink USB external hard drive. I would like to use this> space for the calculations.> In Windows98 (control panel, system, performance, advanced, virtual> memory) there is an option to use this space, but it seems like its> either internal disk or external disk. I didn't dare to change it to> the external disk, because I received a scary message from W98 (you may> not be able to restart your computer).> If I change the settings, will I be able to restart the PC? Is there a> way to use both disks succesively? Is there a way to use the external> one, but without restarting the computer? Is it possible to do this> directly from Mathematica? ==== Julio,I don't know about Windows in particular (never use it), but while you canuse hard disk space as temporary memory space, it is much slower than usingreal memory. And using a disk on a slow external connection such as USB willbe even slower. You calculation may never finish! I suggest:1) Getting as much real memory as possible. It is pretty cheap right now.2) Checking your calculations to see if you can reduce the amount of memoryused.Depending on what it is that is eating up all the memory, the participantsin this group may be able to help you with (2).GarethP.S. I note also that you didn't tell us how much real memory you have. Ifyou don't have much, so that your calculation starts using hard disk spaceimmediately, it might turn out that with real memory, your calculation doesnot take as long as you thought...> For long calculations, sometimes a message appears, telling the program> is out of disk space. The kernel shuts down.> I searched the archives for the list, and found a number of postings on> this issue, but none of them solved my problem.> I have 1.7 G of free space in my internal hard disk, but also have 22 G> free in my Buslink USB external hard drive. I would like to use this> space for the calculations.> In Windows98 (control panel, system, performance, advanced, virtual> memory) there is an option to use this space, but it seems like its> either internal disk or external disk. I didn't dare to change it to> the external disk, because I received a scary message from W98 (you may> not be able to restart your computer).> If I change the settings, will I be able to restart the PC? Is there a> way to use both disks succesively? Is there a way to use the external> one, but without restarting the computer? Is it possible to do this> directly from Mathematica? ==== Why does Mod[3.5,0.1] gives 0.1?However,3.5 - 0.1 Quotient[3.5,0.1] gives 0-Souvik ==== I have a problem with DigitQ and letterQ I would like for a string toyeild True when run with DigitQ if the the string looks like this:{1,2} and false if it looks like this:Right now both strings return False because of { , }. So, if therewere anyway to include the charecters {, }, and , into theDigitQ 0-9 list temperarelly that would work, but I am sure there isCharles ==== CharlesDoes Apply[And, Map[DigitQ, list]]do what you want ? Mark Westwood> I have a problem with DigitQ and letterQ I would like for a string to> yeild True when run with DigitQ if the the string looks like this:> {1,2}> and false if it looks like this:> Right now both strings return False because of { , }. So, if there> were anyway to include the charecters {, }, and , into the> DigitQ 0-9 list temperarelly that would work, but I am sure there is> Charles ==== I have been having difficulty using the distribution packages. In apackage I created, I can't get the CDF function to evaluate, and Ican't figure out the problem. Below I have included a very simple (anduseless) package I created that runs in to the same problem. I wantto use the numerical value of the CDF for a normal distribution. WhenI call TestFunction, this is the output:Global`glibb`Private`CDF[Global`glibb`Private` NormalDistribution[0,1], -1]Global`glibb`Private`CDF[Global`glibb`Private` NormalDistribution[0.,1.], -1.]Calls to CDF return similar outputs in my useful packages. Thepackage I am currently working with was originally written forMathematica 2.0, and I am trying to update it to work with 4.0. I wastold that all the functions were tested thoroughly in the 2.0implementation and worked fine.TEST PACKAGE: file glibb.m--------------------------------------------------- ---------BeginPackage[`glibb`, {Statistics`ContinuousDistributions`}]glibb::usage = glibb is a test package.TestFunction::usage = TestFunction[].Begin[`Private`]TestFunction[] := Module[{alpha,alpha2}, alpha = CDF[NormalDistribution[0,1], -1]; Print[alpha]; alpha2 = N[CDF[NormalDistribution[0,1],-1]]; Print[alpha2];]; End[ ]EndPackage[ ]------------------------------------------------------------ -Aaron ==== Here's a start:pairs = {{1, 1}, {2, 4}, {3, 9},{4,16}}ClearAll[f, g]g[{a_, b_}] := (f[a] = b)g /@ pairs?? fThat defines f only at the points in your list of ordered pairs.If you want to identify a polynomial (or other) fit, you could use Fit,if you have in mind what the functional form might be. Unfortunately,it might not do what you expect! You can also use Interpolation todefine f on the range of values you have.expr1 = Fit[pairs, {1, x}, x]expr3 = Fit[pairs, {1, x, x^2}, x]expr4 = Fit[pairs, {1, x, x^2, x^3}, x]expr5 = Fit[pairs, {1, x, x^2, x^3, x^4}, x]expr6 = Interpolation[pairs]Plot[Evaluate[# - x^2], {x, 1, 3}] & /@ {expr1, expr2, expr3, expr4, expr5, expr6[x]};Bobby Treat-----Original Message----- ==== You're getting the error because you're trying to set StringDrop (of anargument) equal to something. The name of a variable is a Symbol, not astring, so you need to change the result of StringDrop into a Symbol,and then set that symbol equal to the result of Import.If you don't want the files deleted, for heaven's sake take DeleteFileout of the command!Scan[(name = Symbol@StringDrop[#, -4]; Evaluate@name =.; Evaluate[name] = Import[#, Text]) &, FileNameList](I was testing using Text files.)Bobby Treat-----Original Message-----Bettina ==== >Is there a possibility that Mathematica gives me a function to given>pairs of values?>In other words: I have several pairs like {1, 2}, {2, 4}, {3, 9}. And I>what like to know the corresponding function (what is in this example>obviously f[x]=x^2).You have to give it a model to which to fit the data.Needs[Statistics`NonlinearFit`];data = {{1,1},{2,4},{3,9}};model = a*x^2+b*x+c;NonlinearFit[data, model, x, {a,b,c}]//Chop1.*x^2Bob HanlonChantilly, VA USA ==== >Why does Mod[3.5, 0.1] gives 0.1?>>However,>3.5 - 0.1 Quotient[3.5, 0.1] gives 0Lack of precision because you used machine numbers.Mod[3.5, 0.1]0.1Mod[35/10, 1/10]0Mod[Rationalize[3.5], 0.1]0.Mod[3.5, Rationalize[0.1]]0.Bob HanlonChantilly, VA USA ==== expr = {1,2};And @@ (DigitQ /@ (ToString /@ (ToExpression@expr)))TrueThat works if all the strings you'll apply it to are in that listformat. If not, then something like this works...expr1 = {1,2,; expr2 = {1,2,m; f[expr_] := (Intersection[#1, Characters[01234567890,{}]] == Union[#1] & )[Characters[expr]]f[expr1]f[expr2]TrueFalseBobby Treat-----Original Message-----DigitQ 0-9 list temperarelly that would work, but I am sure there isCharles ==== As a follow up to David's example:Some students seem to think that lim n->0 (1+(1/n))n = 1. Their reasoningis this: When n->0, then 1+(1/n) -> 1. Now compute lim n->0 1 n = 1.This reasoning is just too simplistic. You have to deal with both of the n'sin the expression (1+(1/n))n at the same time -- i.e., they both go to infinity simultaneously; you can't figure that one goes to infinityand then the other goes to infinity. In fact, if you let the other one goto infinity first, you'd get a different answer: lim n->0 (1+0.0000001)n =0. So evidently the answer lies somewhere between 1 and 0. Easy methods do not work on this problem.The correct answer is a number that is near 2.718. (It's an important constant,known to mathematicians as e = aprrox. 2.718281828...) There's no way youcould get that by an easy method. Jonathan Rockmannmtheory@msn.com----- Original Message -----In other words, if f(x) approaches 1 and g(x) increases without bound,f(x)^g(x) need not approach 1. Consider the limit of (1+1/x)^x as xincreases without bound, for example.David ==== The default setting for FractionBox seems to be to have fonts smaller thanthe rest of the fonts in the cell. How can I globally set the fonts to bethe same in a FractionBox as the default font size for the cell (which Iknow how to set but cannot figure out what to do with FractionBox).I do not want to manually change each specific character on account of therebeing too many and also I have the default cell font size for print outdifferent from working and wrapping a Stylebox[ , fontSize-> ] around acharacter seems to lock the fontsize and therefore messes up the way itlooks when printed.thanksMike ==== Julio,I don't think there is a direct analog but it is easy to make up somethingthat is equivalent. The following will return True for all Symbols that arenot x or y.test1 := MatchQ[#1, _Symbol] && !MatchQ[#1, x | y] &test1 /@ {1, Sin[x], x, y, z}{False, False, False, False, True}David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== Is there some easy way of changing a certain character in a NumberedEquationcell without doing it manually?eg. Where ever D (in italics) appears in an equation it is replaced by D(bold, no italics).thanksMike ==== Aaron,When I add the line<Is there a possibility that Mathematica gives me a function to given>pairs of values? In other words: I have several pairs like {1, 2}, {2,>4}, {3, 9}. And I what like to know the corresponding function (what>is in this example obviously f[x]=x^2).There are infinitely many possible functions that can generate the particular list in your example.Specifically f[x]:={x, x^2 +(x-1)(x-2)(x-3)g[x]} for any g[x] will work. For Mathematica to determine a specific function it would be necessary to make assumptions about g[x]. Any assumptions made are certain to be wrong for some problem.If you know the relationship between the numbers is expressed by a polynomial, then you could use InterpolatingPolynomialIn[1]:=InterpolatingPolynomial[Table [{n, n^2}, {n, 3}], x] // SimplifyOut[1]=x^2 ==== OK! I found I could add this statement after BeginPackage, rather thanadding the other two contexts:PrependTo[$ContextPath, #] & /@{Statistics`Common`DistributionsCommon`, Statistics`NormalDistribution`}But, of course, it really should beBeginPackage[glibb`, {Statistics`Common`DistributionsCommon`, Statistics`NormalDistribution`}]To find out where a set of functions are really coming from, you canload the packages you THINK they're in and then find out where theyreally are, like this:< Is there a possibility that Mathematica gives me a function to given> pairs of values?> In other words: I have several pairs like {1, 2}, {2, 4}, {3, 9}. And I> what like to know the corresponding function (what is in this example> obviously f[x]=x^2). TIA> SvenIs that really obvious? How about:In[7]:=Rationalize[Fit[{{1, 2}, {2, 4}, {3, 9}}, {x, x^2, x^3}, {x}]]Out[7]=3*x - (3*x^2)/2 + x^3/2In[8]:=% /. {{x -> 1}, {x -> 2}, {x -> 3}}Out[8]={2, 4, 9}Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ ==== No there isn't one. In fact the only sensible cases in which you might wish to use a And for patterns seem to be the cases where either all patterns arise from pure functions by means of _? (PatternTest) or where at most one pattern does not arise in that way. In the first case it is clearly simpler to use ordinary && as in:In[13]:=Cases[Range[10], _?(PrimeQ[#1] && #1 > 3 & )]Out[13]={5, 7}the other case is when you mix a true pattern and a pattern test. e.g:IIn[14]:=Cases[{0,1,1.5,2},_Integer?(#>1&)]Out[14]={2} I can't think of any way you could try to combine two patterns that do not arise from pure functions, so I don't think such an And would be very useful. A Not for patterns might be perhaps somewhat useful, but it can always be constructed by means of the MatchQ predicate:In[15]:=Cases[{0,1,1.5,2},_?(!MatchQ[#,_Integer]& )]Out[15]={1.5} Dear members, There is an equivalent of Or (||) to be used with patterns: Alternative> (|). I couldn't find an equivalent for And (&&) and Not (!). I don't> know if they don't exist, or it is just that I can`t find them.> Julio>Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ ==== I think the Help Browser is only approximately correct on this point. Although it says:Mod[m, n] is equivalent to m - n Quotient[m, n]this is only really always true for exact numbers. Thus in your case:In[21]:=Mod[Rationalize[3.5],Rationalize[0.1]]Out[21] =0and same forIn[22]:=Rationalize[3.5]-Rationalize[0.1 ]Quotient[Rationalize[3.5],Rationalize[0.1]]Out[22]=0For inexact numbers this relationship holds almost everywhere. I suspect this is due to the fact that arithmetic in Mathematica is in fact binary.Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ Why does Mod[3.5,0.1] gives 0.1? However,> 3.5 - 0.1 Quotient[3.5,0.1] gives 0> -Souvik ==== Is there a publicly available Mathematica 3.0 notebook that implements the Primes is in P?http://www.msnbc.com/news/792126.asp ==== Anybody can help me?I have any program in Mathematica 3.0, I am changing to Mathematica 4.0,but I have problem in this point, with NDSolve in this equation!(* RowBox[{ RowBox[{EXERUIDO, =, RowBox[{NDSolve, [, RowBox[{ RowBox[{{, RowBox[{ RowBox[{ RowBox[{ SuperscriptBox[y, [Prime], MultilineFunction->None], [, x, ]}], ==, ((coefac[x] ((1 - alfaam/alfaem)) + alfaam etas)/(y[x] /. sinalfinal))}], ,, (y[0] == 0)}], }}], ,, y, ,, ({x, 0, Z})}], ]}]}], ;}])NDSolve::ndnum: Encountered non-numerical value for a derivative at !(x) == !(0.`).NDSolve::ndnum: Encountered non-numerical value for a derivative at !(x) == !(0.`).In Mathematica 3.0 resolve this equation without problem.I dont know what can I do to resolve this problem.S.8ergio Milo ==== Good luck with a function like 1 + Sin[x], which has infinitely manyroots but never changes sign!Or Sin[1/x], which has infinitely many roots converging on 0, but nolimit for the function at 0.Or... still worse... 1 + Sin[1/x], which has BOTH problems.Bobby-----Original Message-----In[2]:=points = Cases[g, Line[x_] -> x, Infinity][[1]];We make a list of the signs of the y values:In[3]:=signs = Sign /@ Transpose[Cases[g, Line[x_] -> x, Infinity][[ 1]]][[2]];We find the points where the sign changes:In[4]:=positions = Position[Rest[signs]*Rest[RotateRight[signs]], -1]Out[4]={{27}, {51}, {74}, {101}, {126}, {149}, {177}, {200}, {226}, {252}}We make a list of starting points for FindRoot:In[5]:=starts = First[Transpose[Extract[points, positions]]]Out[5]={2.7825096162536145, 6.080185995733974, 8.787418231655966, 12.198138489619575, 15.464841498197309, 18.61672099859868, 21.92859710988888, 24.46767425065356, 27.840417480532142, 31.139545383515845}We find the roots:In[6]:=(FindRoot[Sin[x] == 0, {x, #1}, WorkingPrecision -> 20] & ) /@ startsOut[6]={{x -> 3.141592653589793238462643383255068`20}, {x -> 6.283185307179586476925286766538051`20}, {x -> 9.424777960769379715387930149825109`20}, {x -> 12.566370614359172953850573533079026`20}, {x -> 15.707963267948966192313216916378673`20}, {x -> 18.849555921538759430775860299681079`20}, {x -> 21.991148575128552669238503682979946`20}, {x -> 25.132741228718345907701147066183302`20}, {x -> 28.274333882308139146163790449476032`20}, {x -> 31.415926535897932384626433832775678`20}}This question has been asked frequently so you can find various approaches, including this one, in the archives. Of course there is no guarantee. For very complex functions you may well miss some roots. The situation can become a lot more complicated if your equation has multiple roots.Andrzej Can Mathematica find (localize) ALL roots of non-polynomial equation eq[x]==0 on a given segment x in [a,b], a,b=Real?? (for example Sin[x]==0, for 0.1 ==== > I have a problem with DigitQ and letterQ I would like for a string to> yeild True when run with DigitQ if the the string looks like this:> {1,2} > and false if it looks like this:> Right now both strings return False because of { , }. So, if there> were anyway to include the charecters {, }, and , into the> DigitQ 0-9 list temperarelly that would work, but I am sure there is> Charles> Try thisDresser[string_String]:=Module[{x},x=StringReplace[ string, ->]; If[Or[StringTake[x,1]!=(,StringTake[x,-1]!=)],Return[ False]]; Apply[And, NumberQ[#]&/@ToExpression[{<>StringDrop[StringDrop[x,1],-1 ]<>}]]]This function trims blanks. It will do a bit more than you require --return True for (#,#,#,...#). However you can easily make the fix to limitit to two. Additionally, you can quickly modify the code to get the numbersback. The setup will also let you easily modify it to integers, positiveintegers, Numerics, etc.Richard Palmer ==== I would like to plot this function : 1n(e)=______________ Exp[b(e-mu)]+1and get a graphic like that, with the lettersn(e) ^ | |1| ____________ | | | | |_______________ _____________________ e mu /how can i do it, i specifiedSetAttributes{b,constant} etc ... but it don't workplease help me, i use mathematica 4 ==== Hail physics-friend!The Tick command enables you to label ticks on axes. Here:Module[ { mu = .1, b = 100 }, Plot[1/(1 + Exp[-b (mu - e)]) , {e, 0, 2 mu} , Ticks -> {{{mu, mu}}, Range[0, 1, .2]} , AxesLabel -> {e, n(e)} ] ]Your ascii picture looks nice too!Note there are no axis-arrows provided with above plot, look for them insome recent message in this group.Bye,Borut> I would like to plot this function :> 1> n(e)=______________> Exp[b(e-mu)]+1 and get a graphic like that, with the letters n(e)> ^> |> |> 1| ____________> | > | > | |> |_______________ _____________________ e> mu/ how can i do it, i specified> SetAttributes{b,constant} etc ... but it don't work please help me, i use mathematica 4 ==== Here's a similar solution that averages points on either side of signchanges, to get better initial starts for FindRoot:g = Plot[Sin[x], {x, 0.1, 10.1*Pi}, DisplayFunction -> Identity];points = First@Cases[g, Line[x_] -> x, Infinity];signs = Sign /@ points[[All, 2]];positions = Union[#, # + 1] &@Flatten@Position[Rest[signs*RotateRight@signs],-1]starts = 1/2Plus @@@ Partition[points[[positions, 1]], 2]x /. (FindRoot[Sin[x] == 0, {x, #1}] &) /@ starts{27, 28, 51, 52, 74, 75, 101, 102, 126, 127, 149, 150, 177, 178, 200, 201, 226, 227, 252, 253}{3.09198, 6.26091, 9.13801, 12.5265, 15.7722, 18.9688, 22.0933, 24.8161,28.1494, 31.4348}{3.14159, 6.28319, 9.42478, 12.5664, 15.708, 18.8496, 21.9911, 25.1327,28.2743, 31.4159}Bobby Treat-----Original Message-----In[2]:=points = Cases[g, Line[x_] -> x, Infinity][[1]];We make a list of the signs of the y values:In[3]:=signs = Sign /@ Transpose[Cases[g, Line[x_] -> x, Infinity][[ 1]]][[2]];We find the points where the sign changes:In[4]:=positions = Position[Rest[signs]*Rest[RotateRight[signs]], -1]Out[4]={{27}, {51}, {74}, {101}, {126}, {149}, {177}, {200}, {226}, {252}}We make a list of starting points for FindRoot:In[5]:=starts = First[Transpose[Extract[points, positions]]]Out[5]={2.7825096162536145, 6.080185995733974, 8.787418231655966, 12.198138489619575, 15.464841498197309, 18.61672099859868, 21.92859710988888, 24.46767425065356, 27.840417480532142, 31.139545383515845}We find the roots:In[6]:=(FindRoot[Sin[x] == 0, {x, #1}, WorkingPrecision -> 20] & ) /@ startsOut[6]={{x -> 3.141592653589793238462643383255068`20}, {x -> 6.283185307179586476925286766538051`20}, {x -> 9.424777960769379715387930149825109`20}, {x -> 12.566370614359172953850573533079026`20}, {x -> 15.707963267948966192313216916378673`20}, {x -> 18.849555921538759430775860299681079`20}, {x -> 21.991148575128552669238503682979946`20}, {x -> 25.132741228718345907701147066183302`20}, {x -> 28.274333882308139146163790449476032`20}, {x -> 31.415926535897932384626433832775678`20}}This question has been asked frequently so you can find various approaches, including this one, in the archives. Of course there is no guarantee. For very complex functions you may well miss some roots. The situation can become a lot more complicated if your equation has multiple roots.Andrzej Can Mathematica find (localize) ALL roots of non-polynomial equation eq[x]==0 on a given segment x in [a,b], a,b=Real?? (for example Sin[x]==0, for 0.1 ==== Perhaps it's worth recalling that probably the simplest method seems to be the one posted some time ago by Adam StrzebonskiIn[1]:=f[x_] = Normal[Sin[10.1*Pi*x] + O[x]^100];In[2]:=10.1*Pi*Select[x /. NSolve[f[x] == 0, x], Im[#1] == 0 && 0.1/(Pi*10.1) <= #1 <= 1 & ]Out[2]={31.41492328081239, 28.274379350873716, 25.132740219910605, 21.991148587034512, 18.84955591555759, 15.707963269122267, 12.56637061424962, 9.424777960775808, 6.283185307178523, 3.141592653590188}The problem is of course that it is difficult to know how long a Taylor series to take, whehter one has found all the roots and how accurate the answers are, although with careful analysis this may be a useful approach.Andrzej Kozlowski> Here's a similar solution that averages points on either side of sign> changes, to get better initial starts for FindRoot: g = Plot[Sin[x], {x, 0.1, 10.1*Pi}, DisplayFunction -> Identity];> points = First@Cases[g, Line[x_] -> x, Infinity];> signs = Sign /@ points[[All, 2]];> positions => Union[#, # + 1] &@Flatten@Position[Rest[signs*RotateRight@signs],> -1]> starts = 1/2Plus @@@ Partition[points[[positions, 1]], 2]> x /. (FindRoot[Sin[x] == 0, {x, #1}] &) /@ starts {27, 28, 51, 52, 74, 75, 101, 102, 126, 127, 149, 150,> 177, 178, 200, 201, 226, 227, 252, 253} {3.09198, 6.26091, 9.13801, 12.5265, 15.7722, 18.9688, 22.0933, 24.8161,> 28.1494, 31.4348} {3.14159, 6.28319, 9.42478, 12.5664, 15.708, 18.8496, 21.9911, 25.1327,> 28.2743, 31.4159} Bobby Treat -----Original Message-----> Sent: Friday, August 09, 2002 4:18 AM In your example, yes. Here is one way (adapted from a slightly different problem in Stan Wagon's Mathematica in Action) We make use of Mathematica's ability to plot graphs:> In[1]:=> g = Plot[Sin[x], {x, 0.1, 10.1*Pi}, DisplayFunction - Identity]; We make a list of all the coordinates of the points represented on the> graph. In[2]:=> points = Cases[g, Line[x_] -> x, Infinity][[1]]; We make a list of the signs of the y values: In[3]:=> signs = Sign /@ Transpose[Cases[g, Line[x_] -> x, Infinity][[> 1]]][[2]]; We find the points where the sign changes: In[4]:=> positions = Position[Rest[signs]*Rest[RotateRight[signs]],> -1] Out[4]=> {{27}, {51}, {74}, {101}, {126}, {149}, {177}, {200}, {226},> {252}} We make a list of starting points for FindRoot: In[5]:=> starts = First[Transpose[Extract[points, positions]]] Out[5]=> {2.7825096162536145, 6.080185995733974, 8.787418231655966,> 12.198138489619575, 15.464841498197309, 18.61672099859868,> 21.92859710988888, 24.46767425065356, 27.840417480532142,> 31.139545383515845}> We find the roots: In[6]:=> (FindRoot[Sin[x] == 0, {x, #1}, WorkingPrecision - 20] & ) /@ starts Out[6]=> {{x -> 3.141592653589793238462643383255068`20},> {x -> 6.283185307179586476925286766538051`20},> {x -> 9.424777960769379715387930149825109`20},> {x -> 12.566370614359172953850573533079026`20},> {x -> 15.707963267948966192313216916378673`20},> {x -> 18.849555921538759430775860299681079`20},> {x -> 21.991148575128552669238503682979946`20},> {x -> 25.132741228718345907701147066183302`20},> {x -> 28.274333882308139146163790449476032`20},> {x -> 31.415926535897932384626433832775678`20}}> This question has been asked frequently so you can find various> approaches, including this one, in the archives. Of course there is no> guarantee. For very complex functions you may well miss some roots. The> situation can become a lot more complicated if your equation has> multiple roots. Andrzej> Can Mathematica find (localize) ALL roots of non-polynomial equation> eq[x]==0> on a given segment x in [a,b], a,b=Real??> (for example Sin[x]==0, for 0.1Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ ==== Better yet, avoid unnecessary contortions:f[x_] = Normal[Sin[x] + O[x]^100];Plot[f[x] - Sin[x], {x, 0.1, 10Pi}, PlotRange -> All];Select[x /. NSolve[f[x] == 0, x], Im[#1] == 0 && 0.1 ? #1 ? 10.1Pi &]{3.14159, 6.28319, 9.42478, 12.5664, 15.708, 18.8496, 21.9911, 25.1327,28.2744, 31.4156}The Plot should tell us whether we have enough terms in the Series.Bobby Treat-----Original Message-----Out[2]={31.41492328081239, 28.274379350873716, 25.132740219910605, 21.991148587034512, 18.84955591555759, 15.707963269122267, 12.56637061424962, 9.424777960775808, 6.283185307178523, 3.141592653590188}The problem is of course that it is difficult to know how long a Taylor series to take, whehter one has found all the roots and how accurate theanswers are, although with careful analysis this may be a useful approach.Andrzej Kozlowski> Here's a similar solution that averages points on either side of sign> changes, to get better initial starts for FindRoot: g = Plot[Sin[x], {x, 0.1, 10.1*Pi}, DisplayFunction -> Identity];> points = First@Cases[g, Line[x_] -> x, Infinity];> signs = Sign /@ points[[All, 2]];> positions => Union[#, # + 1]&@Flatten@Position[Rest[signs*RotateRight@signs],> -1]> starts = 1/2Plus @@@ Partition[points[[positions, 1]], 2]> x /. (FindRoot[Sin[x] == 0, {x, #1}] &) /@ starts {27, 28, 51, 52, 74, 75, 101, 102, 126, 127, 149, 150,> 177, 178, 200, 201, 226, 227, 252, 253} {3.09198, 6.26091, 9.13801, 12.5265, 15.7722, 18.9688, 22.0933,24.8161,> 28.1494, 31.4348} {3.14159, 6.28319, 9.42478, 12.5664, 15.708, 18.8496, 21.9911,25.1327,> 28.2743, 31.4159} Bobby Treat -----Original Message-----> Sent: Friday, August 09, 2002 4:18 AM In your example, yes. Here is one way (adapted from a slightlydifferent problem in Stan Wagon's Mathematica in Action) We make use of Mathematica's ability to plot graphs:> In[1]:=> g = Plot[Sin[x], {x, 0.1, 10.1*Pi}, DisplayFunction - Identity]; We make a list of all the coordinates of the points represented on the> graph. In[2]:=> points = Cases[g, Line[x_] -> x, Infinity][[1]]; We make a list of the signs of the y values: In[3]:=> signs = Sign /@ Transpose[Cases[g, Line[x_] -> x, Infinity][[> 1]]][[2]]; We find the points where the sign changes: In[4]:=> positions = Position[Rest[signs]*Rest[RotateRight[signs]],> -1] Out[4]=> {{27}, {51}, {74}, {101}, {126}, {149}, {177}, {200}, {226},> {252}} We make a list of starting points for FindRoot: In[5]:=> starts = First[Transpose[Extract[points, positions]]] Out[5]=> {2.7825096162536145, 6.080185995733974, 8.787418231655966,> 12.198138489619575, 15.464841498197309, 18.61672099859868,> 21.92859710988888, 24.46767425065356, 27.840417480532142,> 31.139545383515845}> We find the roots: In[6]:=> (FindRoot[Sin[x] == 0, {x, #1}, WorkingPrecision - 20] & ) /@ starts Out[6]=> {{x -> 3.141592653589793238462643383255068`20},> {x -> 6.283185307179586476925286766538051`20},> {x -> 9.424777960769379715387930149825109`20},> {x -> 12.566370614359172953850573533079026`20},> {x -> 15.707963267948966192313216916378673`20},> {x -> 18.849555921538759430775860299681079`20},> {x -> 21.991148575128552669238503682979946`20},> {x -> 25.132741228718345907701147066183302`20},> {x -> 28.274333882308139146163790449476032`20},> {x -> 31.415926535897932384626433832775678`20}}> This question has been asked frequently so you can find various> approaches, including this one, in the archives. Of course there is no> guarantee. For very complex functions you may well miss some roots.The> situation can become a lot more complicated if your equation has> multiple roots. Andrzej> Can Mathematica find (localize) ALL roots of non-polynomial equation> eq[x]==0> on a given segment x in [a,b], a,b=Real??> (for example Sin[x]==0, for 0.1Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ ==== hi,I wanted to know if anybody has tried simulatingDSSS.. or tracking code DSSS ...anyspread spectrum simulation on mathematica.please let me know if any pointers are available onthe net.thanks_________________________________________________ _Do You Yahoo!?HotJobs - Search Thousands of New Jobshttp://www.hotjobs.com ==== Dear friendsI wish to build a function to obtain from a list (i.e.:)list = {a1, a2, a3, a4};and output like this:{{f[a2, a1, a2]},{f[a3, a1, a2], f[a3, a2, a3]},{f[a4, a1, a2], f[a4, a2, a3], f[a4, a3, a4]}}This following function work finefunction1[tau1_] := Table[Table[ f[Extract[tau1, j + 1], Extract[tau1, i], Extract[tau1, i + 1]], {i, 1, Length[tau1] - Length[tau1] + j}], {j, 1, Length[tau1] - 1}]function1[list] // TableFormbut I think is not so eleghant. I will appreciate any help to build a more effecient and eleghant solutionGuillermo Sanchez ==== > I have solved the problem with the fonts. It required modifying the Format> Type Styles at the end of the style sheet.> So my only remaining question now is, are there any known problems associated> with modifying these fonts to Arial, or sharing problems if I save a notebook> in Arial then pass it on to someone who uses the default style sheet?The answer to your question depends on two criteria:1) Does the notebook you're sharing contain a private copy of your modified style sheet, or is the notebook configured to use a shared version of your modified style sheet?If the notebook contains a private copy, then the front end on the recipients machine will attempt to use the font settings as you specified. If not, then the notebook will use the shared default style sheet on his or her system, which means your font settings will not be used.2) If the answer to (1) was private copy, then the next question is whether Arial is installed on the end user's system. Bear in mind that Arial started out as a Microsoft-specific TrueType font that was supposed to provide a sans-serifed font akin to Helvetica. There is a possibility that Mac users might not have this font available on their system. The same is especially true for Unix users, whose X servers may not support TrueType fonts or whose system administrators have not installed Arial and configured the X server to use it.-- User Interface Programmer paulh@wolfram.comWolfram Research, Inc. ==== Dave's answer also works in patternsCases[{1, Sin[x], x, y, z}, _?(MatchQ[#, _Symbol] && !MatchQ[#, x | y]&)]{z}Bob HanlonChantilly, VA USA>I don't think there is a direct analog but it is easy to make up something>that is equivalent. The following will return True for all Symbols that>are not x or y.>>test1 := MatchQ[#1, _Symbol] && !MatchQ[#1, x | y] &>>test1 /@ {1, Sin[x], x, y, z}>{False, False, False, False, True}>>David Park>djmp@earthlink.net>http://home.earthlink.net/~djmp/> Dear members,>>There is an equivalent of Or (||) to be used with patterns: Alternative>(|). I couldn't find an equivalent for And (&&) and Not (!). I don't>know if they don't exist, or it is just that I can`t find them.>Julio> ==== > Does anyone know how to change the default (ASCII?) Input font which is> used by Mathematica on every Input line to something easier for me to> read like, Arial?> After getting some excellent advice on working with style sheets, I have> been able to configure the front end substantially but am still unable> to change what is, however universal, still a difficult font for me to> read.Front end style sheets include prototypes for Mathematica format typeslike StandardForm and InputForm. You will find these settings near the bottom of the style sheet notebook. If a cell style is configured to use a format type, then the settings in the format type protoptype cell will override the settings in the cell style itself.For example, suppose you change the FontFamily option value in Input to Arial. By default, the Input style uses the StandardForm format type. The prototype for StandardForm includes the FontFamily option with its value set to Courier.To ensure that Arial is used, you need to change the FontFamily option inthe StandardForm prototype cell. Bear in mind that this will cause allcell styles, such as Output, that use StandardForm to inherit this font aswell.Another caveat for you is that some format types (InputForm andOutputForm, for example), assume a monospaced font is being used todisplay text. It is probably not a good idea to use Arial for theseformat types. Choose a monospaced sans serifed font like Lucida Console instead.-- User Interface Programmer paulh@wolfram.comWolfram Research, Inc. ==== SM> In Mathematica 3.0 resolve this equation without problem.Sure not.Mathematica 3.0 returns exactly the same warning messages asMathematica 4.0 does.Mathematica got stymied because to get to a sensible outputyou must1) use, in NDSolve, not {x, 0, Z} but something like {x, 0, 1} so Mathematica's algorithms could know over which range they must work and calculate the stepsize(s) required2) define coefac[x], alfaam, alfaem, etas, sinalfinal in terms of constants and/or functions of x and/or y[x] to get Mathematica the opportunity to plunge into numeric valuesHow could you recognize your own bug? Just pay attention tothose ominous words non-numerical value ;-)In fact, you asked Mathematica kinda to find the numeric value ofthe expression x without defining x. You cannot do it, Mathematicacannot do it, nobody can do it.Best wishes,Vladimir ==== ======================================== ==== ===============Vladimir BondarenkoMathematical DirectorSymbolic Testing GroupWeb : http://www.CAS-testing.org/ http://www.beautyriot.com/ (teamwork) http://www.ohaha.com/ (teamwork)Voice: (380)-652-447325Mail : 76 Zalesskaya Str, Apt 29, Simferopol, Crimea, UkraineP.S.Only the owners of www.maplesoft.com domain name can access thissiteI will keep the site open from August 11 till August 21, 2002.VB ==== Bobby,Ted Ersek has a package on MathSource called Rootsearch that is prettydecent at finding roots. Here is how it works on your examples.<< Enhancements`Rootsearch`RootSearch[Sin[x] + 1 == 0, {x, -30, 30}]{{x -> -26.7035}, {x -> -20.4204}, {x -> -14.1372}, {x -> -7.85398},{x -> -1.5708}, {x -> 4.71239}, {x -> 10.9956}, {x -> 17.2788}, {x ->23.5619}, {x -> 29.8451}}The last example is of course more difficult because there are an infinitenumber of roots clustered around zero. However, if we want to find the rootsin a given range:roots = RootSearch[1 + Sin[1/x] == 0, {x, 0.005, 0.01}]Length[roots]{{x -> 0.00501275}, {x -> 0.00517577}, {x -> 0.00534975}, {x -> 0.00553582}, {x -> 0.00573531}, {x -> 0.00594972}, {x -> 0.00618077}, {x -> 0.0064305}, {x -> 0.00670126}, {x -> 0.00699582}, {x -> 0.00731747}, {x -> 0.00767012}, {x -> 0.00805848}, {x -> 0.00848826}, {x -> 0.00896648}, {x -> 0.00950179}}161 + Sin[1/x] /. roots{0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}Plot[1 + Sin[1/x], {x, 0.005, 0.01}];Not too bad.David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ equationIn your example, yes. Here is one way (adapted from a slightly differentproblem in Stan Wagon's Mathematica in Action)We make use of Mathematica's ability to plot graphs:In[1]:=g = Plot[Sin[x], {x, 0.1, 10.1*Pi}, DisplayFunction -> Identity];We make a list of all the coordinates of the points represented on thegraph.In[2]:=points = Cases[g, Line[x_] -> x, Infinity][[1]];We make a list of the signs of the y values:In[3]:=signs = Sign /@ Transpose[Cases[g, Line[x_] -> x, Infinity][[ 1]]][[2]];We find the points where the sign changes:In[4]:=positions = Position[Rest[signs]*Rest[RotateRight[signs]], -1]Out[4]={{27}, {51}, {74}, {101}, {126}, {149}, {177}, {200}, {226}, {252}}We make a list of starting points for FindRoot:In[5]:=starts = First[Transpose[Extract[points, positions]]]Out[5]={2.7825096162536145, 6.080185995733974, 8.787418231655966, 12.198138489619575, 15.464841498197309, 18.61672099859868, 21.92859710988888, 24.46767425065356, 27.840417480532142, 31.139545383515845}We find the roots:In[6]:=(FindRoot[Sin[x] == 0, {x, #1}, WorkingPrecision -> 20] & ) /@ startsOut[6]={{x -> 3.141592653589793238462643383255068`20}, {x -> 6.283185307179586476925286766538051`20}, {x -> 9.424777960769379715387930149825109`20}, {x -> 12.566370614359172953850573533079026`20}, {x -> 15.707963267948966192313216916378673`20}, {x -> 18.849555921538759430775860299681079`20}, {x -> 21.991148575128552669238503682979946`20}, {x -> 25.132741228718345907701147066183302`20}, {x -> 28.274333882308139146163790449476032`20}, {x -> 31.415926535897932384626433832775678`20}}This question has been asked frequently so you can find variousapproaches, including this one, in the archives. Of course there is noguarantee. For very complex functions you may well miss some roots. Thesituation can become a lot more complicated if your equation hasmultiple roots.Andrzej Can Mathematica find (localize) ALL roots of non-polynomial equation eq[x]==0 on a given segment x in [a,b], a,b=Real?? (for example Sin[x]==0, for 0.1 ==== Looks like we've been reinventing the wheel, folks. The package NumericalMath`IntervalRoots` has exactly what we need.< 20]Out: Interval[{0, 1.337913459004121`*^-18}, {0.06666864225044185`, 0.06666864225044247`}, {0.9903214888289147`, 0.9903214888289159`}, {1.4814395017188728`, 1.4814395017188753`}, {1.7387361933371692`, 1.7387361933371717`}]In: First /@ List @@ %Out: {0, 0.0666686, 0.990321, 1.48144, 1.73874}---------Selwyn Hollis ==== I think you meant Limit[(1 + 1/n)^n, n -> Infinity], which is EXACTLY e.(1 + 1/n)n // Simplify1+nBobby-----Original Message-----infinityand then the other goes to infinity. In fact, if you let the other onegoto infinity first, you'd get a different answer: lim n->0 (1+0.0000001)n=0. So evidently the answer lies somewhere between 1 and 0. Easy methods do not work on this problem.The correct answer is a number that is near 2.718. (It's an importantconstant,known to mathematicians as e = aprrox. 2.718281828...) There's no wayyoucould get that by an easy method. Jonathan Rockmannmtheory@msn.com----- Original Message -----In other words, if f(x) approaches 1 and g(x) increases without bound,f(x)^g(x) need not approach 1. Consider the limit of (1+1/x)^x as xincreases without bound, for example.David ==== The other one is easy too, via L'Hospital's rule:Limit[(1 + 1/n)^n, n -> Infinity]== Exp[Limit[n Log[1 + 1/n], n -> Infinity]]== Exp[Limit[D[Log[1 + 1/n], n]/D[1/n, n], n -> Infinity]]== Exp[Limit[n/(1 + n), n -> Infinity]]== Exp[1]Lim-----Original Message-----As a follow up to David's example:Some students seem to think that lim n->0 (1+(1/n))n = 1. Theirreasoningis this: When n->0, then 1+(1/n) -> 1. Now compute lim n->0 1 n = 1.This reasoning is just too simplistic. You have to deal with both of then'sin the expression (1+(1/n))n at the same time -- i.e., they both go to infinity simultaneously; you can't figure that one goes toinfinityand then the other goes to infinity. In fact, if you let the other onegoto infinity first, you'd get a different answer: lim n->0 (1+0.0000001)n=0. So evidently the answer lies somewhere between 1 and 0. Easy methods do not work on this problem.The correct answer is a number that is near 2.718. (It's an importantconstant,known to mathematicians as e = aprrox. 2.718281828...) There's no wayyoucould get that by an easy method. Jonathan Rockmannmtheory@msn.com----- Original Message -----In other words, if f(x) approaches 1 and g(x) increases without bound,f(x)^g(x) need not approach 1. Consider the limit of (1+1/x)^x as xincreases without bound, for example.David ==== MathGroup,I don't know why all of my symbols disappeared when I copied and pasted to thelast post I submitted. My last post makes no sense. I bet you now I'm going to get a ßood of comments about this. Sorry. It should say:A lot of people think that Lim n->00 (1+(1/n))^n 1. Their reasoning is this:When n->00, then 1+(1/n)->1. Now compute lim n->00 1^n =1.Of course, this reasoning is too simple. You have to deal with both of then's in the expression (1+(1/n))^n at the same time -- i.e., they both go to infinity simutaneously: you can't figure that one goes to infinity and then the other goes to infinity. And in fact, if you let the other onego to infinity first, you'd get a different answer: lim n->00 (1+.0000001)^n=00.So evidently the answer lies somewhere between 1 and 00. That doesn't tellus much; my point here is that easy methods do not work on this problem. The correct answer is a number that is near 2.718281828 ...i.e. the constant e. There's no way you could get that by an easy method.Jonathan mtheory@msn.com----- Original Message -----0. So evidently the answer lies somewhere between 1 and 0. Easy methods do not work on this problem.The correct answer is a number that is near 2.718. (It's an important constant,known to mathematicians as e = aprrox. 2.718281828...) There's no way youcould get that by an easy method. Jonathan Rockmannmtheory@msn.com----- Original Message -----In other words, if f(x) approaches 1 and g(x) increases without bound,f(x)^g(x) need not approach 1. Consider the limit of (1+1/x)^x as xincreases without bound, for example.David ==== No problems getting a bmp image into mathematica using import and assigning a name like g to it. Once the image is in (a displacement/deformation image created by Cosmos/Works in SolidWorks) I need to be able to generate some kind of table of (x,y,z) or (r, theta, phi) coordinates of the graph, and then interpolate the data into a harmonic function (In particular Bessel functions due to the nature of the geometry of the object being studied)...I am using Mathematica 4 and get lost...Been able to generate a Raster list, however whenever I try to manipulate this data I get errors, so obviously generating a raster is not the correct procedure...HELP!!!Jerry Mahabub ==== when trying to build (after first install) or rebuild the help indexmy system (Win XP) always hangs e.g. the build seems not to come to anend. In the task manager i see mathematica.exe consuming 99% ofavailable processor time and using more and more memory.What can i do to get this index file built correctly ? Please help. ==== You have to somehow specify the values of your constants (unless you want togo to a 3D graphic). One possibility would be as followsIn[1]:=n[e_,b_,mu_]:=1/(Exp[b(e-mu)]+1);In[2]:= Plot[n[e, b, mu] /. {b -> 1, mu -> 1}, {e, 0, 10}, AxesLabel -> {e, n(e)}, Epilog -> {Line[{{1, 0}, {1, n[1, 1, 1]}}], Text[mu, {0.91, -0.02}]}];Tomas GarzaMexico City----- Original Message -----> ^> |> |> 1| ____________> | > | > | |> |_______________ _____________________ e> mu/ how can i do it, i specified> SetAttributes{b,constant} etc ... but it don't work please help me, i use mathematica 4 ==== In a message dated 8/11/02 6:39:20 AM, remi.dumasNOSPAM@club-internet.fr >I would like to plot this function :> 1>n(e)=______________> Exp[b(e-mu)]+1>>and get a graphic like that, with the letters>>n(e)> ^> |> |>1| ____________> | > | > | |> |_______________ _____________________ e> mu > />>how can i do it, i specified>SetAttributes{b,constant} etc ... but it don't work>>please help me, i use mathematica 4Needs[Graphics`Legend`];Needs[Graphics`Arrow`];1/( Exp[b(e-mu)]+1);Rewrite the expression as1/(Exp[b*mu(e/mu-1)]+1);% == %% // SimplifyTrueIn order to Plot the normalized function you must provide one or more specific values for the product b*muWith[{btm =4, edmMax = 3}, Plot[1/(Exp[btm(edm-1)]+1), {edm,0,edmMax}, AxesLabel-> {ToString[TraditionalForm[e/mu]], n(e}}, PlotStyle -> Hue[2/3], Epilog -> { Arrow[{.9*edmMax,0}, {1.07*edmMax,0}, HeadCenter->.25], Arrow[{0,.9}, {0,1.1}, HeadCenter->.25]}, PlotRange -> {{0,1.07*edmMax},{0,1.1}}]];For multiple valuesWith[{btmMin = -1,btmMax =4,edmMax = 3,n = 6}, Plot[Evaluate[ Table[1/(Exp[btm(edm-1)]+1), {btm,btmMin, btmMax, (btmMax-btmMin)/(n-1)}]], {edm,0,edmMax}, AxesLabel-> {ToString[TraditionalForm[e/mu]], n(e}}, PlotStyle -> Table[Hue[(btm-btmMin)/(btmMax-btmMin+3)], {btm,btmMin,btmMax, (btmMax-btmMin)/(n-1)}], PlotLegend-> Table[btm, {btm,btmMin,btmMax, (btmMax-btmMin)/(n-1)}], LegendPosition->{.85,-.35}, LegendLabel->b*mu =, Epilog -> { Arrow[{.9*edmMax,0}, {1.07*edmMax,0}, HeadCenter->.25], Arrow[{0,.9}, {0,1.1}, HeadCenter->.25]}, PlotRange -> {{0,1.07*edmMax},{0,1.1}}, ImageSize -> 400]];Just for laughs:With[{btmMin = -4,btmMax =4,edmMax = 2,n = 600}, Plot[Evaluate[ Table[1/(Exp[btm(edm-1)]+1), {btm,btmMin, btmMax, (btmMax-btmMin)/(n-1)}]], {edm,0,edmMax}, AxesLabel-> {ToString[TraditionalForm[e/mu]], n(e}}, PlotStyle -> Table[Hue[(btm-btmMin)/(btmMax-btmMin+3)], {btm,btmMin,btmMax, (btmMax-btmMin)/(n-1)}], Epilog -> { Arrow[{.9*edmMax,0}, {1.07*edmMax,0}, HeadCenter->.25], Arrow[{0,.9}, {0,1.1}, HeadCenter->.25]}, PlotRange -> {{0,1.07*edmMax},{0,1.1}}, ImageSize -> 400]];Bob HanlonChantilly, VA USA ==== Have you tried the option inspector? You have there the possibility tochange the font for a cell, a notebook or any selection: Format |OptionInspector | FormattingOptions | FontOptions. BTW, I tried Arial, but Ifound it more difficult to read....Tomas GarzaMexico City----- Original Message -----> Jonathan> mtheory@msn.com ==== Assuming that you are using StandardForm for input, you'll probably want tochange that form's font family. Edit the style sheet (I suggesting importinga private copy), then scroll down the sheet to FormatTypeStyles. Select theStandard Form cell and change the font to whatever you want. AllStandardForm cells in your notebook will change.Hope this helps.Tom Burton ==== In terms of Mathematica this can be expressed as the difference between the following:In[1]:=Limit[Limit[(1 + y/n)^m, n -> Infinity], m -> Infinity]Out[1]=1In[2]:=Limit[(1 + y/Abs[x])^Abs[x], x -> Infinity]Out[2]=E^(I*Im[y] + Re[y])The latter can of course be made equal to any number, real or complex except 0. So the whole original confusion relates to the meaning of 1^Infinity. If one interpreted it in the first sense (or simply as Limit[1^x,x->Infinity]) than the answer would have been 1. However, Mathematica adopts the more general approach, considering an expression involving Infinity to be Indeterminate unless all ways of representing it as a limit lead to the same answer. Of course one should not take this too strictly, for Mathematica gives:In[3]:=Infinity!Out[3]=Infinityalthough a pretty good case can be made for Sqrt[2Pi], see :)Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/> MathGroup,> æ> I don't know why all ofæmy symbols disappeared when I copied and pasted > toæmy last post.æ My last post makes no sense.æ I bet you now I'm going > to get a ßood of comments about this.æ Sorry.æ> æ> It should say:> æ> A lot of people think that Lim n->00 (1+(1/n))^n =1.æ Their reasoning > is this:æ When n->00, then 1+(1/n)->1.æ Now compute lim n->00 1^n =1.> Of course, this reasoning is too simple.æ You have to deal with both of > the n's in the expression (1+(1/n))^n at the same time -- i.e., they > both go to infinity simutaneously: you can't figure that one goes to > infinity and then the other goes to infinity.æ And in fact, if you let > the other one go to infinity first, you'd get a different answer: lim > n->00 (1+.0000001)^n=00.æ So evidently the answer lies somewhere > between 1 and 00.æ That doesn't tell us much; my point here is that > easy methods do not work on this problem.æ The correct answer is a > number that is near 2.718281828... i.e. the constant e.æ There's no > way you could get that by an easy method.> æ> æ> Jonathan> mtheory@msn.com> æ> æ ----- Original Message -----> Sent: Sunday, August 11, 2002 6:12 AM> æ> As a follow up to David's example: Some students seem to think that lim n->0 (1+(1/n))n = 1. Their > reasoning> is this: When n->0, then 1+(1/n) -> 1. Now compute lim n->0 1 n = 1.> This reasoning is just too simplistic. You have to deal with both of > the n's> in the expression (1+(1/n))n at the same time -- i.e., the> y both go to infinity simultaneously; you can't figure that one goes to > infinity> and then the other goes to infinity. In fact, if you let the other one > go> to infinity first, you'd get a different answer: lim n->0 > (1+0.0000001)n => 0. So evidently the answer lies somewhere between 1 and> 0.æ Easy methods do not work on this problem. The correct answer is a number that is near 2.718. (It's an important > constant,> known to mathematicians as e = aprrox. 2.718281828...) There's no way > you> could get that by an easy method. Jonathan Rockmann> mtheory@msn.com ----- Original Message ----- > 0^[Infinity] => 0, as expected;> 0.9^[Infinity] => 0, as expected;> 2^[Infinity] => Infinity, as expected;> 1^[Infinity] => Indeterminate, unexpected. Naively expected: 1.> For which reason(s) is 1^[Infinity] defined as Indeterminate? Presumably because, as a limit form, 1^Infinity is indeterminate.> In other words, if f(x) approaches 1 and g(x) increases without bound,> f(x)^g(x) need not approach 1. Consider the limit of (1+1/x)^x as x> increases without bound, for example. David ==== 1. If you just want a function that accurately hits your values useInterpolatingPolynomial[{yourdata}, x]2. If you suspect that your data should nicely fit some distribution try theappropriate tests; see Statistics`HypothesisTests`.3. If you have a smart idea about your data (e. g. your data representtemperature over time in a fermentation vessel) look for known (technical)functions that describe your type of process: You will probably find moreinput variables than just time.4. Most interesting case:We know next to nothing about the real nature of the data but we want tofind out in a very broad approach if the data coincide (more or less) withvalues of some known mathematical function. Wolfram Research gives us:http://functions.wolfram.com/ where they have 37,366 functions as oftoday.....It would be interesting to know if there is something like aFunctionFinder which - given some (learned) guesses may help us toget some clue about the nature of the process underlying our data bychecking which phenomena these functions usually describe. Hopefully.Matthias BodeSal. Oppenheim jr. & Cie. KGaAKoenigsberger Strasse 29D-60487 Frankfurt am MainGERMANYMobile: +49(0)172 6 74 95 77Internet: http://www.oppenheim.de-----Ursprí.b9ngliche Nachricht-----Gesendet: Montag, 12. August 2002 09:34An: mathgroup@smc.vnet.netBetreff: Re: Corresponding function to given values...Ok, I thank you for your help. The values {1,2},{2,4},{3,9} were only anexample. And the 2 in the first pair should actually be an 1.... Butthis doesn't matter since you understood the problem. I also knew theproblem, that I have to give something like a model for thefunction... Unfortunatly, I have no idea, how the function looks like. Ithought, that Matematica is maybe able to compare these values withknown functions (and combinings of them). But it looks like there is noway...Anyway, the real pairs of values are:{{0.5,3.45058},{1,5.3352},{1.5,6.9328},{1.8,7.306},{ 1.9,7.2962},{2,7.2163},{2.5,5.8877},{3,3.7307},{3.4464,2.0000 },{4,0.6928},{5,0.04575}}At first, I thougt that the function is something like the densityfunction of the standard normal distribution... Thus, I tried thefollowing function (and lots of modifications):(a + e*x)(2[Pi] Exp[0.5 (c*x^d + b)^2])Unfortunatly, the result wasn't very accurate...I know, that this is not longer a problem a Mathematica, but I justwanted to let you know...Anyway, I thank you all for your help.Sven ==== The oldest algorithm for testing primes... the Sieve of Eratosthenes...is polynomial and deterministic. It's simply too slow to use, just likethe one at the attachment.Bobby-----Original Message-----Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== I just learned that K is a System` Symbol:Information[K]Context[K]I learned this due to an error message:Block[{K = 1}, Sum[j, {j, i}]]The same message can be generated by the following:K := 1Sum[j, {j, i}]The message can be eliminated by Removing K:Remove[K]Block[{K = 1}, Sum[j, {j, i}]]K := 1Sum[j, {j, i}]Surely, this is not intentional.--Mark. ==== The most recent entry in the archives for problems with Export are two years old. It is difficult to believe that I am the first person to try to export a figure in Adobe Illustrator format. What am I doing wrong?I am running Mathematica 4.0.1.0 under OS 9.2 on a Mac but the problem is the same on a PC.The programtmp = Plot[Sin[x], {x, 0, 2 Pi}];Export[AIFormat.ai, tmp, AI]runs without error and creates the file named. Adobe Illustrator 10 cannot open the file.What is worse is that the programtmp = Plot[Sin[x], {x, 0, 2 Pi}];Export[EpsFormat.eps, tmp, EPS]creates a file that crashes my system when trying to open it within Illustrator. ==== I cannot seem to work out how to extract a subset of information from anindexed variable (without generating a full list/matrix first).For example, suppose I define:b[1,3] = 3b[2,3] = 7b[2,4] = 5And I then want to get the list of all DEFINED values of b[2,_], i.e., theresult should be {7,5}Help appreciated!Gareth ==== ===================================== ==== =============Dr. Gareth J. RussellColumbia University ==== ============================================== ==== ========> I cannot seem to work out how to extract a subset of information from an> indexed variable (without generating a full list/matrix first).> For example, suppose I define:> b[1,3] = 3> b[2,3] = 7> b[2,4] = 5> And I then want to get the list of all DEFINED values of b[2,_], i.e., the> result should be {7,5}try DownValues[b]which gives you:{HoldPattern[b[1, 3]] :> 3, HoldPattern[b[2, 3]] :> 7, HoldPattern[b[2, 4]] :> 5}an approach using sparse matrices would be:bLst = {{1, 3} -> 3, {2, 3} -> 7, {2, 4} -> 5};Position[bLst, {2, _} -> _]{{2}, {3}}bLst[[#1]][[1]][[2]] & /@ Position[bLst, {2, _} -> _] {7, 5}hope that helpsoliverOliver Ruebenkoenig, ==== I want to extract numerical values for the separate R, G and B channel intensities, on a pixel by pixel basis, for specific (limited) regions in color photos (JPEG, TIFF, whatever), on a Mac, preferably while I'm viewing the region I'm examining.Any readily available software to do this? Can PhotoShop Elements, GraphicConverter, or Mathematica do it? ==== http://www.wolfram.com/products/applications/ digitalimage/ . Also, go to myweb pages for additional resources on image processing with Mathematica. Thelectures in the form of Mathematica notebooks, that accompany my course onDIP (ELE489) should be especially relevant.Bye, Mariusz ==== ===========================Mariusz JankowskiUniversity of Southern Mainemjkcc@usm.maine.eduhttp://www.usm.maine.edu/~mjkcc> I want to extract numerical values for the separate R, G and B channel> intensities, on a pixel by pixel basis, for specific (limited) regions> in color photos (JPEG, TIFF, whatever), on a Mac, preferably while I'm> viewing the region I'm examining. Any readily available software to do this? Can PhotoShop Elements,> GraphicConverter, or Mathematica do it? ==== In Mathematica, choose Color Selector... from the Input menu. That brings up the Mac Color Picker. Move your pointer anywhere on the screen and option-click. That will select the color. Now click Okay, and the RGBColor recipe will be pasted into the Mathematica front end.A similar thing works in GraphicConverter as well. Also, in OS X, instead of option-clicking, just press the option key.Hope that helps.----Selwyn Hollis> I want to extract numerical values for the separate R, G and B channel > intensities, on a pixel by pixel basis, for specific (limited) regions > in color photos (JPEG, TIFF, whatever), on a Mac, preferably while I'm > viewing the region I'm examining.> Any readily available software to do this? Can PhotoShop Elements, > GraphicConverter, or Mathematica do it? ==== > Dear All:> I want to make an animation that simulate the Doppler Effect, just 2D> circles travel out one by one, and at the same time,the origin of the> wave also moves toward one direction. I have no idea to make the speed> of the wave origin and the speed of traveling wave independent.Is> sincerely bryan> This will get you started<< Graphics`doppler = Table[Show[Graphics[{Table[{Red, PointSize[0.02], Point[{k/2, 0}],Yellow, Circle[{k/2, 0}, If[t < k + 1, 0, t - k - 0.5]]}, {k, 0, 20,2}], Text[A, {0, -1}], Text[B, {10, -1}]} ], Background -> Black, Frame-> True, FrameTicks -> None, ImageSize -> 576, AspectRatio -> Automatic,PlotRange -> {{-20, 20}, {-20, 20}}], {t, 0, 20}]; Tim Brophy ==== I only wanted the algorithm out of intellectual curiousity.Jeff>The oldest algorithm for testing primes... the Sieve of Eratosthenes...>is polynomial and deterministic. It's simply too slow to use, just like>the one at the attachment.>>Bobby-----Original Message----->Sent: Sunday, August 11, 2002 4:14 AM>Is there a publicly available Mathematica 3.0 notebook that implements >the Primes is in P?>>http://www.msnbc.com/news/792126.asp> ==== list will be down to new posts from Thursday August 15 to Monday nightAugust 19.I will be out-of-town and unable to moderate during that time.Posts during that time will go out on Tuesday August 20.Steve ChristensenModerator ==== Infinity! == Product[k, {k, 1, Infinity}] == Infinity! == Product[k, {k, 1, Infinity}] == E^-(D[Sum[k^(-s), {k, 1, Infinity}], s] /. s -> 0) == E^-Derivative[1][Zeta][0] == Sqrt[2*Pi]In fact Mathematica can evaluate the last three equalities:In[12]:=E^(-(D[Sum[k^(-s), {k, 1, Infinity}], s] /. s -> 0)) == E^(-Derivative[1][Zeta][0]) == Sqrt[2*Pi]Out[12]=Truewhile the first four are obvious, aren't they :)Andrzej> [Message also posted to: comp.soft-sys.math.mathematica]> In[2]:=> Limit[(1 + y/Abs[x])^Abs[x], x -> Infinity]> Out[2]=> E^(I*Im[y] + Re[y])> The latter can of course be made equal to any number, real or complex> except 0. Even 0 is possible. Take y to be -Infinity.> So the whole original confusion relates to the meaning of> 1^Infinity. If one interpreted it in the first sense (or simply as> Limit[1^x,x->Infinity]) than the answer would have been 1. However,> Mathematica adopts the more general approach, considering an expression> involving Infinity to be Indeterminate unless all ways of representing> it as a limit lead to the same answer. Of course one should not take> this too strictly, for Mathematica gives:> In[3]:=> Infinity!> Out[3]=> Infinity This seems to be obviously correct.> although a pretty good case can be made for Sqrt[2Pi], see> :) Could you please explain how a pretty good case can be made for> Sqrt[2Pi]? I looked at the link, but could not see any way to make> a case for Infinity! being Sqrt[2Pi]. David --> -------------------- http://NewsReader.Com/ --------------------> Usenet Newsgroup ServiceAndrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ ==== >I wish to build a function to obtain from a list (i.e.:)>>list = {a1, a2, a3, a4};>>and output like this:{{f[a2, a1, a2]},>{f[a3, a1, a2], f[a3, a2, a3]},>{f[a4, a1, a2], f[a4, a2, a3], f[a4, a3, a4]}}>>This following function work fine>function1[tau1_] :=> Table[Table[> f[Extract[tau1, j + 1], Extract[tau1, i], Extract[tau1, i + 1]],{i, 1,> Length[tau1] - Length[tau1] + j}], {j, 1, Length[tau1] - 1}]>>function1[list] // TableForm>but I think is not so eleghant. I will appreciate any help to build a>>more effecient and eleghant solutionTable[f[list[[i+1]],list[[j]],list[[j+1]]],{i, Length[list]-1},{j,i}]Bob HanlonChantilly, VA USA ==== Selwyn,In the plot of Abs[(1-x)^(1/x^2)] that you mention, are you adjustingPlotRange to about PlotRange->{-4,5}?Jonathan mtheory@msn.com----- Original Message -----> You are correct. However, that last limit claim is somewhat deceptive.> Based on it, one might conclude, incorrectly, that the direction of> approach to 0 is immaterial. Note that, although> Limit[(1-x)^(1/x^2), x->0, Direction-> -1] yields 0,> Limit[(1-x)^(1/x^2), x->0, Direction-> +1] yields Infinity.> Thus, when Mathematica says that Limit[(1-x)^(1/x^2), x->0] is 0, it is> making a hidden assumption of direction of approach.Actually it seems you've discovered a bug in Limit. If we allow complex values, then Limit[(1-x)^(1/x^2), x->0, Direction-> +1] should be 0, which is evident from the graph of Abs[(1-x)^(1/x^2)]. Mathematica gives Infinity for Limit[Abs[(1-x)^(1/x^2)], x->0, Direction-> +1] as well. If we don't allow complex values, then Limit[(1-x)^(1/x^2), x->0, Direction-> +1] can't exist at all (even as Infinity or -Infinity).>>In fact, you can construct similar examples in which>1^Infinity = anything you like.> Well, yes, as long as you don't like negative values. DavidSome of my favorite numbers are negative, such as (1 + x I)^(I Pi/Log[1 + x I]) = -1Note that this has the form 1^Infinity as x->0.>1^[Infinity] => Indeterminate, unexpected. Naively expected: 1.>>For which reason(s) is 1^[Infinity] defined as Indeterminate?> ==== Guillermo,You could use something like this...function2[f_][list_] := MapThread[f @@ list[[#1]] & , {Flatten[Table[{i, j, j + 1}, {i, 2, Length[list]}, {j, 1, i - 1}], 1]}, 1]list = {a1, a2, a3, a4};function2[f][list]{f[a2, a1, a2], f[a3, a1, a2], f[a3, a2, a3], f[a4, a1, a2], f[a4, a2, a3], f[a4, a3, a4]}David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ Table[Table[ f[Extract[tau1, j + 1], Extract[tau1, i], Extract[tau1, i + 1]],{i, 1, Length[tau1] - Length[tau1] + j}], {j, 1, Length[tau1] - 1}]function1[list] // TableFormbut I think is not so eleghant. I will appreciate any help to build amore effecient and eleghant solutionGuillermo Sanchez ==== Is there any built-in function in Mathematica to compute inverse Laplace-Stieltjes transform (not inverse Laplace transform)?Lenin. ==== >I cannot seem to work out how to extract a subset of information from an>indexed variable (without generating a full list/matrix first).>>For example, suppose I define:>>b[1,3] = 3>b[2,3] = 7>b[2,4] = 5>>And I then want to get the list of all DEFINED values of b[2,_], i.e.,>the>result should be {7,5}Cases[DownValues[b], b[2, _], Infinity]Bob HanlonChantilly, VA USA ==== The following is possible:Assume Mathematica runs on machine A, then you can install Java (see JLinkUser Guide p.20) on machine B. In this way you can execute Java programs onmachine B from machine A. Those programs may read data on machine B andtransfer the data to machine A, automatically.Hermann Schmitt----- Original Message ----->?! The same applies to OpenWrite, Import, Export...>Justus no, Mathematica is (unfortunately) still not integrated enough with Java.> However, you can use a modified GetURL (originally from the JLink manual)and> write wrapper funcionts (like the NetIfiy below) around it.> I.e., you would have to put give users on your cluster> (local, and even proxied) access to an Apache server with the> filesystem where the Mathematica (or other files) live visible. E.g.: Netify[func_, url_String/;StringMatchQ[url,http:*], args___]:=> Block[{imp,tmp},tmp = GetURL[url];imp=func[tmp,args];DeleteFile[tmp];imp ]; Netify[Get, http://www.mertig.com/mathdepot/misc/Isolate.m]> (* this is the same as calling Get[Isolate.m] if Isolate.m would be> lokal*)> (* this just displays a gif *)> (*Here the GetURL funcion: *) Needs[JLink`]> $ProxyHost=None;> $ProxyPort=8080; Options[GetURL]={ProxyHost :> $ProxyHost,> ProxyPort :> $ProxyPort};> GetURL[url_String, opts___?OptionQ] :=> JavaBlock[> Module[{u, stream, numRead, outFile, buf, prxyHost, prxyPort},> {prxyHost, prxyPort} = {ProxyHost, ProxyPort} /.> Flatten[{opts}] /. Options[GetURL];> StartJava[];> If[StringQ[prxyHost],> (* Set properties to force use of proxy. *)> SetInternetProxy[prxyHost, prxyPort]> ];> u = JavaNew[java.net.URL, url];> (* This is where the error will show up if the URL is notvalid.> A Java exception will be thrown during openStream, which> causes the method to return $Failed.> *)> stream = u@openStream[];> If[stream === $Failed, Return[$Failed]];> buf = JavaNew[[B, 5000]; (* 5000 is an arbitrary buffer size*)> outFile = OpenTemporary[DOSTextFormat->False];> While[(numRead = stream@read[buf]) > 0,#]&> /@ Take[Val[buf], numRead]]]> ];> stream@close[];> Close[outFile] (* Close returns the filename *)> ]> ] You can find other useful applications of GetURL at> http://www.mertig.com/neu/HTMLLinks/index_5.html One could even think of Netifying complete complex Mathematica packagesand> applications.> Kind of ASP (application service provider).> Now, if someone pays me I'll set such a system up for them ... (of course> paying attention to license issues etc.; maybe the normal Mathematicalicense> should just fade out and in the near .Net-like webservice futer> there should be only webMathematica licenses anymore).> Rolf Mertig Mertig Consulting> http://www.mertig.com> ==== >Since we're working alot across networks we wonder if it is possible> cluster where we've Mathematica installed and another Unix machine at> another domain (provided the permissions are set). I.e., is it> possible by calling OpenRead[...] with the appropriate options to open>a file on another domain machine for reading ? Perhaps by using pipes>?! The same applies to OpenWrite, Import, Export...>Justusno, Mathematica is (unfortunately) still not integrated enough with Java.However, you can use a modified GetURL (originally from the JLink manual) andwrite wrapper funcionts (like the NetIfiy below) around it.I.e., you would have to put give users on your cluster (local, and even proxied) access to an Apache server with thefilesystem where the Mathematica (or other files) live visible.E.g.:Netify[func_, url_String/;StringMatchQ[url,http:*], args___]:= Block[{imp,tmp},tmp = GetURL[url]; imp=func[tmp,args];DeleteFile[tmp];imp ];Netify[Get, http://www.mertig.com/mathdepot/misc/Isolate.m](* this is the same as calling Get[Isolate.m] if Isolate.m would be lokal*)(* this just displays a gif *)(*Here the GetURL funcion: *)Needs[JLink`]$ProxyHost=None;$ProxyPort=8080;Options[ GetURL]={ProxyHost :> $ProxyHost, ProxyPort :> $ProxyPort};GetURL[url_String, opts___?OptionQ] := JavaBlock[ Module[{u, stream, numRead, outFile, buf, prxyHost, prxyPort}, {prxyHost, prxyPort} = {ProxyHost, ProxyPort} /. Flatten[{opts}] /. Options[GetURL]; StartJava[]; If[StringQ[prxyHost], (* Set properties to force use of proxy. *) SetInternetProxy[prxyHost, prxyPort] ]; u = JavaNew[java.net.URL, url]; (* This is where the error will show up if the URL is not valid. A Java exception will be thrown during openStream, which causes the method to return $Failed. *) stream = u@openStream[]; If[stream === $Failed, Return[$Failed]]; buf = JavaNew[[B, 5000]; (* 5000 is an arbitrary buffer size *) outFile = OpenTemporary[DOSTextFormat->False]; While[(numRead = stream@read[buf]) > 0,/@ Take[Val[buf], numRead]]] ]; stream@close[]; Close[outFile] (* Close returns the filename *) ] ]You can find other useful applications of GetURL at http://www.mertig.com/neu/HTMLLinks/index_5.htmlOne could even think of Netifying complete complex Mathematica packages and applications.Kind of ASP (application service provider). Now, if someone pays me I'll set such a system up for them ... (of course paying attention to license issues etc.; maybe the normal Mathematica license should just fade out and in the near .Net-like webservice futer there should be only webMathematica licenses anymore).Rolf MertigMertig Consultinghttp://www.mertig.com ==== Try(DownValues@b)[[ All, 2]]Bobby Treat-----Original Message-----theresult should be {7,5}Help appreciated!Gareth ==== ===================================== ==== =============Dr. Gareth J. RussellColumbia University ==== ============================================== ==== ========What makes you think log(n)^(log log(n)) isn't dominated by apolynomial? Actually, it is, and the Sieve of Eratosthenes ispolynomial just like I said. For instance, n^k dominates, for ANY k>0(including 1):f[n_] := Log[n]^Log[Log[n]]Plot[{f[n]/Sqrt[n]}, {n, 1, 100000}]logF[n_] := Log[Log[n]]^2Limit[logF[n]/Log[n], n -> Infinity]In my initial testing, the Sieve is far faster than the new algorithm,too. FAR faster.Bobby-----Original Message-----Actually that's not true. The Sieve of Eratosthenes has complexitylog(n)^(log log(n)). The algorithm below is the first deterministicprimality test known to be polynomial. Unfortunately, it still appearstobe not practical.David> -----Original Message----- Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P? http://www.msnbc.com/news/792126.asp ==== I've been using Mathematica for a while, but only recently for image processing. Suppose I have the following 2D intensity arrays:r={{a1,b1},{c1,d1}};g={{a2,b2},{c2,d2}};b={{a3,b3}, {c3,d3}};Now I'd like to combine them to produce a color image.color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}] This returns{{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}which can be viewed as a color image withGraphics[Raster[color,ColorFunction->RGBColor]]//Show When the 2D arrays are large, combining them to form the color tensor as above is very time consuming. Surely there is a more efficient, clever way to combine them than my use of Table, right?Many thanks,Kevin GrossPS Any comments pro/con from users of the Digital Image Processing package are also welcome. ==== Kevin, in version 4.2 you can get approx a factor of 2 improvement by usingTranspose[Transpose/@{r,g,b},{3,2,1}]This is currently the fastest method.However, if you are using an earlier version of Mathematica, the code abovewill unpack the data and therefore run slowly and eat up over 6 times morememory. In that case compile your code and you will also get close to afactor of 2 improvement. As an example, here is the code used in the DIPpackage versions 1.0 and 1.1:cplanarInt = Compile[{{x,_Integer,3}},With[{d = Rest[Dimensions[x]},Table[ x[[All, i, j]], {i, d[[1]]}, {j, d[[2]]}]]]and check your code to see if it is unpacking your data using eitherDeveloper`PackedArrayQ or ByteCount at intermediate steps in yourcalculations.-- ==== ===========================Mariusz JankowskiUniversity of Southern Mainemjkcc@usm.maine.edu207-780-5580.. I've been using Mathematica for a while, but only recently for image> processing. Suppose I have the following 2D intensity arrays: r={{a1,b1},{c1,d1}};> g={{a2,b2},{c2,d2}};> b={{a3,b3},{c3,d3}}; Now I'd like to combine them to produce a color image. color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}] This returns {{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}} which can be viewed as a color image with Graphics[Raster[color,ColorFunction->RGBColor]]//Show When the 2D arrays are large, combining them to form the color tensor as> above is very time consuming. Surely there is a more efficient, clever> way to combine them than my use of Table, right? Many thanks, Kevin Gross PS Any comments pro/con from users of the Digital Image Processing> package are also welcome.> ==== Something like this? Partition[Transpose[Flatten/@{r, g, b}], 2]--> I've been using Mathematica for a while, but only recently for image > processing. Suppose I have the following 2D intensity arrays:> r={{a1,b1},{c1,d1}};> g={{a2,b2},{c2,d2}};> b={{a3,b3},{c3,d3}};> Now I'd like to combine them to produce a color image.> color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}]> This returns{{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}> which can be viewed as a color image with> Graphics[Raster[color,ColorFunction->RGBColor]]//Show> When the 2D arrays are large, combining them to form the color tensor as > above is very time consuming. Surely there is a more efficient, clever > way to combine them than my use of Table, right?> Many thanks,> Kevin Gross> PS Any comments pro/con from users of the Digital Image Processing > package are also welcome.> ==== > The oldest algorithm for testing primes... the Sieve of Eratosthenes...> is polynomial and deterministic. It's simply too slow to use, just like> the one at the attachment.> Bobby-----Original Message-----> Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P?> http://www.msnbc.com/news/792126.aspThe sieve method is not polynomial in the size of the number. Polynomialin the number, yes, but exponential in the size (logarithm) of thenumber.The algorithm recently making waves appears not to be practical as yet.conjecture of the authors, would possibly be viable as it would bringthe suspected complexity exponent from 6 to 3. I imagine we will eitherhear of such improvements, or, at the least, get new pseudoprimealgorithms, based on such variants of this new deterministic algorithm.Daniel LichtblauWolfram Research ==== By the way, Mathematica gets the following limit wrong:f[n_] := Log[n]^Log[Log[n]]Limit[f[n]/n, n -> Infinity]InfinityThat limit is zero. For the Sieve to be polynomial, we only need thesequence to be BOUNDED (for some power of n in the denominator).Bobby Treat-----Original Message-----In my initial testing, the Sieve is far faster than the new algorithm,too. FAR faster.Bobby-----Original Message-----Actually that's not true. The Sieve of Eratosthenes has complexitylog(n)^(log log(n)). The algorithm below is the first deterministicprimality test known to be polynomial. Unfortunately, it still appearstobe not practical.David> -----Original Message----- Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P? http://www.msnbc.com/news/792126.asp ==== Oops! I couldn't reproduce that error. Here's a more complete proofthat Log[n]^Log[Log[n]] is bounded by n, and the limit comes out right(0).f[n_] := Log[n]^Log[Log[n]]Plot[{f[n]/n}, {n, 1, 100000}]logF[n_] := Log[Log[n]]^2Limit[Log[x]/Sqrt[x], x -> Infinity]Limit[Log[x]^2/x, x -> Infinity]Limit[Log[Log[n]]^2/Log[n], n -> Infinity]Limit[Exp[logF[n]]/n, n -> Infinity]Simplify[Exp[logF[n]] - f[n]]Limit[f[n]/n, n -> Infinity]Bobby-----Original Message-----What makes you think log(n)^(log log(n)) isn't dominated by apolynomial? Actually, it is, and the Sieve of Eratosthenes ispolynomial just like I said. For instance, n^k dominates, for ANY k>0(including 1):f[n_] := Log[n]^Log[Log[n]]Plot[{f[n]/Sqrt[n]}, {n, 1, 100000}]logF[n_] := Log[Log[n]]^2Limit[logF[n]/Log[n], n -> Infinity]In my initial testing, the Sieve is far faster than the new algorithm,too. FAR faster.Bobby-----Original Message-----Actually that's not true. The Sieve of Eratosthenes has complexitylog(n)^(log log(n)). The algorithm below is the first deterministicprimality test known to be polynomial. Unfortunately, it still appearstobe not practical.David> -----Original Message----- Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P? http://www.msnbc.com/news/792126.asp ==== >>The sieve method is not polynomial in the size of the number.Polynomial in the number, yes, but exponential in the size (logarithm)of the number.Point taken, but polynomial complexity is often overrated anyway. I'vehad students tell me a problem can't be solved, simply because thealgorithm is exponential.The Simplex algorithm for linear programs is exponential worst-case, butvery fast in practice.Meanwhile, it is reputed that the FIRST polynomial time algorithm beganwith a prohibitive fixed setup cost: Let there be light.Bobby Treat-----Original Message-----> Bobby-----Original Message-----> Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P?> http://www.msnbc.com/news/792126.aspThe sieve method is not polynomial in the size of the number. Polynomialin the number, yes, but exponential in the size (logarithm) of thenumber.The algorithm recently making waves appears not to be practical as yet.conjecture of the authors, would possibly be viable as it would bringthe suspected complexity exponent from 6 to 3. I imagine we will eitherhear of such improvements, or, at the least, get new pseudoprimealgorithms, based on such variants of this new deterministic algorithm.Daniel LichtblauWolfram Research ==== How do I interpret the shading of the ListDensityPlot function?If I use something like:ListDensityPlot[Table[Sin[x]^2+Tan[y],{x,0,2*Pi},{y,0,2 *Pi}]]1. How can I interpret the shading with the z height of the function?Such an interpretation is easier if I use somthing like Plot3D whichalso labels the z (height) axis.2. What if in my plot, i want to label demarcate my axes in multiples ofPi/2, such as 0, Pi/2, Pi, 3*Pi/2 and so on, rather than theconventional integer markings on the axes?==Muhammad Sabieh AnwarOxford ==== Group,My original version of MathLink for Excel (MLX.xla) was for Excel 97, and It worked fine. Then I upgraded the package to Excel 2000 by unloading the macro from the Wolfram site. It continued working perfectly on my old environment (Windows 98 + Mathematica 4.1).But I recently upgraded to Mathematica 4.2 under Windows 2000; and when trying to load the macro (MLX.xla) for Excel2000, I got (in Excel 2000) the following message: This workbook contains a type of macro (Microsoft Excel version 4.0 macro) that cannot be disable nor signed. Therefore, this workbook cannot be opened under high security level.Does any one have any experience on this?Emilio Martin-Serrano ==== I have Mathematica 4.0, and would like to knowhow to use it to compute the bifurcation points ofthe simple logistic map. James rjmilazzo@aol.com ==== Well, this depends on the meaning of polynomial time. The running time of the Sieve of Eratosthenes is Sqt[n], but time complexity in the case of prime testing is always expressed in terms of log[n], so the sieve is considered exponential. I think the fastest deterministic test is the Rabin-Miller which is (I am not quite sure of that) Log[n]^2, but it depends on the unproved Generalized Riemann Hypothesis. Agrawal, Kayal and Saxena give a Log[n]^12 algorithm, but they also give a complete proof of its correctness. I have not read their paper but assuming that it is correct, the algorithm is certainly much faster than the sieve. On the other hand the GRH is most probably true...> The oldest algorithm for testing primes... the Sieve of Eratosthenes...> is polynomial and deterministic. It's simply too slow to use, just like> the one at the attachment. Bobby -----Original Message-----> Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P? http://www.msnbc.com/news/792126.asp> ==== I have an onyx 3200 running irix 6.5.16 with 7.3 compiler versions 7.3as soon as the math program is invoked it comes out with asegmentation fault.a file command on the core produced says that its a ÔIRIX N32 coredump of mathkernel'any solutions please...shibily ==== Hallo,i have a function with 14 Parameters. For any combination i want to get a grafik. But i get the message that out of central memory. How can i solve this. Perhaps you can help me.I hope, you can understand me. My english is not so good.Frank ==== Check out http://www.calc101.comJeff----- Original Message -----> (read backwards). Any thoughts, suggestions, sarcasms? Jonathan> mtheory@msn.com ==== Team,I'm considering writing, to the extent that it is even possible or helpful,a package which does step-by-step integration. Some possible packagesthat might inspire an approach to such include step-by-step differentiation(read backwards).Any thoughts, suggestions, sarcasms?Jonathanmtheory@msn.com ==== Dear groupI use HTMLSave.m to build up to date project aboutforthcomming large collection of notebooks (book).I have one main notebook (content.nb) from which I made links to others: chap1.nb, chap2.nb, etc.Unfortunatelly not all chaps are written yet, so each timeadding a one I need to generate entire collection of html's againdue to unique name convention scheme of HTMLSave. Atthe moment (1/3 of entire project) it takes about 3 hours on myPC. I wonder if there is a way to interupt the convertionprocess (say at the last ready notebook), then DumpSave[ ]the Mathematica state. After preparing one more notebook just put interaption point further, etc.... Is this possible at all?The most unclear problem to me is how to stop HTMLSave and then resumethe job. Also what will happen with opened files, because DumpSave reports about them.Sincerely, Arturas Acus ==== Transpose[{r, g, b}, {3, 1, 2}]Bobby Treat-----Original Message-----This returns{{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}which can be viewed as a color image withGraphics[Raster[color,ColorFunction->RGBColor]]//Show When the 2D arrays are large, combining them to form the color tensor asabove is very time consuming. Surely there is a more efficient, clever way to combine them than my use of Table, right?Many thanks,Kevin GrossPS Any comments pro/con from users of the Digital Image Processing package are also welcome. ==== >I've been using Mathematica for a while, but only recently for image >processing. Suppose I have the following 2D intensity arrays:>>r={{a1,b1},{c1,d1}};>g={{a2,b2},{c2,d2}};>b={{a3,b3} ,{c3,d3}};>>Now I'd like to combine them to produce a color image.>>color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}] >>This returns{{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}>>which can be viewed as a color image with>>Graphics[Raster[color,ColorFunction->RGBColor]]//Show >>When the 2D arrays are large, combining them to form the color tensor as>>above is very time consuming. Surely there is a more efficient, clever>>way to combine them than my use of Table, right?Transpose /@ Transpose[{r, g, b}]Bob HanlonChantilly, VA USA ==== I've been using Mathematica for a while, but only recently for image> processing. Suppose I have the following 2D intensity arrays: r={{a1,b1},{c1,d1}};> g={{a2,b2},{c2,d2}};> b={{a3,b3},{c3,d3}}; Now I'd like to combine them to produce a color image. color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}] This returns {{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}} which can be viewed as a color image with Graphics[Raster[color,ColorFunction->RGBColor]]//Show When the 2D arrays are large, combining them to form the color tensor as> above is very time consuming. Surely there is a more efficient, clever> way to combine them than my use of Table, right? Many thanks, Kevin Gross PS Any comments pro/con from users of the Digital Image Processing> package are also welcome.>I'm not a user of the Digital Image Processing package but I got the following results combining 3 1000x1000 arrays on a 1GHz Mac with version 4.2:In[5]:=n=1000;{r,g,b}=Table[Table[Random[Integer],{n},{ n}],{3}];In[3]:=Timing[Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{ i,Length[r]},{j,Length[r[[1]]]}];]Timing[Partition[ Transpose[{Flatten[r],Flatten[g],Flatten[b]}],n];]Out[3]={ 3.11 Second,Null}Out[4]={0.2 Second,Null}With n=10000 I run out of memory however.Ssezi ==== I was much too simple minded in my assessments of all the algorithms mentioned below .I should have known it's not as simple as it seemed but after all its only a hobby:). The complexity of the Sieve of Erasthoteness is well known to be O(n) (this is stated, for example, in Knuth, The Art of Computer Programming, vol 3, p. 617). The Miller-Rabin algorithm has complexity O(log(n)^5) (not log(n)^2), assuming the GRH is true. (It is also deterministic). The Agrawal, Kayal and Saxenaalgorithm has a proven complexity of O(log(n)^12) and a conjectured running time of O(log(n)^6). The the sieve is certainly not even a contender. However, as for practical implementation, it seems to me that Miller-Rabin is clearly preferable. If the GRH is true it is faster than the new one. And if you find it running slow ... well that's even better ...Andrzej> Well, this depends on the meaning of polynomial time. The running time> of the Sieve of Eratosthenes is Sqt[n], but time complexity in the case> of prime testing is always expressed in terms of log[n], so the sieve is> considered exponential. I think the fastest deterministic test is the> Rabin-Miller which is (I am not quite sure of that) Log[n]^2, but it> depends on the unproved Generalized Riemann Hypothesis. Agrawal, Kayal> and Saxena give a Log[n]^12 algorithm, but they also give a complete> proof of its correctness. I have not read their paper but assuming that> it is correct, the algorithm is certainly much faster than the sieve. On> the other hand the GRH is most probably true...> The oldest algorithm for testing primes... the Sieve of Eratosthenes...> is polynomial and deterministic. It's simply too slow to use, just > like> the one at the attachment.> Bobby> -----Original Message-----> Is there a publicly available Mathematica 3.0 notebook that implements> the Primes is in P?> http://www.msnbc.com/news/792126.asp>>Andrzej KozlowskiToyama International UniversityJAPAN ==== Dear Group,Somehow I have managed to do something in my preferences whereby whenusing characters from the basic typesetting pallette I end up with, forexample, [Beta], instead of the symbol beta. How do I get my symbols andother fancy symbols back?Yas ==== Dear Kevin,Transpose[Flatten/@{r,g,b}] should be faster. Johannes> I've been using Mathematica for a while, but only recently for image > processing. Suppose I have the following 2D intensity arrays:> r={{a1,b1},{c1,d1}};> g={{a2,b2},{c2,d2}};> b={{a3,b3},{c3,d3}};> Now I'd like to combine them to produce a color image.> color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}]> This returns{{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}> which can be viewed as a color image with> Graphics[Raster[color,ColorFunction->RGBColor]]//Show> When the 2D arrays are large, combining them to form the color tensor as > above is very time consuming. Surely there is a more efficient, clever > way to combine them than my use of Table, right?> Many thanks,> Kevin Gross> PS Any comments pro/con from users of the Digital Image Processing > package are also welcome.> <><><><><><><><><><><><>Johannes LudsteckEconomics DepartmentUniversity of RegensburgUniversitaetsstrasse 3193053 Regensburg ==== of implementation they had in mind. I slapped it together quickly.The first step of the algorithm, for instance, says something like, Ifn is of the form a^b for b>1, then return COMPOSITE. Well, I loopedthrough b from 2 to Log[2,n], calculated root=IntegerPart[n^(1/b)] foreach, and checked whether Mod[n,root]==0. There is undoubtedly a moreefficient method, and I haven't studied the paper at length to see ifthey describe one. Possibly my larger mistake has to do with taking(x-a)^r. I need to check binomial coefficients one at a time instead,to avoid calculating the ones I don't need. So... I don't have a goodimplementation.Still, my implementation took 17 seconds on my 2.2GHz machine to checkodd numbers up to only 70. It needs to be a thousand times that fast tocompete with the Sieve of Eratosthenes. (But maybe my implementation ISthat bad!)Also... despite all the smarter algorithms today, the Sieve is still agreat (perhaps necessary) component of a real strategy to identifyprimes. The Great Internet Mersenne Prime Search, for instance, uses amodified Sieve. I don't know the details but, at the very least,software using idle cycles on my machine doesn't have to worry aboutnumbers that have already been checked elsewhere.Bobby Treat-----Original Message-----conjectured running time of O(log(n)^6). The the sieve is certainly not even a contender. However, as for practical implementation, it seems to me that Miller-Rabin is clearly preferable. If the GRH is true it is faster than the new one. And if you find it running slow ... well that'seven better ...Andrzej> Well, this depends on the meaning of polynomial time. The runningtime> of the Sieve of Eratosthenes is Sqt[n], but time complexity in thecase> of prime testing is always expressed in terms of log[n], so the sieveis> considered exponential. I think the fastest deterministic test is the> Rabin-Miller which is (I am not quite sure of that) Log[n]^2, but it> depends on the unproved Generalized Riemann Hypothesis. Agrawal, Kayal> and Saxena give a Log[n]^12 algorithm, but they also give a complete> proof of its correctness. I have not read their paper but assumingthat> it is correct, the algorithm is certainly much faster than the sieve.On> the other hand the GRH is most probably true...> The oldest algorithm for testing primes... the Sieve ofEratosthenes...> is polynomial and deterministic. It's simply too slow to use, just > like> the one at the attachment.> Bobby> -----Original Message-----> Is there a publicly available Mathematica 3.0 notebook thatimplements> the Primes is in P?> http://www.msnbc.com/news/792126.asp>>Andrzej KozlowskiToyama International UniversityJAPAN ==== I'm trying to solve the following sum:Sum[ p^(n-k) (1-p)^k Binomial[n, k] * (1+ n -2 k) / (1+n-k), {k, 0, Ceiling[n/2]} ]Pls, if anyone knows if that sum has a simple solution, I'll be pleasant for a hint how to find it.Constantine.P.S. The Mathematica produces the following output for this sum: n 1 1 + nOut[1]= p ((-) (-1 + 2 p) - p 1 Ceiling[n/2] > ((-1 + -) (-1 + p) Gamma[1 + n] p n > ((1 + n) Gamma[n - Ceiling[-]] 2 n n -1 + p > Hypergeometric2F1[1, -n + Ceiling[-], 2 + Ceiling[-], ------] - 2 2 p n > 2 Gamma[1 + n - Ceiling[-]] 2 n n -1 + p > Hypergeometric2F1[1, 1 - n + Ceiling[-], 2 + Ceiling[-], ------]) 2 2 p n n > ) / (p Gamma[n - Ceiling[-]] Gamma[1 + n - Ceiling[-]] 2 2 n > Gamma[2 + Ceiling[-]])) 2Constantine ElsterComputer Science Dept.Technion I.I.T.Office: Taub 411 ==== Below I slightly modify a problem Gareth Russell had. I modified it to avoid confusion on how to generalize the solution to a different example. ------ suppose we have: b[1,3] = 3; b[0,6] = 6; b[5678, 3] = 7; b[5678, 4] = 5; Then how can we get a list of what (b) can return when the first argument is (5678). In this example we want to get {7,5}. The solution is to use the following: In[5]:= posn=Position[DownValues[b], b[5678,_] ]; Extract[DownValues[b], {First[#],2}& /@ posn ] Out[6]= {7,5} -------- Let myself or the mathgroup know if you have trouble understanding {First[#],2}& /@ posn -------- The solution above works because the definitions for (b) are stored in DownValues[b]. You can see the definitions if you evaluate the following. In[7]:= DownValues[b] -------- Ted Ersek download Mathematica Tips & Tricks from: http://www.verbeia.com/mathematica/tips/Tricks.html ==== Selwyn Hollis replied to the answers on the above subject with:Looks like we've been reinventing the wheel, folks. The packageNumericalMath`IntervalRoots` has exactly what we need .....----------Well that isn't entirely true. The above package only works if the equationcan be evaluated using Mathematica's interval arithmetic which does notsupport the evaluation of special functions (BesselJ, Beta, Zeta, ....).---------Besides that after Interval[{2, 5}] is substituted for each occurrence of(x) in an expression we get the largest possible interval that can result ifeach instance of Interval[{2, 5}] were an independent value between 2 and5. This sort of interval arithmetic can be helpful in some situations, butmore often one wants to treat each occurrence of Interval[{2,5}] as the samevalue in the given interval. And I expect this will prevent the functionsin the (NumericalMath`IntervalRoots`) package from converging in somecases. For an example of where Mathematica's interval arithmetic givesmisleading results consider the following:In[1]:= Clear[x]; poly[x_]=ChebyshevT[12,x]; poly[Interval[{-1,1}]]Out[3]= Interval[{-9799,9801}]We get a very large interval above even though it's well known that -1 <= ChebyshevT[n, x] <= 1 ( for -1 I want to extract numerical values for the separate R, G and B channel > intensities, on a pixel by pixel basis, for specific (limited) regions > in color photos (JPEG, TIFF, whatever), on a Mac, preferably while I'm > viewing the region I'm examining.> Any readily available software to do this? Can Mathematica do it?> In Mathematica, choose Color Selector... from the Input menu. That > brings up the Mac Color Picker. Move your pointer anywhere on the screen > and option-click. That will select the color. Now click Okay, and the > RGBColor recipe will be pasted into the Mathematica front end.> A similar thing works in GraphicConverter as well. Wow -- interesting -- it does work!I originally thought I'd have to get a JPEG image, say, into Mathematica using Import[], then Show[] it, to do this; and that does work, although Mathematica gets unhappy at importing JPEGs of any size, and is very slow at Show[]ing them.But Mathematica (on a Mac) will actually do this with an image displayed on screen using other graphics programs as well. A bit tedious -- you have to jump back and forth between Mathematica and the image, and re-open Color Selector from the menu for each sample. But, you can select and read off the color in any of multiple formats besides RGB.Sure would be nice if you could automate this in some fashion -- but I guess that's what the Mathematica Digital Image Processing package does.Damned if I can find any mention of this in the Mathematica Book or the online documentation. ==== >when trying to build (after first install) or rebuild the help index>my system (Win XP) always hangs e.g. the build seems not to come to an>end. In the task manager i see mathematica.exe consuming 99% of>available processor time and using more and more memory.>>What can i do to get this index file built correctly ? Please help.>Your preferences may be corrupted. It might help to try the following:http://support.wolfram.com/mathematica/interface/ customize/corruptpreferencescache.htmlhttp:// support.wolfram.com/mathematica/interface/customize/ corruptpreferencesfile.html-Dale ==== >The default setting for FractionBox seems to be to have fonts smaller than>the rest of the fonts in the cell. How can I globally set the fonts to be>the same in a FractionBox as the default font size for the cell (which I>know how to set but cannot figure out what to do with FractionBox).>>I do not want to manually change each specific character on account of there>being too many and also I have the default cell font size for print out>different from working and wrapping a Stylebox[ , fontSize-> ] around a>character seems to lock the fontsize and therefore messes up the way it>looks when printed.>>thanks>>MikeThis is controlled by an option called ScriptSizeMulitpliers. If you set it to 1 at the global level, then you'll get the behavior you want.-------------------------------------------------------- ------Omega ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== >> I've been using Mathematica for a while, but only recently for image>processing. Suppose I have the following 2D intensity arrays:>>r={{a1,b1},{c1,d1}};>g={{a2,b2},{c2,d2}};>b={{a3,b3} ,{c3,d3}};>>Now I'd like to combine them to produce a color image.>>color=Table[{r[[i,j]],g[[i,j]],b[[i,j]]},{i,2},{j,2}] >>This returns{{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}>>which can be viewed as a color image with>>Graphics[Raster[color,ColorFunction->RGBColor]]//Show >>When the 2D arrays are large, combining them to form the color tensor as>above is very time consuming. Surely there is a more efficient, clever>way to combine them than my use of Table, right?>PS Any comments pro/con from users of the Digital Image Processing>package are also welcome.In[]:=Transpose[{r,g,b},{3,1,2}]Out[]={{{a1,a2,a3} ,{b1,b2,b3}},{{c1,c2,c3},{d1,d2,d3}}}------------------------ --------------------------------------Omega ConsultingThe final answer to your Mathematica needsSpend less time searching and more time finding.http://www.wz.com/internet/Mathematica.html ==== I want to make an animation that simulate the Doppler Effect, just 2Dcircles travel out one by one, and at the same time,the origin of thewave also moves toward one direction. I have no idea to make the speedof the wave origin and the speed of traveling wave independent.Is sincerely bryan ==== My saying Mathematica being uneffective in simulations and all was not meantprecisely as said, explaining is needed, tough I won't delve in it now.For the sake of simulating Dopplet efect, i.e. building an animation, justfollow my previous example :Module[ { x2 = 10, dx = .5, mach = 1.5 }, Show[ Graphics[ { Table[Circle[{i, 0}, 1/mach (# - i)], {i, 0, #, dx}] } ] , PlotRange -> {{-x2, x2}, {-x2, x2}} , AspectRatio -> Automatic ] & /@ Range[0, x2, dx] ]Hope that helps anyway,Borut> Dear All:> I want to make an animation that simulate the Doppler Effect, just 2D> circles travel out one by one, and at the same time,the origin of the> wave also moves toward one direction. I have no idea to make the speed> of the wave origin and the speed of traveling wave independent.Is> sincerely bryan> ==== I'm writing a Mathematica document and I want to include a table of contents, however, I'm struggling to get the page numbers to aligned on the right margin. Can anyone help?Dugmore Biyana ==== No ßickering at all on my Powerbook G4.-- Asghar Bhatti> The line below is from the ÔExtra Examples' in the help browser for the> BitAnd function. > On my computer the resulting graphic ßickers rapidly.> Do others have the same results, and does anyone have an explanation for the> ßickering? > I suspect this is demonstrating a limitation of my monitor/graphics card.> In[1] := > ListDensityPlot[Table[Sign[BitAnd[x,y]],{x,127},{y,127}]];--- --> Ted Ersek > ==== Oliver,I think the closest you will get to the feature in vi isNotebookAutoSave->True.You can get to this via Preferences->NotebookOptions->FileOptionsYas I am looking for a feature in the mathematica front end editor that behaves> like e.g vi in case of an OS crash: vi offers the option to recover the currently edited file at the time of> the crash. So additionaly to your last saved version you can recover the> latest changes that you incoperated and have not saved so far. Is there a> similar feature in the mathematica front end, and how would I activate> this? Simply using save is irritating since at times I wish to rearrange greater> pieces of code without saving the change until the code does what it is> supposed to. thanks for any help and hints,> Oliver Ruebenkoenig, > ==== Hallo,can do all the calculations within one software.Now I'm looking for a package which helps to draw circuit diagrams withoutusing the very basic drawing primitives.Is there a small package (shareware or freeware, nothing commerciallyavailable) with symbols of resistors, capacitors, FET and bipolartransistors as well as voltage and currentsources?I want to avoid drawing my schematics with OrCAD capture and import them asgraphics into my notebook. I also want to demonstrate the capabilities ofMathematica as a universal system for doing calculations and make them readyfor publish.Oliver Friedrich ==== Christopher,i = 6;If you set up the definition...f[i_] = i^236...Mathematica immediately evaluates the right hand side and i has a valueof 6. I am not certain why the designers choose to ignore that i_ is apattern variable on the lhs. So if you subsequently evaluate f[x] you obtain36. Not what must people want! This is a regular source of confusion.The method that works is to use a delayed set (:= instead of =).Clear[f]f[i_] := i^2Thenf[x]x^2But since i still has a valuef[i]36David Parkdjmp@earthlink.nethttp://home.earthlink.net/~djmp/ together. Any help would be greatly appreciated.-chris ==== In Mathematica 4.2, Help says in part ...Limit therefore makes no> explicit assumptions about symbolic functions. Same for the Package> NLimit. Therefore, I think we're out of luck here.You can't make assumptions in Limit. There are not enough general methods for such a mechanism to be really useful.> As an newbe observation, the only option for Limit (For Mathematica 4.2)> is Direction. However, if you type ??Limit, there is another Option> listed that appears not to be documented. That option is Analytic. I> thought maybe this would solve this type of problem, but it does not. I> do not know for sure what this option does. Anyone else??This is meant for the situations when you use a custom defined function. For example:In[21]:=Limit[f[Sin[x]/x], x -> 0]Out[21]=Limit[f[Sin[x]/x], x -> 0]butIn[22]:=Limit[f[Sin[x]/x], x -> 0, Analytic -> True]Out[22]=f[1] Information[Limit, LongForm -> True]> Limit[expr, x->x0] finds the limiting value of > expr when x approaches x0... Attributes[Limit] = {Listable, Protected} Options[Limit] = {Analytic -> False, Direction -> Automatic} As a possible workaround, would substituting many values for a work?> Here is what I am thinking... v = Table[Random[Real, {0, 2*Pi}], {100}]; Union[(Limit[Sin[#1*x]/(#1*x), x -> Infinity] & ) /@ v] I get all zero's like you predicted for many values of a.> {0} If you try Integers, then I get an Indeterminate because the limit> does not like a being 0. v = Table[Random[Integer, {-4, 4}], {10}]; Union[(Limit[Sin[#1*x]/(#1*x), x -> Infinity] & ) /@ v]> {0, Indeterminate}Actually the problem is that the function Sin[z]/z is singular at Infinity. Thus:In[26]:=Limit[Sin[z]/z, z -> Infinity, Direction -> -1]Out[26]=0In[27]:=Limit[Sin[z]/z, z -> Infinity, Direction -> -I]Out[27]=InfinityIn other words the limit depends on the direction. So when you considerLimit[Sin[a z]/(a z), z -> Infinity]it is not clear in which direction the limit is being taken. This depends on whether a is real or not (as Bobby Treat already pointed this out in his message),and of course there is the special case a==0.Since Limit does nto allow assumptions to be entered if you know that you will be dealing with such cases frequently one approach is to redefine limit:Unprotect[Limit];In[28]:=Limit[Sin[a_*x_]/(a_*x_), x_ -> Infinity] /; Im[a] == 0 && a != 0 = 0;Limit[Sin[a_*x_]/(a_*x_), x_ -> Infinity] /; Re[a] == 0 && a != 0 = Infinity;In[30]:=Protect[Limit];Now you need to enter assumptions about a's or b's, e.g.:In[31]:=a/:Im[a]=0;In[32]:=a/:(a.89.81æ0)=True;this says a is a non-zero real. Limit will now return the expected answer:In[33]:=Limit[Sin[a*x]/(a*x), x -> Infinity]Out[33]=0similarly for the case when b is non zero and imaginary we will get:In[34]:=b /: Re[b] = 0;In[35]:=b /: b != 0 = True;In[36]:=Limit[Sin[b*x]/(b*x), x -> Infinity]Out[12]=InfinityIf you are sure you are going to onl be dealing with non-zero real numbers you can redefine Limit to return always 0 in such cases, which may make it simpler to deal with a large number of them in one go.Andrzej KozlowskiToyama International UniversityJAPANhttp://platon.c.u-tokyo.ac.jp/andrzej/ --> Dana> Windows XP & Mathematica 4.1> = = = = = = = = = = = = = = = = => Sorry for Ôrefreshing' this message but does anyone know if I can> define the assumption below.> I don't want to write specific assumptions for each term in Limit> since I have many different variables and forms of a. Is it possible> to generalise the assumption?> it would really help me (and I really don't want to have to buy any> additional maths software).> I am also interesting in the solution of how to make an asumption> in Mathematica. I can't find any method in Mathematica. If anybody> you all ..> I know that this should be 0 but why can't I get mathematica to> think likewise.> In[4]:= Limit[Sin[a*x]/(a*x),x->Infinity]> Sin[a x]> Out[4]= Limit[--------, x -> Infinity]> a x> Is the problem a? How can I specify the properties of or> assumptions that may be made about a?> ==== I want to convert a sequence of graphic images (Graphics) created in Mathematica to a QuickTime movie using the Save Selection as QuickTime or Convert to QuickTime menu commands in Mathematica, and play them as a slide show.The images start out as EPS vector graphics in Mathematica; Ôd like to get full screen display and sharp rendering of type and lines.1) What's the aspect ratio (AspectRatio) and image size (ImageSize) for a QuickTime movie? ( Can this be changed?)2) What Compression (Animation, Graphics, TIFF. etc) should I use in the QuickTime conversion to get sharp rendering of type and lines in a magnified image of the graphics? (Is there any vector image format available in the QuickTime Player?)3) Is there any way to get rid of the surrounding Movie Player frame and play a movie full screen? ==== > I want to convert a sequence of graphic images (Graphics) created in> Mathematica to a QuickTime movie using the Save Selection as QuickTime> or Convert to QuickTime menu commands in Mathematica, and play them as> a slide show.> The images start out as EPS vector graphics in Mathematica; Ôd like to> get full screen display and sharp rendering of type and lines.Alas, QuickTime is for raster animation only. You are thinking of somethinglike Flash or Scalable Vector Format, which are not supported byMathematica. (It would be nice if they were!)> 1) What's the aspect ratio (AspectRatio) and image size (ImageSize) for> a QuickTime movie? ( Can this be changed?)As far as I can tell, Mathematica saves the frames exactly as displayed in the FrontEnd. So if you want higher resolution, you should make the images bigger tobegin with.> 2) What Compression (Animation, Graphics, TIFF. etc) should I use in> the QuickTime conversion to get sharp rendering of type and lines in a> magnified image of the graphics? (Is there any vector image format> available in the QuickTime Player?)The compression options are all raster-based, so none will give you what youare after (see above). Given that, the Animation option seems fine forthis kind of thing.> 3) Is there any way to get rid of the surrounding Movie Player frame> and play a movie full screen?Yes, by upgrading to QuickTime Pro, which is about $30 or so from Apple, orby using one of the many alternative movie players out there. Note that asyou will be scaling up a raster image, it will be blocky/blurry at largesizes unless you start with a very high-resolution series of images.An alternative approach is to save the images as separate image files withnames like image1, image2, etc. You can then generate a movie from the imagelist, again, using QuickTime Pro or a shareware solution. I'm not sure, butyou may be able to specify a vector format (such as EPS) or a hybrid (suchas PICT) for the images, and still have this read into a movie. The imageswill still be converted to raster as the movie is made, but you should beable to specify the output resolution as an option in QuickTime Pro, andhave it scale nicely to that size.Hope this helps!NOTE NEW E-MAIL ADDRESS BELOW! ==== =================================================== ===Dr. Gareth J. RussellDepartment of Ecology, Evolution and Environmental BiologyColumbia University MC 55571108 Schermerhorn Extension1200 Amsterdam AvenueNew York, NY 10027 FAX: (212) 854 8188 ==== ===================================================== =Reply-To: ==== Put a newline after each equation, but put them all in a single inlinecell.Bobby-----Original Message-----Mike,Two ways1) Start an inline cell in your text cell (menu>Edit>ExpressionInput>StartInline Cell)Type in your equations with the alignment marker (Esc am Esc) in aftereachequal sign.Close the inline cell (menu>Edit>Expression Input>End Inline Cell).Select the text cell (or the inline cell, though this is a delicateoperation, do it by repeatedly double clicking in it}.Use menu> Format>Text Alignment>On Alignment Marker.-- you will find that all single letters are now italic - you can selectindividual letters and change this - alternatively you can select theinlinecell and use the option inspector (menu>Format>Option Inspector) to setSingleLetterItalics->False)-- you can put existing text in an inline cell by selcting it and usingmenu>Edit>Expression Input>Start Inline Cell, but you may have toadjustthe line breaks after this.2) use a grid box with a column for the equal sign and set the columnalignments appropriately - but this maay give problems if you want texttorun over columns.--Allan---------------------Allan HayesMathematica Training and ConsultingLeicester UKwww.haystack.demon.co.ukhay@haystack.demon.co.ukVoice : +44 (0)116 271 4198 ==== Mathgroupies: hoping one of you can help with the following:I've got a Mathematica question from one of the students workingon Macintosh OS-X support. He's trying to run the kernel onone OS-X machine and display on another, but he can't get it towork. Do you know much about how this is done? Both machineswill run it standalone ok, but when he tries to launch a remotekernel, it basically just exits immediately. Running top onboth machines indicates that it brießy starts and then dies.If you have any ideas at all, we'd really appreciate it.I thought that if anyone here might know, it would be you.-- -- -- -- -- -- -- -- -- -- -- -- Daniel Reeves http://ai.eecs.umich.edu/people/dreeves/In this house we obey the laws of thermodynamics! -- Homer Simpson ==== > -----Original Message-----> Sent: Friday, August 02, 2002 8:43 AM> If we want to contract two tensor arrays S and T in > Mathematica we can write> S.T. We could also use the Inner product. This will contract > the last level> of S with the first level of T.> I would like to know how to contract more than one pair of > levels. Suppose S> and T are 3rd order tensors and I want to contract the last > two levels of S> with the first two levels of T. How can I do that?> Or suppose I wanted to contract all three levels. For example with...> Smat = Array[S, {3, 3, 3}]> Tmat = Array[T, {3, 3, 3}]> I would like to obtain the answer...> Smat Transpose[Tmat, {3, 2, 1}]> Plus @@ Flatten[%]> but by a more general method. That is, I would like to > contract any number> of adjacent levels in two tensors.> David Park> djmp@earthlink.net> http://home.earthlink.net/~djmp/Dear David,just to pass an idea (I haven't got the time to test it extensively, esp.not for performance).(1) define a tensor productTensorProduct[s_, t_] := Outer[List, s].List[t]This just maps S_a,b,c,... x T_u,v,w,... --> S_a,b,c,... T_u,v,w,...i.e. the result is one tensor.(2) define a function do contractions on (muliple) indices of a tensorContract[tt_, inxs : {_, _} ..] := Nest[Tr[#, Plus, 2] &, Transpose[tt, Block[{x = Range[TensorRank[tt]]}, x[[Join[inxs, Delete[x, List /@ Join[inxs]]]]] = x; x] ], Length[{inxs}]]Now you man do different things:a = Array[A, {2, 3, 3, 2}];Contract[a, {2, 3}]% // DimensionsContract[a, {1, 4}]% // DimensionsContract[a, {2, 3}, {1, 4}]Contract[a, {1, 4}, {2, 3}]Sum[Sum[a[[i, j, j, i]], {j, 3}], {i, 2}]s=Array[S,{2,2,3}]t=Array[T,{3,2,2}]r=s.tDimensions[r ]Contract[TensorProduct[s, t], {3, 4}] == rContract[TensorProduct[s, t], {3, 4}, {1, 6}]% // DimensionsNeedless to say that for production purposes tests for compatible tensorDimensions have to be made prior. Also doing the trivial Transpose has to beavoided (on performance reasons). Perhaps for better performance you may mixthis idea here with a application of Dot (to avoid TensorProduct and onenesting layer of Tr), but this makes more complicated coding (I haven't gotthe time to make it). The function to define the transpose prescription listis somewhat awkward, perhaps you will find something better.Anyways, I hope this is of some help.Yours, Hartmut ==== The resulting graphic shows immediately on my display and, no, no ßickeringat all.In[1]:=ListDensityPlot[Table[Sign[BitAnd[x,y]],{x,127}, {y,127}]];//TimingOut[3]={0.16 Second,Null}Probably, as you surmise, there is something with your monitor and/orgraphics card.Tomas GarzaMexico City----- Original Message -----> I suspect this is demonstrating a limitation of my monitor/graphics card. In[1] :=> ListDensityPlot[Table[Sign[BitAnd[x,y]],{x,127},{y,127}]];=== =ListDensityPlot has a default option Mesh->True.Since the mesh is drawn after the density plot itself, the rendering makes the graphic ßicker and finally turn black with the default ImageSize.Try with a much bigger ImageSize, or with Mesh->False.I tried ImageSize->4096,Mesh->True : perfect, but huge ...and Mesh->False : usual size image, expected graphics.> The line below is from the ÔExtra Examples' in the help browser for the> BitAnd function. > On my computer the resulting graphic ßickers rapidly. > Do others have the same results, and does anyone have an explanation for the> ßickering? > I suspect this is demonstrating a limitation of my monitor/graphics card.> In[1] := > ListDensityPlot[Table[Sign[BitAnd[x,y]],{x,127},{y,127}]];--- --> Ted Ersek > ==== For an entire table? You can change these and other Font options for asingle cell, for a notebook or for any selection. Use Format | OptionInspector | Formatting Options | Font Options.Tomas GarzaMexico City----- Original Message -----Sender: steve@smc.vnet.netApproved: Steven M. Christensen , Moderator ==== To change an existing table, select the table and change the fonts using theFormat menu.To change the way a table is generated, wrap the progenitor in StylePrint,as inStylePrint[TableForm[Array[f,{3,4}]], FontFamily->Braggadocio,FontColor->Hue[0]]Tom Burton ==== >I am glad that some discussion of this is being generated.>>In general I disagree with your recommendation. If palettes and StyleSheets>go along with a package, why not put them in ConfigurationFrontEndPalettes>and ConfigurationFrontEndStyleSheets, which seem to be the places made for>them? Then they automatically appear in the menu listings. (And you as a>package writer would also know where to expect to fin