mm-549 ==== Subject: Re: [numbertheory] prime modulo 10 power two function of gaps--> corrected function Corrected function: digits=200 f[n_]=16*Exp[(Log[2]/2)*(Mod[Prime[n],10]-Mod[Prime[n-1],10])] a=Table[f[n],{n,3,digits-2}] ListPlot[a,PlotJoined->True] {32,32,2,32,64,32,2,128,1,128,2,32,64,4,128,1,128,2,32,128,2,128,8,2,32,64,3 2, 2,64,2,128,32,16,1,128,4,64,4,128,1,16,32,64,32,1,32,64,32,2,128,1,16,128,4, 128,1,128,2,32,16,64,2,32,64,2,128,16,32,2,128,8,4,128,2,128,8,2,256,16,1, 16,32,128,2,128,8,2,32,64,32,8,2,256,2,128,1,32,8,128,16,4,128,1,128,16,4, 128,1,128,4,64,32,1,16,32,64,4,128,1,32,64,4,8,16,256,16,8,4,128,2,8,128,2, 256,2,64,16,32,1,16,32,64,32,16,2,64,32,2,64,2,32,64,16,2,256,16,8,2,128,4, 64,2,128,4,8,128,32,2,128,1,16,32,128,16,1,16,32,128,8,2,32,64,4,128,8,4, 128,1,32,16,8,16,128,4,8,32} > Some time in the past a Louville number was made based on the modulo ten of the Primes past 5 >which have a digit set of (1,3,7 ,9) and a magic square >multiplication table. >f[n]=10-Mod[Prime[n],10] >I noticed that their gap had a form like: >2*Log[x]/Log[2]->x >That fact led with some experimentaion to the integer sequence in >powers of two (skipping 4) as an exponential function. >With both Sqrt[2] and Exp[] as parts of it, amazingly it is always an >integer. >That result makes it a special function like a Binet. >(* prime modulo 10 power two function of gaps : set=(1,2,8,16)*) >digits=200 >f[n_]=Exp[(Log[2]/2)*(Mod[Prime[n],10]-Mod[Prime[n-1],1])]/Sqrt[2] >a=Table[f[n],{n,2,digits-2}] >ListPlot[a,PlotJoined->True] {2,4,8,1,2,8,16,2,16,1,8,1,2,8,2,16,1,8,1,2,16,2,16,8,1,2,8,16,2,8,1,8,16,1 6, > >1,8,2,8,2,16,1,1,2,8,16,1,2,8,16,2,16,1,1,8,2,16,1,8,1,2,2,8,1,2,8,1,8,8,16 , > >2,16,8,2,16,2,16,8,1,16,16,1,1,2,16,2,16,8,1,2,8,16,8,1,16,2,16,1,2,1,8,8,2 , > >16,1,8,8,2,16,1,8,2,8,16,1,1,2,8,2,16,1,2,8,2,1,1,16,16,8,2,16,2,1,8,1,16,2 , > >8,8,16,1,1,2,8,16,16,2,8,16,2,8,1,2,8,8,1,16,16,8,1,8,2,8,1,8,2,1,8,16,2,16 , > 1,1,2,16,16,1,1,2,16,8,1,2,8,2,16,8,2,16,1,2,2,1,1,8,2,1,2} >Respectfully, Roger L. Bagula tftn@earthlink.net > ------------------------ Yahoo! Groups Sponsor --------------------~--> $9.95 domain names from Yahoo!. Register anything. >http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/8HYolB/TM >--------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: > http://groups.yahoo.com/group/numbertheory/ <*> To unsubscribe from this group, send an email to: > numbertheory-unsubscribe@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: > http://docs.yahoo.com/info/terms/ > > > -- Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : alternative email: rlbtftn@netscape.net URL : http://home.earthlink.net/~tftn ==== Subject: Re: Re: Inverse of PowerExpand ------------------ Please read the original posting in this thread, then my reply, and lastly your own reply. I am sure you will see the point I am trying to make. Andrzej --------------------------- Andrzej ==== Subject: Re: Re: Notebook output write to a different file The following is the order I followed: nb=NotebookOpen[test1.nb] SelectionMove [nb,All,Notebook] SelectionEvaluate[nb] nb1 = NotebookOpen[test2.nb] And then I write the output cells from test1.nb into test2.nb. However here is what it does: It does open test1.nb and the kernel starts to process it. However before the kernel finishes the Front-end opens test2.nb and starts to write. Since the kernel is not done processing, empty cells are written in test2. And I thought there was some other way of doing it. Is there a way to pause, until the kernel can finish its processing and then the front end opens the test2.nb and start to write. Or any other way of solving this?? Namrata selection, setting the current selection to be just after the data written. > > current selection to be as specified by sel. NotebookCreate[ ] creates a new open notebook in the front end. > NotebookCreate[options] sets up the specified options for the new notebook. should help you to creat the new notebook and write your data to that > notebook. > Namrata Khemka schrieb im Newsbeitrag > Hi Everyone, > I in fact have another question. I have a gui (using guikit) that > opens up NotebookA and does all the evaluation in it (graphics, mainly > graphics). However I would like write each of the output cells to a > different notebook, for example notebookB. > > Is this possible? > > Namrata > > ==== Subject: A NIntegrate question I need to find the Inverse Fourier Transform of an expression involving Sqrt, Exp and Bessel Functions. As my interest is in the numerical response I am trying to use NIntegrate for frequency to time transform. In fact I am using it to have a Fourier Cossine transform. My problem is that I can only find an answer if I use interpolation for the frequency domain function. I was wondering if anybody can give me a help in trying to use NIntegrate to solve this problem. What I have tried didn«t work that well. Any comments are welcome. Antonio Here comes my functions.... zint[s_, rhoc_:8.82573*10^-8, rc_:0.0203454, mu_:4.0 Pi 10^-7] := Sqrt[s mu/rhoc] rhoc/(2 Pi rc)BesselI[0, Sqrt[s mu/rhoc] rc]/BesselI[ 1, Sqrt[s mu/rhoc] rc] Ze[s_,mu_:4.0 Pi 10^-7, rc_:0.0203454,rhoc_:8.82573*10^-8,rhosolo_:100.0] := s mu/(2 Pi) Log[2*(15.0+ Sqrt[rhosolo/(s mu)]/rc] Zserie[s_]:=Ze[s]+zint[s]; Y[s_,e_:1/(36.0 Pi 10^9)]:=s 2 Pi e /(Log[2*15.0/rf]) A[s_]:=Exp[Sqrt[Zserie[s]*Y[s]]*-10000.0] (* from the graphic one can see that this funciton is bounded and goes to zero as s goes to either I*Infinity or -I*Infinity *) a[t_]:=2/Pi NIntegrate[Im[A[I 2 Pi x]/(2 Pi x) Cos[ 2 Pi x t], {x,0,[Infinity]}, MaxRecursion -> 50, Method->Oscillatory] The error message did not help much for my case Numerical integration stopping due to loss of precision. Achieved neither the requested PrecisionGoal nor AccuracyGoal; suspect one of the following: highly oscillatory integrand or the true value of the integral is 0. If your integrand is oscillatory try using the option Method->Oscillatory in NIntegrate. ==== Subject: Re: List element replacement. Here's a more readable routine (I think): ClearAll@removeAndReplace removeAndReplace::usage = removeAndReplace[a,b,c] checks whether List a is contained in List b (counting multiplicities). If no, b is returned. If yes, the return value is b with the elements of a removed and the elements of c added (counting multiplicities). removeAndReplace[a_List, b_List, c_List] := Block[{aFreq, bFreq, aa, bb, f}, If[ Or[ Length@a > Length@b, {aFreq, bFreq} = Frequencies /@ {a, b}; Length@aFreq > Length@bFreq, {aa, bb} = {aFreq, bFreq}[[All, All, 2]]; Union[aa, bb] =!= Union[bb], f[{n_, x_}] := n > Extract[bFreq, {Position[bb, x][[1, 1]], 1}] && Throw@True; Catch[Scan[f, aFreq]; False] ], b, Clear@f; f[lst_, {n_, x_}] := DeleteCases[lst, x, {1}, n]; Fold[f, Join[b, c], aFreq]] ] I removed Sort and added a check with Union, among other things. > Does this do the trick? (My testing wasn't extensive.) ClearAll@removeAndReplace > removeAndReplace::usage = > removeAndReplace[a,b,c] checks whether List a is > contained in List b (counting multiplicities). If no, b is returned. If > yes, the return value is b with the elements of a removed and the elements of > c added (counting multiplicities and sorted). > removeAndReplace[a_List, b_List, c_List] := Block[{aFreq, bFreq, f, pos}, > Which[ > Length@a > Length@b, b, > Length@(aFreq = Frequencies@a) > Length@(bFreq = Frequencies@b), b, > f[{n_, x_}] := ((pos = Position[bFreq[[All, 2]], > Catch[Scan[f, aFreq]; Throw@True], > f[lst_, {n_, x_}] := DeleteCases[lst, x, {1}, n]; > Sort@Fold[f, Join[b, c], aFreq], > True, b] > ] This could be useful without the Sort, so I'd probably omit it and enter Sort@removeAndReplace[a,b,c], if I needed a sorted result. In that case, when it removes elements, it removes them starting at the front of Join[b,c]. >> Et al, >> HELP, I tried this once before but what I received back I could not make it work. >> Therefore I am following the adage that if at first you do not succeed then wait >> awhile, rethink, restate and resubmit. >> I have three lists of objects, sorted but not unioned, that is there are elements >> which will be repeated. Let us label them 'initial' list, 'compare' list, and >> 'replace' list. If all of the elements in the 'compare' list, including repeats, >> are in the 'initial' list, then remove those elements and put in the elements from >> the 'replace' list. >> Bob. > -- ==== Subject: Re: Re: Counting Runs Highlight any built-in (almost) and press the Help key, and you'll easily find out what it is. I have Needs[Statistics`] in my Init.m file, so I never load or think about stat packages. I recommend you do the same. I do the same with graphics by including Needs[Graphics`]. It saves a lot of time. >> Since this the same as one of your other suggestions, how can using this version of Frequencies be faster? I hadn't noticed they were the same; I assumed Frequencies was compiled and optimized. Looking back on the timings again, I notice brt4 and hanlonTreat are within 4% on the largest arrays, with neither of them always winning. They are the two fastest solvers, and the difference seem to be random noise. All that being so, I would use the version with Frequencies. > And the new winner -- for both speed and simplicity -- is: > brt4[v_List] := Frequencies@Split[v][[All, 1]] Where is the function Frequencies to be found? If it is the function found in Statistics`DataManipulation` then that is coded {Length[#],First[#]}&/@Split[Sort[list]] Since this the same as one of your other suggestions, how can using this version of Frequencies be faster? > -- > To reply via email subtract one hundred and four -- ==== Subject: NonlinearFit problem Hi All, Could anyone give me any suggestion for the specified fitting function f= r^a Exp[-b r]? My data point was given below, data={{0, 1.00002}, {2.31507, 26.4522}, {4.32033, 56.8265}, {6.63539, 59.6674}, {8.64066, 39.5536}, {10.9557, 21.6862}, {12.961, 10.1456}, {15.276, 4.39652}} The following way, NonlinearFit[data,f,r,{a,b}], gives the error message, FindFit::njnum: The Jacobian is not a matrix of numbers at (a,b)={1.,1.}. How should I do this fitting without the problem? Feng-Yin Chang, Institute of Physics,NCTU,Taiwan ==== Subject: Re: using the prime gaps to make a convergent series My apologies for misleading you in our recent discussions of the gaps between consecutive primes. I'd forgotten to really think about those gaps! There's a well-known conjecture (unproven either way) that there are infinitely many twin-prime pairs, where p and p+2 are both prime. The first book I picked up listed this pair, for instance, both of which are known to be prime: 2409110779845*2^60000 - 1 2409110779845*2^60000 + 1 Look here for a much bigger pair: http://www.fact-index.com/t/tw/twin_prime.html The same book says the sum of reciprocals of all the twin-primes is finite. It's called the Brun constant, and it's between 1.82 and 2.15 -- probably about 1.9021605822. It sounds odd to say it that way, but that's how much we know, or how much was known when Crandall and Pomerance's book was published (Prime Numbers: A Computational Perspective). The gap between twin-primes is 2, so if the conjecture is true (infinitely many twin-primes), the gap does not tend to infinity. Yet the gaps aren't bounded, either. The gaps series contains larger and larger numbers interspersed with small numbers. For 100,000 gaps, here are the maximum gap and the number of twin-primes found: Clear@gap gap[n_Integer]/;n>0:=Prime[n+1]-Prime[n] gaps=Array[gap,{10^5}]; Max@gaps Count[gaps,2] 114 10250 Aside from the twin-prime conjecture, it's known that PrimePi[x] is asymptotic to x/Log[x]. Differentiating, we get an approximation to the number of primes per unit increase in x: Simplify[D[x/Log[x], x]] (-1 + Log[x])/Log[x]^2 The inverse of that, Simplify[1/D[x/Log[x], x]] Log[x]^2/(-1 + Log[x]) is the approximate gap to the next prime. (That's a loosely derived _average_ in the vicinity of x, since it's based on an _asyptotic_ approximation to PrimePi, not one that's accurate at every x. We only know the ratio of PrimePi[x] to x/Log[x] tends to one as x gets large.) This approximation says average gaps do get large: Limit[Log[x]^2/(-1 + Log[x]), x -> Infinity] Infinity Looking at a few plots like this: Plot[Log[x]^2/(-1 + Log[x]), {x, 10, 10^100}] shows the gaps tend to infinity VERY slowly. Here's a comparison of actual gap averages with the approximation. (None of this is intended to be precise; averaging gaps in the vicinity of x is vague at best. I took 5 gaps on either side of the nearest prime no bigger than x.) average[x_Integer] := N[Module[{n = PrimePi[x]}, {(Prime[n + 5] - Prime[n - 5])/10, Log[x]^2/(-1 + Log[x])}]] average /@ (10^Range[2, 12]) {{4.2, 5.88255}, {6.4, 8.07702}, { 13.2, 10.3321}, {13.4, 12.608}, {15., 14.8935}, {20.8, 17.1842}, { 22.6, 19.4781}, {32.6, 21.774}, {26.4, 24.0713}, {21.8, 26.3695}, {24.4, 28.6686}} > This series works as a sum because the Prime gaps are in general > a factor of two: > Prime[n]=Prime[n-1]+Gap[n] > Gap[n]=2*w[n] > Product[1/Gap[n],{n,1,Infinity]=0 as 1/2^n->0 > In general except for the first value w[n] behaves as a chaotic > with minimum 1 and a building maximum on a cycle. > The study of what are called prime pairs ( primes 2 apart by gap) > shows this cyclic building behavior and is well known. > The cycle maximum is thought to approach infinity in a countable manner: > wmax[m]=wmax[m-1]+1 > where > m=f[Prime[n]] > (*Product converges to limit of zero as 1/2^n*) > f[m_]=Product[1/(Prime[n+1]-Prime[n]),{n,1,m}] > (* number as sum of Product gap function increments*) > Digits=200;a=Table[f[n],{n,1,Digits}]; > b=N[Apply[Plus,a],Digits] > (* digits of the new irrational number*) > c=Table[Floor[Mod[b*10^n,10]],{n,0,Digits-1}] {1,8,5,6,7,0,8,6,1,6,2,9,0,1,3,6,0,9,9,0,8,3,9,6,6,7,8,9,5,1,2,4,5,2,2,5,1,3, >8,4,6,0,3,2,7,7,1,6,1,1,9,5,9,8,2,7,9,4,8,1,8,8,6,0,8,6,7,8,6,0,4,5,0,0,8,6 , >7,1,6,9,6,1,3,2,2,1,9,0,7,4,6,2,7,2,8,3,4,7,1,2,5,6,5,4,9,5,2,5,4,3,6,4,3,0 , >2,0,8,1,1,4,0,1,6,1,8,4,9,1,6,0,7,5,1,7,6,7,3,9,4,3,1,0,4,5,2,0,8,2,1,3,6,7 , >6,5,6,7,3,4,5,7,8,4,7,6,2,6,3,5,7,8,1,3,4,1,6,3,7,5,2,4,9,4,3,8,9,9,1,5,4,8 , > 6,1,3,6,4,3,3,1,6,2} > Respectfully, Roger L. Bagula tftn@earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 : > alternative email: rlbtftn@netscape.net > URL : http://home.earthlink.net/~tftn -- ==== Subject: Re: Re: MathGroup /: Descriptive headings >> [SpamArrest would not work on my systems which are not Windows.... It doesn't matter what kind of systems you have; they have NOTHING installed on my machine, and I assume they wouldn't put anything on yours. Their only presence here is in the pop-3 mail setup, where I input the addresses and password they sent me. SpamArrest intercepts e-mail at my ISP and forwards it to me only if (a) the sender responds to an e-mail challenge, or (b) I have added them to my white list at their website. I can block or authorize specific addreses or whole domains, and I can authorize mailing lists (like this one), so everybody sending to the list doesn't get challenged. I only had to sign up at their website and change my mail setup. > I can volunteer (on a limited basis, if it helps and doesn't get too onerous) to post notebooks on my website for people who can't do it themselves. In many cases -- maybe most cases -- I'd just use the Copy as InputForm palette and return the code to them. As for spam, Park and I both use SpamArrest http://www.spamarrest.com/ to eliminate spam. It really works. The only downside to it for me -- and I don't think this should apply to you, the moderator -- is that I have to check the stopped mail I _want_ from senders who aren't human. >[SpamArrest would not work on my systems which are not Windows. I only use > UNIX systems. I consider Windows systems to be a security risk I do not > want anywhere near my work. I use spamassassin and my own hand built > procmail filters. - Moderator] > You shouldn't want mail like that at all, at the mathgroup address. >> See my comments within the message below. >> Christensen > I want to take the opportunity to reply to Paul's suggestion in > as much detail as possible. >> I am sorry I was not at the event at the Wolfram Technology > Conference when this was discussed. >> First, here are the steps I take each day to moderate this group. > Figuring out where in these steps to put in categorization would need > to fit into this. >> 1. I get perhaps 2500-3000 emails a day, every day. Of these, perhaps > 500 are not spam. Because the Mathgroup addresses are easily found > by spammers, there is no way around getting a lot of spam. >> Do you mean that the spammers are forging email addresses of MathGroup > participants and using these to post messages to MathGroup > (mathgroup@wolfram.com)? I can see how that would make things more difficult > to filter. >> Yes, this happens all the time. Spam comes to mathgroup via mailing >> list messages, newsgroup posts, spammers who have just found addresses >> in the newsgroups and archives. >> If I understand you correctly, requiring individuals to register with > you, possibly listing multiple email addresses, and bouncing email that > is not from registered participants, with a message telling them how to > register, would not work. >> No this would not work. I even get spam from wolfram.com addresses >> even though I know it did not come from there. I sometimes get >> spam from myself! >> Because I usually post from a news reader, my messages have the > following field: > Could this be used as a filter (or do spammers forge this as well)? >> Spammers forge every element of posts. >> cost money, only of the order of a couple of cents, to send any email > message. You would need to purchase a valid one-off e-stamp, using > some form of encryption technology, from some site (I'm suprised that > the automatic billing sites have not already done this). Then only valid > e-stamps would be routed though the network. There are, of course, many > issues with this proposal ...] >> Further, because MathGroup users often, unfortunately, > send html email or other attachments, maybe 10-20 of their mails get > filtered by my, fairly sophisticated but not perfect, spam filters into > my spam folder. >> To me, one of the major limitations of MathGroup is that we cannot > attach Notebooks (without including them in the body of the message). >> Attaching notebooks causes numerous problems. >> 1. Notebooks as attachments are very often rejected by spam filters >> either at ISP's, moderation level, or end users. >> 2. Can a windows user really trust that a notebook attachment is not >> a virus or worm? If I were using a Windows machine and saw an >> attachment, I would not open it. >> 3. Many notebooks are very long and some mail systems will not be able >> to handle them. Rules about attached notebooks would have >> to be devised. Not a simple matter given that I get so many >> posts that can't follow even simpler rules. >> It is far simpler to have someone put their notebook on a server somewhere >> where it can be downloaded and then include a link within the post. >> 2. Of the 500 good emails that get past my spam filters, I then have to > filter out those mails that are for Mathgroup. Then, I have to > go through the spam folder to find any MathGroup posts that might be > there. So,there are usually about 70 emails relevant to MathGroup. > Some, maybe 10 do not follow the rules - flames, licensing questions, > discussions of other systems, really trivial items, totally > non-Mathematica > related. In the end, there are 30-60 emails to read in more detail. >> Actually, if the Subject line included question categories as is being > proposed, couldn't you use this as the primary filter (or again, do > spammers forge this as well)? >> Again, spammers will grab email addresses, Subject lines, even >> content sometimes. Most of that comes to me where I filter it. >> But I have had some reports that people get email from mathgroup >> and I did not send. >> 3. Once I decide that the posts are OK, I run them through a number of > UNIX scripts and do some more editing to take out unneeded mail headers > etc. >> 4. Then the mails are run through scripts that send them to the > newsgroup and the mailing list. One of the scripts adds the > numbers to the Subject line of the mail that goes to > the mailing list. Note that the [ ] are really needed. >> As I read MathGroup in a newsreader or sometimes via Google at > I do not see the numbers or the []. Google seems to handle threading > better than my newsreader. > The numbers only go out to the mailing list to help with > The numbers do not appear at > until you click on a particular message so I'm not sure exactly how they > are useful (but then again, I avoid mailing lists and prefer to use > newsgroups or the web). (And I wonder why the Mathgroup archive is not > threaded?) >> The archive gets its message from the mailing list and I also think >> it just uses a mail to html script and not a threaded system. I do >> not do the archive. >> Suppose you just put Statistics in the Subject line, mail filters might > not always know how to do the filtering, whereas [Statistics] > is easier to filter. >> This process takes from 1-3 hours typically, depending on the > number of emails, their complexity, etc. >> I did not realise exactly how big a task you face. >> Clearly if it weren't for the spam, it would be easier. >> So, the questions are, when during this process would categorisation > take place? Who would do it? >> It would be best if contributors did such a categorisation for you, i.e. > at the time of posting. >> What would it look like? >> Instead of [], another suggestion would be (mock Mathematica syntax > using /:), e.g., >> Statistics /: Chi-square test >> This would also be harder to forge and should still be easy to filter. >> It might be possible if we can define say only 10 categories and >> then put the category either in a special header or within the >> test of a message. This could be done in a voluntary way by >> the person sending the post. >> If people want to send me a list of 10 categories, I can collect >> them and see if there really are 10 or maybe 100, which would >> be silly I think. >> Another idea would be for someone clever to write a script that >> could categorize a post. For example, all words in a post >> could be extracted to a list and then compared to a list of >> categories and those categories that that fit could be chosen >> and put on say the top line of the post to help with filtering. >> Some posts might not be easy to treat in this way, but it might >> help. >> Paul, this is your suggestion and you are known to be very clever, want to >> write such a program? >> In truth, I don't think I want to do anything unless there is >> a significant vote from end users to do it and a nice way >> to handle it consistently >> How would it effect mail and newsgroup readers? >> I imagine that it would have little effect, except the desired one of > allowing better filtering. >> I think it would be a bad idea to put things like [Statistics] in > the Subject line. Would newsgroup and mail readers be able to > thread such Subject lines? >> Surely that is exactly what they are designed to do. >> And I could filter the messages into subfolders of my MathGroup folder > automatically. >> It might be better to put it in something like an X-Category mail header, > but I am not sure that all readers could handle this. >> This idea has merit and, again, it might be harder to forge, but I don't > know enough about these headers. >> Personally, I think they would just make the Subject lines longer > and harder to read. >> Nested Re: Re: Re: ... already does this, though Google handles this > very well, in its threading, dropping all Re at the top level, listing > only the subject, and then listing the contributor for each item in the > thread. >> Yes, the Re Re Re is a problem and I will try to fix that. >> Who is going to do the categorisation? >> The contributor. >> I know a lot about > Mathematica and mathematics, but certainly not enough to figure > out what every message best fits into. If I make a poor selection > and a message has gone out it is virtually impossible to re-do > listings, archives, etc. >> Sometimes categorizations have to change. You could have >> Numerics -> Graphics /: Accurate plotting >> when there is such a change. >> Search therefore becomes inaccurate very quickly. >> I don't think that this is true. >> What if someone disagrees with my selections? >> Not a big issue, I think. I think the group will come to consensus on a > categorization, or move on to a different categorization as required. >> How much time will this add to moderation? >> I would hope that it would greatly _reduce_ your moderation time. >> I can assure you that adding more complexity to the posts will >> increase moderation time. >> If others select the categories to help me out, that will just > delay moderation. >> I do not see why. >> a category, but how does a new user know what category to pick? >> There should be a list in the rules section at >> http://smc.vnet.net/mathgroup.html >> What if a users forgets to include a categorisation? >> You can add one. >> Is someone going to go back and categorise the 51,000 messages that > are already in the archive? >> Unlikely, I think. However, I expect that the archive has grown > exponentially and will continue to do so. >> The simplest thing to do would be to have some group that is willing > categorise the posts once they get into the Wolfram Research > archive only. Then search could be done fairly easily. >> This sort of categorisation may be done in other newsgroups, but > I have not seen it. >> I expect that it is used on other newsgroups, but I have not seen it, or > there are subgroups. >> sci.math > sci.math.symbolic >> If you look at these groups you will find no real categorisation >> of any kind. I could not find any group that had any. >> I am open to suggestions and comments, but I frankly this this > is going to be a very difficult process to do. >> It was intended as a suggestion to reduce your workload, to speed up the > rate of posting to MathGroup, and to improve the automatic filtering > (and threading) of messages. >> Paul > Hi all, and especially Christensen: >> At the recent Wolfram Technology Conference in Champaign, Luc Barthelet > , a regular user of MathGroup suggested that it would be > good if all postings to MathGroup included a categorisation in their > header, e.g. >> Newbies, Graphics, Functions, Programming, Statistics, Teaching, > Integration, Numerics, Symbolic Algebra, Special Functions, ... >> so a Subject line might take the form >> [Statistics]: How to fit to an elliptical function? >> (not sure if the [ ] are required or useful). In this way, sorting by > Subject would be easier. Of course, it's not always easy to do such a > categorisation, and they may change with time (as a problem stated as a > Numerics might end up being solved using Symbolic Algebra). > Nevertheless, I think such a change would be very useful. It should also > help when doing searches on MathGroup archives. >> Paul >> -- > Paul Abbott Phone: +61 8 6488 2734 > School of Physics, M013 Fax: +61 8 6488 1014 > The University of Western Australia (CRICOS Provider No 00126G) > 35 Stirling Highway > Crawley WA 6009 mailto:paul@physics.uwa.edu.au > AUSTRALIA http://physics.uwa.edu.au/~paul >> -- ==== Subject: Re: Re: MathGroup /: Descriptive headings Yikes, that's complicated!! It collapses of its own weight, I think. >> So, the questions are, when during this process would categorisation > take place? Who would do it? >> It would be best if contributors did such a categorisation for you, i.e. >> at the time of posting. If I may add my two cents, I too think that tagging should be done > by the poster. And yet I have never seen a NG where tagging has been cnsistently adopted. > It seems that people do not care to struggle to find a cathegory for the > problem they are trying to get help for. > This is especially true for nonmoderated NGs, of course. > A moderator could in some way force posters to add a tag if they want their > post to reach the group, by automatically rejecting every non tagged > message, replying to the OP with a message showing the suggested > cathegories. Leaving to the poster the freedom to add a second, more > specific, tag could also allow for a better cathegorization of the messages. For example, the first level would be necessary to post, the second (and > third, and...) level is facultative and could be picked among a more > extensive list. It could also be 'user defined' so to speak. > This will leave a certain degrre of freedom, since a classification > is not necessarily unique. > Ten big cathegories could do. For example [Frontend] > Notebooks > Notation > GUI > Publishing > ... > [Kernel] > Scoping > Assignments > Rules > Pattern Matching > Evaluation > ... > [I/O] > Text > Table > Binary > ... > [Programming] > Functional > Logic > OO > Procedural > Rule Based > ... > [Symbolics] > List manipulation > Expression simplification > Integration > Special Functions > Differential Eq > ... > [Numerics] > Precision > Integration > Special Functions > Differential Eq > ... > [Graphics] > 2D > 3D > Primitives > Directives > ... > [Applications] (this is though) > Number Theory > Algebra > Discrete Math > Calculus > ODE > PDE > Functional > Linear Algebra > Optimization > Geometry > Probability > Statistics > Tensors > ... > [Package] > $name > Wolfram > Third Party > [Newbie] > Installation > ... Plus a wildcard: [Uncertain] The tag [Uncertain] can be changed by those who reply. It could lead to > different choices, but then, that's the spirit: allowing for multiple > 'keywords'. > For example > [Uncertain] I can't get it done! > Could become > [Package][Shapes] I can't get it done! > Or > [Package][Shapes][Remove] I can't get it done! > Or > [Newbie][Remove] I can't get it done! > Or > [Programming][Scoping] I can't get it done! > Instead of [], another suggestion would be (mock Mathematica syntax >> using /:), e.g., Since it would be as easy to forge as the 'standard' tagging I'd rather > stick with the old [...] wrapper. >> I think it would be a bad idea to put things like [Statistics] in > the Subject line. Would newsgroup and mail readers be able to > thread such Subject lines? >> Surely that is exactly what they are designed to do. Definitely. > And I could filter the messages into subfolders of my MathGroup folder >> automatically. So I am not the only one collecting all this wisdom? : ] >> It might be better to put it in something like an X-Category mail header, > but I am not sure that all readers could handle this. >> This idea has merit and, again, it might be harder to forge, but I don't >> know enough about these headers. It would be harder for the causal user to set and to take advantage of this > kind of tagging. Moreover, it'd be almost invisible and new users could not > learn by... example. >> Personally, I think they would just make the Subject lines longer > and harder to read. >> Nested Re: Re: Re: ... already does this, I couldn't agree more. Moreoever, certain newsreaders can not sort posts > with multiple Re:'s (or any other non standard prefix) correctly. > As for the length of the line, if the original poster is using a tag, he > will try to use a shorter description for the subject line. > Sometimes categorizations have to change. You could have >> Numerics -> Graphics /: Accurate plotting >> when there is such a change. > Search therefore becomes inaccurate very quickly. >> I don't think that this is true. Multiple tags will constitute multiple keyword in a search. >> What if a users forgets to include a categorisation? >> You can add one. To speed things up, there could be a transition period where a bot could add > the [Uncertain] tag, while alerting the user that to post new messages a tag > is required. > If this is done on the already filtered (i.e. non spam) messages, the load > would be sustainable. (60-70 mails per day in the worst case for the first > couple of months) Oh, well, these were only my two cents. Peltio > invalid address in reply-to. crafty demunging required to mail me. -- ==== Subject: Re: MathGroup /: Descriptive headings >> So, the questions are, when during this process would categorisation >> take place? Who would do it? It would be best if contributors did such a categorisation for you, i.e. >at the time of posting. If I may add my two cents, I too think that tagging should be done by the poster. And yet I have never seen a NG where tagging has been cnsistently adopted. It seems that people do not care to struggle to find a cathegory for the problem they are trying to get help for. This is especially true for nonmoderated NGs, of course. A moderator could in some way force posters to add a tag if they want their post to reach the group, by automatically rejecting every non tagged message, replying to the OP with a message showing the suggested cathegories. Leaving to the poster the freedom to add a second, more specific, tag could also allow for a better cathegorization of the messages. For example, the first level would be necessary to post, the second (and third, and...) level is facultative and could be picked among a more extensive list. It could also be 'user defined' so to speak. This will leave a certain degrre of freedom, since a classification is not necessarily unique. Ten big cathegories could do. For example [Frontend] Notebooks Notation GUI Publishing ... [Kernel] Scoping Assignments Rules Pattern Matching Evaluation ... [I/O] Text Table Binary ... [Programming] Functional Logic OO Procedural Rule Based ... [Symbolics] List manipulation Expression simplification Integration Special Functions Differential Eq ... [Numerics] Precision Integration Special Functions Differential Eq ... [Graphics] 2D 3D Primitives Directives ... [Applications] (this is though) Number Theory Algebra Discrete Math Calculus ODE PDE Functional Linear Algebra Optimization Geometry Probability Statistics Tensors ... [Package] $name Wolfram Third Party [Newbie] Installation ... Plus a wildcard: [Uncertain] The tag [Uncertain] can be changed by those who reply. It could lead to different choices, but then, that's the spirit: allowing for multiple 'keywords'. For example [Uncertain] I can't get it done! Could become [Package][Shapes] I can't get it done! Or [Package][Shapes][Remove] I can't get it done! Or [Newbie][Remove] I can't get it done! Or [Programming][Scoping] I can't get it done! >Instead of [], another suggestion would be (mock Mathematica syntax >using /:), e.g., Since it would be as easy to forge as the 'standard' tagging I'd rather stick with the old [...] wrapper. >> I think it would be a bad idea to put things like [Statistics] in >> the Subject line. Would newsgroup and mail readers be able to >> thread such Subject lines? Surely that is exactly what they are designed to do. Definitely. >And I could filter the messages into subfolders of my MathGroup folder >automatically. So I am not the only one collecting all this wisdom? : ] >> It might be better to put it in something like an X-Category mail header, >> but I am not sure that all readers could handle this. This idea has merit and, again, it might be harder to forge, but I don't >know enough about these headers. It would be harder for the causal user to set and to take advantage of this kind of tagging. Moreover, it'd be almost invisible and new users could not learn by... example. >> Personally, I think they would just make the Subject lines longer >> and harder to read. Nested Re: Re: Re: ... already does this, I couldn't agree more. Moreoever, certain newsreaders can not sort posts with multiple Re:'s (or any other non standard prefix) correctly. As for the length of the line, if the original poster is using a tag, he will try to use a shorter description for the subject line. >Sometimes categorizations have to change. You could have > Numerics -> Graphics /: Accurate plotting >when there is such a change. > Search therefore becomes inaccurate very quickly. >I don't think that this is true. Multiple tags will constitute multiple keyword in a search. >> What if a users forgets to include a categorisation? >You can add one. To speed things up, there could be a transition period where a bot could add the [Uncertain] tag, while alerting the user that to post new messages a tag is required. If this is done on the already filtered (i.e. non spam) messages, the load would be sustainable. (60-70 mails per day in the worst case for the first couple of months) Oh, well, these were only my two cents. Peltio invalid address in reply-to. crafty demunging required to mail me. ==== Subject: Mathematica Categorization - Humor I sometimes get spam from myself! This is so funny that I laughed out loud! Then I ran off to tell my wife, but she started chanting her You love Mathematica better than you love me! mantra so I guess she didn't get it. all day! Bill Bohrer P.S. Then I emailed it to both of my friends! BB P.P.S. Then I printed a hard copy! I'm gonna show it to my therapist on Wednesday! If she thinks it is as funny as I do, then I will even show it to my Parole Officer! ==== Subject: Re: Adding Vectors -- Newbie help please > Mathematica v5: How can I input vectors in polar form and > rectangular form? Example: a:= (r1, theta1) + (r2, theta2) Polar form. b:= (re1 , j* im1) + (re2, j*im2) Rectangular form > You could write two simple functions: pf[a_,d_]:=N[a E^(I d Degree)] polar[z_]:={Abs[z*1.],Arg[z*1.]/Degree[Degree]} (the *1. are added to force numerical evaluation) then you enter your values using pf: In[1]:= sum=pf[10,30]+pf[20,45] Out[1]= 22.8024+19.1421 I (rectangular result) In[2]:= polar[sum] Out[2]= {29.772, 40.0128ˇ) (displayed polar form of result) Mathematica displays complex numbers in rectangular form by default, so there is no need for a function rectangular. Input in rectangular form is input as a complex number: value=100+100 I polar[value] ---> {141.421, 45.ˇ) Gru§ Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de ==== Subject: Re: Adding Vectors -- Newbie help please > Ok; but I was hoping that there is a simpler way than the > following method to add two ac voltage vectors (for example): (220V, 225 degrees) > (100V, 16 degrees) Clear[r, x, y, Theta, rect, polar] rect[r_,Theta_] := { r Cos[Theta Pi/180] , r Sin[Theta Pi/180]} > polar[x_, y_] := {Sqrt[x^2 + y^2], ArcTan[x, y]180/Pi} (* Input vectors here *) > v1 := {220, 225}; > v2 := {100, 16}; r1:= rect[v1[[1]], v1[[2]] ] // N; > r2:= rect[v2[[1]], v2[[2]] ] // N; > rt := p1 + p2 polar[rt[[1]], rt[[2]]] // N This just seems so cumbersome, especially when compared to a > scientific calculator. > >Mathematica v5: How can I input vectors in polar form and >rectangular form? >>Example: >>a:= (r1, theta1) + (r2, theta2) Polar form. >>b:= (re1 , j* im1) + (re2, j*im2) Rectangular form >>I know this should be pretty basic, but I haven't found examples >of this kind of input. >>I would guess it would be something like: >> Polar[magnitude, phase] > Rectangular[Real, Imaginary] >>but, apparently not. (This is for electronics engineering.) >>You can easily write a function to convert from polar to coordinate form: >>Note that this assumes your angles are measured in radians. Once all >>your vectors are in coordinate form you can add/subtract then directly: >>{1,2}+(3,4} >>produces >>{4,6} >> Bailey I know what you mean, and people do sometimes react like that, but I have several comments. 1) A very good strategy is to have some code that you execute every time you use Mathematica. You can arrange to do that automatically, or simply execute some code in a notebook each time you start work. Remember, a calculator can do a few things neatly, but then you hit a brick wall! 2) I would suggest that you do not store r/theta values as lists because it is too easy to make a mistake and use them as x/y vectors. Why not write things like rect[220,225]+rect[100,16] - never even storing the intermediate polar form. 3) Another option, which is probably even neater is to turn your r/theta values into complex numbers and work that way. 4) Mathematica leaves things exact where possible - which is obviously why you are using //N - but this is a valuable feature of Mathematica, not a shortcoming! If your voltages were not written as integers you would not have that problem. If you want your rect function to always return real values, why not define it with the N as part of the function? I hope that helps, Bailey ==== Subject: Re: Re: Zero divided by a number... > BTW, concerning whether an improper element of an extended number > system > should be called a number or not, it might be noted that: > Floating-point > arithmetic is surely the most widely used number system in the world, > in > terms of the number of computations performed per day. There is an > internationally accepted standard for that arithmetic. The standard > clearly > distinguishes between those floating-point objects which are numbers > and > those which aren't (the NaNs). According to the standard, -Infinity and > +Infinity are numbers (while things such as 0*Infinity yield NaN). According to Mathematica: NumericQ[ComplexInfinity] False NumericQ[Infinity] False It is to say the least controversial if numbers are what complex analysts deal with. ComplexInfintiy and Infinity do not belong to any family of numbers known to number theorists (who ought to be the people who know best what numbers are), e.g. algebraic numbers, transcendental numbers, or even computable numbers. A point on the Riemann sphere is not a number. But I found this reply of yours to Bob particulalry incredible : >> ComplexInfinity isn't a number if you can't do >> arithmetic with it, But you can do arithmetic with it. Really? And presumably algebra too? I am curious how, given that this is the only number about which Mathematica does not even know if it is equal to itself: ComplexInfinity==ComplexInfinity ComplexInfinity==ComplexInfinity But then perhaps analysts mean something different by arithmetic and algebra from the rest of us ;-) Andrzej Kozlowski Chiba, Japan http://www.akikoz.net/~andrzej/ http://www.mimuw.edu.pl/~akoz/ ==== Subject: Re: Zero divided by a number... >> If x = 0, then x/0 is Indeterminate, rather than ComplexInfinity. You got me on that one, but it's a non-difference unless you can show me > a use for ComplexInfinity that doesn't apply just as well to > Indeterminate. A simple example: 1/Indeterminate is again Indeterminate, while 1/ComplexInfinity yields 0. This is as it should be: Reciprocation is an involution on C* (the one-point extension of C), that is, we have 1/(1/z) = z for _all_ z in C*. In case the usefulness of that isn't immediately obvious, and since you mentioned the Gamma function later, let me mention two related applications. Using C* as the codomain of Gamma, so that Gamma[z] is ComplexInfinity whenever z is a nonpositive integer, the important identities Gamma[z] = Gamma[z + 1]/z and Gamma[z] Gamma[1 - z] = Pi/Sin[Pi z] now hold _throughout_ the complex plane. (Of course, that would not be the case if just C were used for the codomain of Gamma.) > Besides, if x/0 is Indeterminate It's Indeterminate if x=0; it isn't Indeterminate in general. > but 1/0 is ComplexInfinity, what if x = > 1? That doesn't seem very consistent, I don't see any inconsistency. > and in fact it leads to problems > like a recent poster's issue with a Sum of Binomials. There were bugs revealed in that thread, yes. But it is not clear that they had anything to do with how ComplexInfinity is treated in Mathematica. > But Mathematica's result of ComplexInfinity _is_ correct mathematically > (in the extended complex number system, of course). Not of course. Of course of course! I was just being explicit about the context. But the parenthetical comment should not have been needed. After all, do you know any _other_ number system having ComplexInfinity as an element? > ComplexInfinity isn't a number if you can't do > arithmetic with it, But you can do arithmetic with it. > and the documentation doesn't explain what we should > expect from the concept. You can't expect Mathematica's documentation to teach such things. We're not actually talking about something peculiar to Mathematica; we're talking about something which should have been covered in a beginning course in complex analysis. > Not a good argument. By precisely that same reasoning, 0 shouldn't be > a full-fledged member of the algebraic system either 0 is the only thing in a Field that has no multiplicative inverse (it's > part of the DEFINITION of a field -- not an exception to the rules). Right, it's not an exception to the rules. But that's merely because the exception for zero is written _into_ the rules. > If ComplexInfinity also has no inverse, your extended complex number > system isn't a field, Nobody ever said it's a field. > Defining Gamma so that 1/Gamma[z] is entire would be useful, but > Mathematica doesn't accomplish that. Why not? > I'm not sure why Plot doesn't hiccup > on this, for instance: Plot[Evaluate@D[1/Gamma[x], x], {x, -3, -1}] since evaluating the first argument at either endpoint gets us an error > message. I wouldn't have expected Plot to hiccup, and I'm quite glad it doesn't. Similarly Plot[Sin[x]/x, {x, 0, 5}] causes no hiccup, despite the fact that Sin[x]/x is Indeterminate at x=0. > D[1/Gamma[x],x] /. x -> -3. (error message) > Indeterminate Unfortunately, that derivative is not expressible in a nice way in Mathematica. For an analogous case, consider the derivative of SinIntegral[x]. That derivative is just the sine cardinal function sinc(x) = 1 if x = 0, sin(x)/x otherwise. But Mathematica doesn't implement sinc(x) at present, and so it says In[3]:= D[SinIntegral[x], x] Out[3]= Sin[x]/x Taken literally (as computers are wont to do), that's not right at x=0. The derivative should have the value 1 there, rather than being Indeterminate. (Of course, Mathematica _could_ have given a correct answer for the derivative if sinc(x) had been implementing or, in lieu of that, by expressing the answer piecewise. But the latter is perhaps considered to be too messy for practicality.) For the derivative of 1/Gamma[x], things are messier in that there is no standard function -- at least, none known to me -- like sinc, which could be implemented so as to make the derivative expressible neatly. Experienced users should be aware that, in such situations, we need to look at the limit: In[4]:= Limit[D[SinIntegral[x], x], x -> 0] Out[4]= 1 In[5]:= Limit[D[1/Gamma[x], x] , x -> -3] Out[5]= -6 Of course, I agree that it's unfortunate that we need to look at the limit, rather than just at the value at the point. But there may not be any alternative which meets the demand of practicality for a CAS. > That happens because Gamma is ComplexInfinity at the -3 and > 0*ComplexInfinity == Indeterminate (use Trace). So again, using Gamma[-3] > = ComplexInfinity doesn't help us Right. Here, it doesn't help us. But it's not the source of the trouble either. >> In fact, defining Gamma[-5] in that way _does_ remove the >> discontinuity. [As z -> -5, regardless of the path in the complex >> plane, |Gamma[z]| increases without bound.] True enough, if increases without bound is all it takes, That's all it takes. > and the > definition makes Gamma act like a continuous function in some useful > sense. But it doesn't. IMO, it does. (What's useful is a matter of opinion.) > 1/Gamma[z] should be entire in the extended plane, > but in Mathematica, it isn't. Again, why not? > The only usage I've found that works the way we might expect seems to be > x / ComplexInfinity (with undefined x), which evaluates to 0 -- but > that's not actually right, Just as you say, that's not actually right. > since: ComplexInfinity/ComplexInfinity (error message) > Indeterminate Hence x / ComplexInfinity (with undefined x) should be left unevaluated > or replaced with Indeterminate. compactification of C), it would be better to have x/ComplexInfinity simplify to If[x==ComplexInfinity, Indeterminate, 0]. But whether Mathematica or any CAS _should_ do something like that is questionable due to matters of practicality. As a similar example, you might consider simplifying x/x. Mathematica just gives 1, without any caveats. But in C*, it would be better to have x/x simplify to If[x==0 || x==ComplexInfinity, Indeterminate, 1]. But again, whether Mathematica or any CAS _should_ do something like that is questionable due to matters of practicality. > So... ComplexInfinity may be a member of the extended complex plane, > but it dosn't walk or quack like a NUMBER. Well, I suppose I could just toss off that comment by saying that I've never seen or heard any number walk or quack, but that would clearly be ducking the issue. Seriously, both 0 and ComplexInfinity are quite peculiar, no doubt. And if you don't want to call ComplexInfinity a number, that's just fine. But it's essentially irrelevant whether we call it a number or not. It's an element of C*, and what's important is knowing what you can (and can't) do with it. BTW, concerning whether an improper element of an extended number system should be called a number or not, it might be noted that: Floating-point arithmetic is surely the most widely used number system in the world, in terms of the number of computations performed per day. There is an internationally accepted standard for that arithmetic. The standard clearly distinguishes between those floating-point objects which are numbers and those which aren't (the NaNs). According to the standard, -Infinity and +Infinity are numbers (while things such as 0*Infinity yield NaN). > Whenever I see ComplexInfinity, I'll read it as Indeterminate and lose > absolutely nothing. But it's still there in the background, mucking > things up. I disagree. The designers of floating-point arithmetic (W. Kahan, in particular, comes to mind) didn't implement arithmetic with infinities for absolutely nothing. The same can be said for symbolic implementations of infinity arithmetic in CAS. W. Cantrell ==== Subject: Re: Re: Adding Vectors -- Newbie help please Define a function to add polar forms rect[{r_, theta_}] := Module[{t=theta Degree},r{Cos[t],Sin[t]}]; polar[{x_,y_}] := {Sqrt[x^2+y^2],ArcTan[x,y]/Degree} addPolar[p__] := polar[Plus@@(rect/@{p})]; v1:={220,225}; v2:={100,16}; addPolar[v1,v2]//N {141.127,-114.908} v3={60,30}; addPolar[v1,v2,v3]//N {98.2845,-94.3623} > ==== > Subject: Re: Adding Vectors -- Newbie help please Ok; but I was hoping that there is a simpler way than the > following method to add two ac voltage vectors (for example): (220V, 225 degrees) > (100V, 16 degrees) Clear[r, x, y, Theta, rect, polar] rect[r_,Theta_] := { r Cos[Theta Pi/180] , r Sin[Theta Pi/180]} > polar[x_, y_] := {Sqrt[x^2 + y^2], ArcTan[x, y]180/Pi} (* Input vectors here *) > v1 := {220, 225}; > v2 := {100, 16}; r1:= rect[v1[[1]], v1[[2]] ] // N; > r2:= rect[v2[[1]], v2[[2]] ] // N; > rt := p1 + p2 polar[rt[[1]], rt[[2]]] // N This just seems so cumbersome, especially when compared to a > scientific calculator. >> Mathematica v5: How can I input vectors in polar form and >> rectangular form? > Example: > a:= (r1, theta1) + (r2, theta2) Polar form. > b:= (re1 , j* im1) + (re2, j*im2) Rectangular form > I know this should be pretty basic, but I haven't found examples >> of this kind of input. > I would guess it would be something like: > Polar[magnitude, phase] >> Rectangular[Real, Imaginary] > but, apparently not. (This is for electronics engineering.) >You can easily write a function to convert from polar to coordinate form: > >Note that this assumes your angles are measured in radians. Once all >your vectors are in coordinate form you can add/subtract then directly: > >{1,2}+(3,4} > >produces > >{4,6} > > Bailey ==== Subject: Re: Re: Adding Vectors -- Newbie help please Mathematica is not so much a toolbox for doing mathematica but a metatoolbox for making the tools to do the mathematics that applies to your specific application. This means that one will almost always have to write definitions and routines to make Mathematica work efficiently for oneself. This is a beautiful example. One might think that Mathematica would have a routine to do this. But there are millions of similar routines that might apply to this and other applications. You want to input in degrees, someone else in radians. Then aren't there other units of angular measure, like multiples of 90 degrees, or Arc Minutes and Arc Seconds? Maybe someone wants {voltage, degrees, minutes, seconds}. Or maybe they want voltage last on the list. So just build up the routines that you need. Here are some possible routines for your application. Put them in a Routines Section in your notebook. Maybe later you might even make a package. RectangularToPolar[{x_, y_}] /; x == 0 [And] y == 0 := {0, 0} RectangularToPolar[{x_, y_}] := {Sqrt[x^2 + y^2], ArcTan[x, y]180/Pi} PolarToRectangular[{r_, theta_}] := {r Cos[theta Pi/180], r Sin[theta Pi/180]}; PolarAdd[voltages : {_, _} ...] := Fold[RectangularToPolar[ PolarToRectangular[#1] + PolarToRectangular[#2]] &, {0, 0}, {voltages}] Now, having defined the routines they are easy to use. v1 := {220.0, 225}; v2 := {100.0, 16}; PolarAdd[v1, v2] {141.127, -114.908} PolarAdd[{220., 0}, {220., 30}, {220., 60}] {601.051, 30.} Park djmp@earthlink.net http://home.earthlink.net/~djmp/ Ok; but I was hoping that there is a simpler way than the following method to add two ac voltage vectors (for example): (220V, 225 degrees) (100V, 16 degrees) Clear[r, x, y, Theta, rect, polar] rect[r_,Theta_] := { r Cos[Theta Pi/180] , r Sin[Theta Pi/180]} polar[x_, y_] := {Sqrt[x^2 + y^2], ArcTan[x, y]180/Pi} (* Input vectors here *) v1 := {220, 225}; v2 := {100, 16}; r1:= rect[v1[[1]], v1[[2]] ] // N; r2:= rect[v2[[1]], v2[[2]] ] // N; rt := p1 + p2 polar[rt[[1]], rt[[2]]] // N This just seems so cumbersome, especially when compared to a scientific calculator. >> Mathematica v5: How can I input vectors in polar form and >> rectangular form? >> Example: >> a:= (r1, theta1) + (r2, theta2) Polar form. >> b:= (re1 , j* im1) + (re2, j*im2) Rectangular form >> I know this should be pretty basic, but I haven't found examples >> of this kind of input. >> I would guess it would be something like: >> Polar[magnitude, phase] >> Rectangular[Real, Imaginary] >> but, apparently not. (This is for electronics engineering.) >You can easily write a function to convert from polar to coordinate form: >Note that this assumes your angles are measured in radians. Once all >your vectors are in coordinate form you can add/subtract then directly: {1,2}+(3,4} produces {4,6} > Bailey ==== Subject: finding explicit rule for series i have a series of numbers and would like to use Mathematica to find the explicit algorithm in that way: n(i)=5342543+n(i-1).... I already spent some time with the manual, but didn't find anything. Uwe -- mail to newsgroup@ziegenhagen.info is read only from time to time. If ==== Subject: Re: Redefining the minus operator > Is there a way in Mathematica to redefine the minus sign to stand for a > function of your choosing? For example, I'd like to be able to do something like this: In[1]:= Subtract[a_, b_] := MINUS[a, b] In[2]:= FullForm[x - y] > Out[2]:= MINUS[x, y] In[3]:= 1 - 0 > Out[3]:= MINUS[1, 0] > What actually happens is: In[2]:= FullForm[x - y] > Out[2]:= PLUS[x, Times[-1, y]] In[3]:= 1 - 0 > Out[3]:= 1 > Naturally, I'd also like to redefine the plus sign, too. When Plus[a_, > b_] is redefined as PLUS[a,b], then x + y indeed evaluates as PLUS[x, > y]. But Mathematica still simplifies if there are numbers in the > expression: FullForm[1 + 0] comes out as 1. > Ben Kovitz > Humboldt State University > This is definitely an unwise thing to do unless it is just for interest or you have a very specialised application in mind. However, the first thing to realise is that you don't want to redefine Plus - that is too late in the translation process and also extremely disruptive to the rest of Mathematica. What you need to do is add extra definitions to MakeExpression to change the translation from BoxForm. The following code is designed to work in StandardForm: restructure[{a_}] := a; restructure[{a_, +, b_, c___}] := restructure[{RowBox[{PLUS, [, a, ,, b, ]}], c}]; restructure[{a_, -, b_, c___}] := restructure[{RowBox[{MINUS, [, a, ,, b, ]}], c}]; restructure[{+, b_, c___}] := restructure[{RowBox[{PLUS, [, b, ]}], c}]; restructure[{ -, b_, c___}] := restructure[{RowBox[{MINUS, [, b, ]}], c}]; MakeExpression[RowBox[s : {___, + | -, ___}], StandardForm] := MakeExpression[restructure[s], StandardForm] Notice that this code will also translate +a into PLUS[a] and -a into MINUS[a]. Also 1+2 is translated into PLUS[1,2] I would be interested to know what you want to do with this code - as there may be better ways to solve your problem. Please note that this is a rather unusual piece of code, so TEST IT WELL before you rely on it. Bailey ==== Subject: Variance Can anybody help me out with this? I'm trying to make mathematica calculate the variance of an expression, however I don't get the result I expected, a numerical value. In[144]:= <This result is an experimental random number generator. It uses the >PSLQ Bailey Pi digits rational polynomial to generate digits in the 0 >to 9 range using a process that loses information , but generally >behaves like the Pi digits. It is not Markov, in that there is no >previous behavior involved in calculating the next random number. >(* Bailey formula with digit drop base 80*) >(* base 10 random number generator that isn't Markov *) >(* use integer seed as the number of digits in to start calculation*) >(* other PSLQ functions of transcendental numbers could be used to do >this same kind of random number*) >f[n_]=Floor[Mod[80^n*(4/(8*n+1)-2/(8*n+4)-1/(8*n+5)-1/(8*n+6))/16^n,10]] >Digits=4000;rdpi=Table[f[n],{n,0,Digits}]; >c1=Drop[FoldList[Plus,0,Sign[Drop[rdpi,1]-Drop[rdpi,-1]]],1]; >ListPlot[c1,PlotJoined->True]; >(* Rowe Count*) >d1=Flatten@{0,Length/@Split[Sort@c1], 0} >Dimensions[d1][[1]] >ListPlot[d1,PlotJoined->True]; I gather from your various posts you are trying to use the plot of c1 as a visual indicator of randomness. If that is your goal, then there are far simpler plots that are more meaningful. One of the simplest and easiest to interpret would be a plot of the cumulative distribution function for the data set. For example: dataSize = 10000; data = Table[Random[Integer,{0,9}],{dataSize}]; ListPlot[ Rest@FoldList[Plus,0,Length/@Split[Sort@data]]/dataSize, PlotJoined->True]; For a uniform distribution, the cumulative distribution function is x/(b-a) where a, b are the end points. That is, the cumulative distribution function for a uniform distribution should plot as a straight line from 0 to 1 over the interval (a,b). Contrast this with <True]; The plot is clearly not a straight line indicating the data is not from a uniform distribution. But to really demonstrate a pseudo random number generator adequately generates uniform deviates you will need more than such a simple plot. -- To reply via email subtract one hundred and four ==== Subject: Re: need help with integration > Below I define two functions x[t] and h[t], then in eq1 I integrate > the integrand ( x[tau] h[t-tau] ) from -inf to +inf and get one set of > results and plots, then I integrate the same integrand as before but > this time in two steps, once from -inf to 0 and once from 0 to +inf, > but the results and plots from the integration performed in two steps > are NOT the same as the results and plots from integration in one step. > Is this a bug and if so what's the work around? This looks essentially like what you asked here about two weeks ago That comment of mine was made too hastily, and I apologize. Although your question does resemble what you'd asked about earlier, I see now that it is not the same question at all. In fact, I think that there is a bug of some sort in giving the result for the integral from -Infinity to +Infinity. One work-around seems to be just to add the integrals from -Infinity to 0 and from 0 to +Infinity. > Try this in the input cell > > In[19]:= > x[t_] = (3Exp[-.5t]UnitStep[t]) + DiracDelta[t + 3] > h[t_] = UnitStep[t] - UnitStep[t - 2] > eq1 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], > [Infinity]}] Plot[eq1, {t, -10, 10}, PlotRange -> All] > eq2 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], 0, [Infinity]}] > Plot[eq2, {t, -10, 10}, PlotRange -> All] > eq3 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], 0}] > Plot[eq3, {t, -10, 0}, PlotRange -> All] > > You will get the following output expressions (I couldn't paste the > plots here, but if you run the above input cells you should get the > plots too, then it will be more obvious what the problem is) > > Out[21]= > !(1/2 ((1 + (6.` @(((-2) + t))^2)/(((2.`)( > [InvisibleSpace])) - 1.` t) + (6.` @t^2)/t + @((3 + > t))^2/(3 > + t) - (1 + t + @((1 + t))^2)/(1 + t)))) > > Out[23]= > !((((-6.`) + > 16.30969097075427` [ExponentialE]^((-0.5`) t))) UnitStep[ > (-2) + t] + ((((6.`)([InvisibleSpace])) - > 6.` [ExponentialE]^((-0.5`) t))) UnitStep[t]) > > Out[25]= > !(1/2 (((-((1 + > t)/@((1 + t))^2)) + (3 + t)/@((3 + t))^2))) ==== Subject: Re: need help with integration Also, please note, that FullSimplify with assumptions also does not work, see below: !(x[t_] = 3*(E^(-(t/2))) UnitStep[t] + DiracDelta[t + 3][IndentingNewLine] h[t_] = UnitStep[t] - UnitStep[t - 2][IndentingNewLine] Integrate[ x[[Tau]] h[t - [Tau]], {[Tau], (-[Infinity]), [Infinity]}] [IndentingNewLine] eq1 = FullSimplify[%, t [Element] Reals && [Tau] [Element] Reals][IndentingNewLine] Plot[eq1, {t, (-10), 10}, PlotRange -> All][IndentingNewLine] Integrate[ x[[Tau]] h[t - [Tau]], {[Tau], 0, [Infinity]}][IndentingNewLine] eq2 = FullSimplify[%, t [Element] Reals && [Tau] [Element] Reals][IndentingNewLine] Plot[eq2, {t, (-10), 10}, PlotRange -> All][IndentingNewLine] Integrate[ x[[Tau]] h[t - [Tau]], {[Tau], (-[Infinity]), 0}][IndentingNewLine] eq3 = FullSimplify[%, t [Element] Reals && [Tau] [Element] Reals][IndentingNewLine] Plot[eq3, {t, (-10), 0}, PlotRange -> All]) >> Below I define two functions x[t] and h[t], then in eq1 I integrate >> the integrand ( x[tau] h[t-tau] ) from -inf to +inf and get one set of >> results and plots, then I integrate the same integrand as before but this >> time in two steps, once from -inf to 0 and once from 0 to +inf, but the >> results and plots from the integration performed in two steps are NOT the >> same as the results and plots from integration in one step. Is this a >> bug and if so what's the work around? This looks essentially like what you asked here about two weeks ago in > Integration of UnitStep has bugs!? help! > I would have answered your question in the previous thread had you not > already gotten two good answers. Look at them carefully. I suspect that > the > trouble you're having now is the same as you were having previously; if > so, > then your question has already been answered, twice. > Try this in the input cell >> In[19]:= >> x[t_] = (3Exp[-.5t]UnitStep[t]) + DiracDelta[t + 3] >> h[t_] = UnitStep[t] - UnitStep[t - 2] >> eq1 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], >> [Infinity]}] Plot[eq1, {t, -10, 10}, PlotRange -> All] >> eq2 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], 0, [Infinity]}] >> Plot[eq2, {t, -10, 10}, PlotRange -> All] >> eq3 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], 0}] >> Plot[eq3, {t, -10, 0}, PlotRange -> All] >> You will get the following output expressions (I couldn't paste the plots >> here, but if you run the above input cells you should get the plots too, >> then it will be more obvious what the problem is) >> Out[21]= >> !(1/2 ((1 + (6.` @(((-2) + t))^2)/(((2.`)( >> [InvisibleSpace])) - 1.` t) + (6.` @t^2)/t + @((3 + >> t))^2/(3 >> + t) - (1 + t + @((1 + t))^2)/(1 + t)))) >> Out[23]= >> !((((-6.`) + >> 16.30969097075427` [ExponentialE]^((-0.5`) t))) UnitStep[ >> (-2) + t] + ((((6.`)([InvisibleSpace])) - >> 6.` [ExponentialE]^((-0.5`) t))) UnitStep[t]) >> Out[25]= >> !(1/2 (((-((1 + >> t)/@((1 + t))^2)) + (3 + t)/@((3 + t))^2))) > ==== Subject: Re: need help with integration actually this is different, i used both assumptions and simplify but won't work. Please try running the code, you'll see for yourself when you look at the plots, they are different even if you use assumptions. >> Below I define two functions x[t] and h[t], then in eq1 I integrate >> the integrand ( x[tau] h[t-tau] ) from -inf to +inf and get one set of >> results and plots, then I integrate the same integrand as before but this >> time in two steps, once from -inf to 0 and once from 0 to +inf, but the >> results and plots from the integration performed in two steps are NOT the >> same as the results and plots from integration in one step. Is this a >> bug and if so what's the work around? This looks essentially like what you asked here about two weeks ago in > Integration of UnitStep has bugs!? help! > I would have answered your question in the previous thread had you not > already gotten two good answers. Look at them carefully. I suspect that > the > trouble you're having now is the same as you were having previously; if > so, > then your question has already been answered, twice. > Try this in the input cell >> In[19]:= >> x[t_] = (3Exp[-.5t]UnitStep[t]) + DiracDelta[t + 3] >> h[t_] = UnitStep[t] - UnitStep[t - 2] >> eq1 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], >> [Infinity]}] Plot[eq1, {t, -10, 10}, PlotRange -> All] >> eq2 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], 0, [Infinity]}] >> Plot[eq2, {t, -10, 10}, PlotRange -> All] >> eq3 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], 0}] >> Plot[eq3, {t, -10, 0}, PlotRange -> All] >> You will get the following output expressions (I couldn't paste the plots >> here, but if you run the above input cells you should get the plots too, >> then it will be more obvious what the problem is) >> Out[21]= >> !(1/2 ((1 + (6.` @(((-2) + t))^2)/(((2.`)( >> [InvisibleSpace])) - 1.` t) + (6.` @t^2)/t + @((3 + >> t))^2/(3 >> + t) - (1 + t + @((1 + t))^2)/(1 + t)))) >> Out[23]= >> !((((-6.`) + >> 16.30969097075427` [ExponentialE]^((-0.5`) t))) UnitStep[ >> (-2) + t] + ((((6.`)([InvisibleSpace])) - >> 6.` [ExponentialE]^((-0.5`) t))) UnitStep[t]) >> Out[25]= >> !(1/2 (((-((1 + >> t)/@((1 + t))^2)) + (3 + t)/@((3 + t))^2))) > ==== Subject: Re: need help with integration I assume you mean eq2 + eq3 - eq1 // FullSimplify (3*(-2 + t))/Sqrt[(-2 + t)^2] - (3*t)/Sqrt[t^2] - 6*UnitStep[-2 + t] + (6*(E*UnitStep[-2 + t] - UnitStep[t]))/E^(t/2) + 6*UnitStep[t] should be zero for all t? If we reduce x[t] to just x[t_]=3Exp[-.5t]UnitStep[t] or x[t_]=DiracDelta[t + 3], it works properly, so I think it should work for your x function as well. But it doesn't. Perhaps, when we add the terms together, there's some ambiguity about the value at -3, and that leads to the problem? Hopefully the experts can tell you more. > Below I define two functions x[t] and h[t], then in eq1 I integrate > the integrand ( x[tau] h[t-tau] ) from -inf to +inf and get one set of > results and plots, then I integrate the same integrand as before but this > time in two steps, once from -inf to 0 and once from 0 to +inf, but the > results and plots from the integration performed in two steps are NOT the > same as the results and plots from integration in one step. Is this a bug > and if so what's the work around? Try this in the input cell In[19]:= > x[t_] = (3Exp[-.5t]UnitStep[t]) + DiracDelta[t + 3] > h[t_] = UnitStep[t] - UnitStep[t - 2] > eq1 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], [Infinity]}] > Plot[eq1, {t, -10, 10}, PlotRange -> All] > eq2 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], 0, [Infinity]}] > Plot[eq2, {t, -10, 10}, PlotRange -> All] > eq3 = Integrate[x[[Tau]]h[t - [Tau]], {[Tau], -[Infinity], 0}] > Plot[eq3, {t, -10, 0}, PlotRange -> All] You will get the following output expressions (I couldn't paste the plots > here, but if you run the above input cells you should get the plots too, > then it will be more obvious what the problem is) Out[21]= > !(1/2 ((1 + (6.` @(((-2) + t))^2)/(((2.`)( > [InvisibleSpace])) - 1.` t) + (6.` @t^2)/t + @((3 + > t))^2/(3 > + t) - (1 + t + @((1 + t))^2)/(1 + t)))) Out[23]= > !((((-6.`) + > 16.30969097075427` [ExponentialE]^((-0.5`) t))) UnitStep[ > (-2) + t] + ((((6.`)([InvisibleSpace])) - > 6.` [ExponentialE]^((-0.5`) t))) UnitStep[t]) Out[25]= > !(1/2 (((-((1 + > t)/@((1 + t))^2)) + (3 + t)/@((3 + t))^2))) -- ==== Subject: Re: Re: MathGroup /: Descriptive headings I warmly second this suggestion! Tomas Garza Mexico City Original Message: ----------------- ==== Subject: Re: MathGroup /: Descriptive headings , I read the list every day and have for a few years. I post occasionly but find the list very useful and this group one of my most valuable resources in my business. I think you do a great job. The only suggestion that I have is, 'Is there some way to make your life easier'? Otherwise don't fix what isn't Cliff Martin --- n M. Christensen <@smc.vnet.net> See my comments within the message below. Christensen > n M. Christensen <@smc.vnet.net > I want to take the opportunity to reply to > Paul's suggestion in > as much detail as possible. > I am sorry I was not at the event at the Wolfram > Technology > Conference when this was discussed. > First, here are the steps I take each day to > moderate this group. > Figuring out where in these steps to put in > categorization would need > to fit into this. > 1. I get perhaps 2500-3000 emails a day, every > day. Of these, perhaps > 500 are not spam. Because the Mathgroup > addresses are easily found > by spammers, there is no way around getting > a lot of spam. > Do you mean that the spammers are forging email > addresses of MathGroup > participants and using these to post messages to > MathGroup > (mathgroup@wolfram.com)? I can see how that would > make things more difficult > to filter. > Yes, this happens all the time. Spam comes to > mathgroup via mailing > list messages, newsgroup posts, spammers who have > just found addresses > in the newsgroups and archives. > If I understand you correctly, requiring > individuals to register with > you, possibly listing multiple email addresses, > and bouncing email that > is not from registered participants, with a > message telling them how to > register, would not work. > No this would not work. I even get spam from > wolfram.com addresses > even though I know it did not come from there. I > sometimes get > spam from myself! > Because I usually post from a news reader, my > messages have the > following field: > Could this be used as a filter (or do spammers > forge this as well)? > Spammers forge every element of posts. > found. To me, it should > cost money, only of the order of a couple of > cents, to send any email > message. You would need to purchase a valid > one-off e-stamp, using > some form of encryption technology, from some site > (I'm suprised that > the automatic billing sites have not already done > this). Then only valid > e-stamps would be routed though the network. There > are, of course, many > issues with this proposal ...] > Further, because MathGroup users often, > unfortunately, > send html email or other attachments, maybe > 10-20 of their mails get > filtered by my, fairly sophisticated but not > perfect, spam filters into > my spam folder. > To me, one of the major limitations of MathGroup > is that we cannot > attach Notebooks (without including them in the > body of the message). Attaching notebooks causes numerous problems. 1. Notebooks as attachments are very often rejected > by spam filters > either at ISP's, moderation level, or end users. 2. Can a windows user really trust that a notebook > attachment is not > a virus or worm? If I were using a Windows > machine and saw an > attachment, I would not open it. 3. Many notebooks are very long and some mail > systems will not be able > to handle them. Rules about attached notebooks > would have > to be devised. Not a simple matter given that I > get so many > posts that can't follow even simpler rules. It is far simpler to have someone put their notebook > on a server somewhere > where it can be downloaded and then include a link > within the post. > > 2. Of the 500 good emails that get past my spam > filters, I then have to > filter out those mails that are for > Mathgroup. Then, I have to > go through the spam folder to find any > MathGroup posts that might be > there. So,there are usually about 70 emails > relevant to MathGroup. > Some, maybe 10 do not follow the rules - > flames, licensing questions, > discussions of other systems, really trivial > items, totally > non-Mathematica > related. In the end, there are 30-60 emails > to read in more detail. > Actually, if the Subject line included question > categories as is being > proposed, couldn't you use this as the primary > filter (or again, do > spammers forge this as well)? > Again, spammers will grab email addresses, Subject > lines, even > content sometimes. Most of that comes to me where I > filter it. > But I have had some reports that people get email > from mathgroup > and I did not send. > > 3. Once I decide that the posts are OK, I run > them through a number of > UNIX scripts and do some more editing to > take out unneeded mail headers > etc. > 4. Then the mails are run through scripts that > send them to the > newsgroup and the mailing list. One of the > scripts adds the > numbers to the Subject line of the mail > that goes to > the mailing list. Note that the [ ] are > really needed. > As I read MathGroup in a newsreader or sometimes > via Google at > > I do not see the numbers or the []. Google seems > to handle threading > better than my newsreader. > > The numbers only go out to the mailing > list to help with > filtering. They will not be seen in the newsgroup > -------------------------------------------------------------------- mail2web - Check your email from the web at http://mail2web.com/ .