mm-110 . Please help to solve these two problems. One member have posted this problem to a math group on msn. I have no idea to solve thisProblems are going like this:1. DigitsShow that for any natural n, at least one of two numbers, n or n+1,can berepresented in the following form: k + S(k) for a certain k, whereS(k) isthe sum of all digits in k. For instance, 21 = 15 + (5+1)2. Party!There is a group of people at a party. Show that you can introduce some of them to each other so that after the introduction, no more than two people in the group would have the same number of friends (initial conguration doesnt work because they all initially have 0 friends).Ajhar =I am posting a code which is written in c++ which canfind the bonacci seriesup to any n number .The code is like this://starting of the program#incluevoid main(){int number,f1=0,f2=1,temp=0;cout<>number;//the main logic is going like thiscout< equations. Unfortunately, I hardly know anything about numerical> analysis. So if you hava a program or idea how to solve it please> share with me.> The problem is the following:> C(1)=sum(j=1 to n){alpha(j,1)beta(j)prod(i=1 to k)[c(i)^alpha(j,i)]}> ...> C(k)=sum(j=1 to n){alpha(j,k)beta(j)prod(i=1 to k)[c(i)^alpha(j,i)])> where > prod(i= 1 to k)c(i)^alpha(j,i)=c(1)^alpha(j,1)*c(2)^alpha(j,2)...> I need to solve these equations for c(i). The alpha matrix is such> that the rst kxk part is a unity matrix.> Anybody, any suggestions?> greetings:> ZsoltI can do programming but i doest quit understand your problem will you explain your problem?Ajhar Im somewhat versed in math but no expert by far. Ive been browsing the> internet, news-groups and all, but still I have not found a good answer to> my question.> Im looking for a Java (J2ME) implementation (or something from which i can> create this implementation) for the approximations (only using additions,> subtractions, multiplications, divisions and mayb a square-root function and> logarithm) for one or both of these two functions:> exp(x) e^x (or pow(2,y), ... raising the power of 2 on> computers can be faster)> and/or> pow(x,y) x^y> where both x and(!) y can be real numbers (not necessarily integers).> The approximations need to be relatively fast (J2ME, MIDP1.0... limited> device capabilities, no oating-point support) but quite accurate.> Ive already have good implementations for the log(x) (using the Maclaurin> series for 1/(ln[x+1])) and squareroot(x) (using Newtons Iteration).> I need the approximations where y is between 0 and 1 and where y is a large> number:> (e^x = e^(largenum+fraction) = e^largenum * e^fraction)> PS: The x and y are real numbers represented in J2ME by a class representing> some form of xed-point values. approximate exp(x) =In the following Q=ln(2)= .69314718055994530942... and symbol [.] is devoted for integral part. Also x=[x]+{x}where {x} is fractionary part of x. First observe that 2^{a+N}e^{Z(a)}where N=integer:=[x/Q] , F:={x/Q} , Z(a)=(F-a)*Q ,a being an arbitrary real number. =Please verify (1): take logarithm in both sides.Suppose x >0 , let q be a positive integer and put k=[q*F] . Ifk/q =< F={x/Q} < (k+1)/q , select parameter a to be (2k+1)/(2q) . Then |Z(a)| =< Q/8 < 1/10 . Therefore using (1)(2) e^x=approx.=C(k)*2^N*G(Z(A))where G(z) will be a ,,good approximation of e^z for z small, e.g. for |z|<1/10 .==In the following I give such approximation G(z). Dene(*) A(z)=z^6 + 840*z^4 + 75600*z^2 +665280 B(z)= 42*z^4 + 10080*z^2 + 332640 H(z):= A(z)+ z*B(z). Then put = (3) G(z) = H(z)/H(-z) . = It may be shown that |(e^z - G(z))/e^z| =< 10^{-26} for |z|< Q/8 .In conclusion , tofind an approximation DEX(X) of e^X=exp(X) you can proceed as follows ( q=4 ) : STEP 1: Test the variable X , and determine T=|X| . Suppose that you work with real numbers in intervals (16^{-64},16^{63}). This means that you can approximate e^X only for X in [-175,175] .Dene (for instance) DEX(T)= .0996...E-76 if T =< -175 , DEX(T)=1 when T=0 and DEX(T)= .10035...E+77 when T>= 175 .STEP 2: Find N=[T/Q] , F={T/Q} .STEP 3: Find P=2^N , K=[4F] , A=(2K+1)/8 , Z=(F-A)Q .STEP 4: Select constant C , C:= 2^A , as a function of possible values of K ,K in{0,1,2,3} .STEP 5: Taking into account (3), consider approximation e^Z=approx = H(Z)/H(-Z) .STEP 6: Finding nal approximation, namely e^T=approx=C*P*G(Z)and DEX(X)= 1/(C*P*G(Z)) if Z is in (-175,0) , or DEX(X) = C*P*G(z) when X belongs to interval (0,175) . Note: Its possible to prove that the roots z_k of H(z) satisfy 2 =< |z_k| =< 42 ,therefore H(-z) =/=0 for |z| small ,e.g |z|< 2 . Other better functions that (*) are available.If you want tofind betterapproximations for e^z , please inform me. I appreciate that (1) was important. =Those who cant design, teach.Those who cant teach, design.And the rest are just clueless.Dan :-) And I keep stressing that I am talking about the U.S., of which youve> admitted some lack of knowledge.I said that I am not too familiar with US based research grants. Ialso said that I have no idea what the Fox news fan club is supposedto be. That is is where I admitted some lack of knowledge about theUSA, as you say.However I also said that: I know very well what publish or perish is(unjustied patronizing tone again, I note), William. I have somescientic publications, William, and we have pretty much the sameacademic system here in Israel, as in the USA (including gettingIn fact Ive spent some time in the USA academic system, in FortCollins C0. I am also quite familiar with the UK academic system, inaddition to the Israeli, of course. So, when I talk about the peoplefrom the academia, I know, it means quite a lot of people, from threedifferent countries, but having similar academic systems. That doesntmake my statements absolute, as you say. But, IMHO, they aresignicant enough in countering statements like:...but they often cant do any signicant research either. (Dependsreply to my: A Prof with a tenure that doesnt have much contractNote your rather strong words often and any. As to what looks likean insurance policy (or a sort of disclaimer) of Depends on...,well, it doesnt make much sense that the academic system and academicfreedom concepts should be signicantly different in, say chemistrydept from that of math, or biology. Even in the great USA. Well, ifsome mysterious reports they send back from the front lines... givea different picture, I guess, I am expected to accept them as factsabout the USA. Well, I might not do that, support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id hA6KGK001939; =Im desperately looking for an algorithm to put a reduciblenonnegative matrix in Frobenius canonical form by a symmetricpermutation of rows & columns. In graph-theoretic terms, this amountsto relabeling the graph nodes so that the absorbing nodes (or groups onodes) receive the highest labels. I will really appreciate it ifanyone out there can lend me a hand. Im desperately looking for an algorithm to put a reducible> nonnegative matrix in Frobenius canonical form by a symmetric> permutation of rows & columns. In graph-theoretic terms, this amounts> to relabeling the graph nodes so that the absorbing nodes (or groups o> nodes) receive the highest labels. I will really appreciate it if> anyone out there can lend me a hand.Look at Dulmage-Mendelsohn decomposition.For example in Matlab, help dmpermArnold Neumaier I am a student implementing a simple mode solver myself,> I need help.>> The one dimensional Helmholtz equation> d^2U(x)/dx^2+k^2(N(x)^2-n_eff^2)U(x)=0>> can be solved using Finite Difference method:czh, lets have an example of this BVP (boundary value problem).k^2 = 1.234^2N(x) = (x + 0.002345)n_eff^2 = 2.453x_0 = 0x_40 = 10n = 39y_0 = 0y_40 = -1.435h = 0.250Solution: y_1 to y_39Use plausible data or modify and solve these equations using anappropriate program.>> d^2U(x)/dx^2+k^2(N(x)^2-n_eff^2)U(x)=0((y_2-2*y_1+y_0)/h^2)+ 1.234^2*(((1*h)+0.002345)^2-2.453)*(y_1)=0((y_3-2*y_2+y_1)/h^ 2)+1.234^2*(((2*h)+0.002345)^2-2.453)*(y_2)=0((y_4-2*y_3+y_2) /h^2)+1.234^2*(((3*h)+0.002345)^2-2.453)*(y_3)=0((y_5-2*y_4+y _3)/h^2)+1.234^2*(((4*h)+0.002345)^2-2.453)*(y_4)=0((y_6-2*y_ 5+y_4)/h^2)+1.234^2*(((5*h)+0.002345)^2-2.453)*(y_5)=0((y_7-2 *y_6+y_5)/h^2)+1.234^2*(((6*h)+0.002345)^2-2.453)*(y_6)=0((y_ 8-2*y_7+y_6)/h^2)+1.234^2*(((7*h)+0.002345)^2-2.453)*(y_7)=0( (y_9-2*y_8+y_7)/h^2)+1.234^2*(((8*h)+0.002345)^2-2.453)*(y_8) =0((y_10-2*y_9+y_8)/h^2)+1.234^2*(((9*h)+0.002345)^2-2.453)*( y_9)=0((y_11-2*y_10+y_9)/h^2)+1.234^2*(((10*h)+0.002345)^2- 2.453)*(y_10)=0((y_12-2*y_11+y_10)/h^2)+1.234^2*(((11*h)+ 0.002345)^2-2.453)*(y_11)=0((y_13-2*y_12+y_11)/h^2)+1.234^2*( ((12*h)+0.002345)^2-2.453)*(y_12)=0((y_14-2*y_13+y_12)/h^2)+ 1.234^2*(((13*h)+0.002345)^2-2.453)*(y_13)=0((y_15-2*y_14+y_ 13)/h^2)+1.234^2*(((14*h)+0.002345)^2-2.453)*(y_14)=0((y_16-2 *y_15+y_14)/h^2)+1.234^2*(((15*h)+0.002345)^2-2.453)*(y_15)=0 ((y_17-2*y_16+y_15)/h^2)+1.234^2*(((16*h)+0.002345)^2-2.453)* (y_16)=0((y_18-2*y_17+y_16)/h^2)+1.234^2*(((17*h)+0.002345)^2 -2.453)*(y_17)=0((y_19-2*y_18+y_17)/h^2)+1.234^2*(((18*h)+ 0.002345)^2-2.453)*(y_18)=0((y_20-2*y_19+y_18)/h^2)+1.234^2*( ((19*h)+0.002345)^2-2.453)*(y_19)=0((y_21-2*y_20+y_19)/h^2)+ 1.234^2*(((20*h)+0.002345)^2-2.453)*(y_20)=0((y_22-2*y_21+y_ 20)/h^2)+1.234^2*(((21*h)+0.002345)^2-2.453)*(y_21)=0((y_23-2 *y_22+y_21)/h^2)+1.234^2*(((22*h)+0.002345)^2-2.453)*(y_22)=0 ((y_24-2*y_23+y_22)/h^2)+1.234^2*(((23*h)+0.002345)^2-2.453)* (y_23)=0((y_25-2*y_24+y_23)/h^2)+1.234^2*(((24*h)+0.002345)^2 -2.453)*(y_24)=0((y_26-2*y_25+y_24)/h^2)+1.234^2*(((25*h)+ 0.002345)^2-2.453)*(y_25)=0((y_27-2*y_26+y_25)/h^2)+1.234^2*( ((26*h)+0.002345)^2-2.453)*(y_26)=0((y_28-2*y_27+y_26)/h^2)+ 1.234^2*(((27*h)+0.002345)^2-2.453)*(y_27)=0((y_29-2*y_28+y_ 27)/h^2)+1.234^2*(((28*h)+0.002345)^2-2.453)*(y_28)=0((y_30-2 *y_29+y_28)/h^2)+1.234^2*(((29*h)+0.002345)^2-2.453)*(y_29)=0 ((y_31-2*y_30+y_29)/h^2)+1.234^2*(((30*h)+0.002345)^2-2.453)* (y_30)=0((y_32-2*y_31+y_30)/h^2)+1.234^2*(((31*h)+0.002345)^2 -2.453)*(y_31)=0((y_33-2*y_32+y_31)/h^2)+1.234^2*(((32*h)+ 0.002345)^2-2.453)*(y_32)=0((y_34-2*y_33+y_32)/h^2)+1.234^2*( ((33*h)+0.002345)^2-2.453)*(y_33)=0((y_35-2*y_34+y_33)/h^2)+ 1.234^2*(((34*h)+0.002345)^2-2.453)*(y_34)=0((y_36-2*y_35+y_ 34)/h^2)+1.234^2*(((35*h)+0.002345)^2-2.453)*(y_35)=0((y_37-2 *y_36+y_35)/h^2)+1.234^2*(((36*h)+0.002345)^2-2.453)*(y_36)=0 ((y_38-2*y_37+y_36)/h^2)+1.234^2*(((37*h)+0.002345)^2-2.453)* (y_37)=0((y_39-2*y_38+y_37)/h^2)+1.234^2*(((38*h)+0.002345)^2 -2.453)*(y_38)=0((y_40-2*y_39+y_38)/h^2)+1.234^2*(((39*h)+ 0.002345)^2-2.453)*(y_39)=0These equations are computer generated.--Website temporarily closed Can someone point me to information on the web about fast factorial>> calculation? This needs to be for exact value. I can handle the part>about>> it being too large to represent, but would like tofind a faster method>than>> just multiplying every number.>> Adam,>> Try this one http://www.luschny.de/math/index.htm.>> Could tell what kind of application are you working for?>>Its labview. NI is sporting a contest to code the fastest factorial>program. I have a few ideas on how to calculate numbers larger than>representable in normal computer formatting, but wanted to see what>algorithms might I use that would be quicker than 2x3x4... Just for funs>tho.>>An interesting property is that for n = 2m,n! = 2^m (m!)^2Another interesting point I developed some time ago, =fr&lr=&ie=UTF-8&selm=956tbb%24rg8%40deadzone.rsn.hp.com&rnum =3Michel > Can someone point me to information on the web about fast factorial>> calculation? This needs to be for exact value. I can handle thepart>about>> it being too large to represent, but would like tofind a fastermethod>than>> just multiplying every number.> Adam,>> Try this one http://www.luschny.de/math/index.htm.>> Could tell what kind of application are you working for?>>Its labview. NI is sporting a contest to code the fastest factorialprogram. I have a few ideas on how to calculate numbers larger than>representable in normal computer formatting, but wanted to see what>algorithms might I use that would be quicker than 2x3x4... Just for funs>tho.>> An interesting property is that for n = 2m,> n! = 2^m (m!)^2I used to think of myself as somewhat of a math wiz but Im not getting thisequation. Cant seem to make it balance for sample numbers. In fact lookingat {n,m}={4,2}, I dont see how it could work at all. 4! contains a factorof 3 which I dont see the right side coming up with no matter how I look atit. Can you clue me in as to what I am missing? =I suspect for this homework assignment that the original poster was supposed to stumble across the Gamma function and, more importantly for large numbers, the LogGamma function.$.02 -Ron Shepard I suspect for this homework assignment that the original poster was> supposed to stumble across the Gamma function and, more importantly> for large numbers, the LogGamma function.No, it really isnt a homework assignment. It is a labview programmingcontest (for fun). The point is to code it to do up to 10000 factorialquickly. Do you think that use of the loggamma function would be a moreefcient algorithm? Does it produce exact answers? =Adam Russell schrieb> The point is to code it to do up to 10000 factorial> quickly.If you want to compare your code with my Javaimplementation, go here:and then click on benchmark.Java Factorial Benchmark - Timings(in seconds)N! where N = 16000/32000/64000/128000/256000/512000/1024000PrimeSwing 0,2/ 0,8/ 3,8/ 17,6/ 97,3/ 524,9/ 2480,1So for 10000! you can expect 0.1 seconds with Java,computing on a PC, which is two years old. Fast enough?> Do you think that use of the loggamma function would be a more> efcient algorithm? Yes, but...> Does it produce exact answers?No. Only an approximation. =Michel OLAGNON schrieb> An interesting property is that for n = 2m,> n! = 2^m (m!)^2Sure? I tried Maple:OLAGNON := proc(m) n := 2*m; m!^2*2^m end;seq(OLAGNON(i),i=0..7);1, 2, 16, 288, 9216, 460800, 33177600, 3251404800seq(i!,i=0..7);1, 1, 2, 6, 24, 120, 720, 5040Ups. But I know what you mean. If you read carefullythe function given above, you willfind:46 Integer recFactorial(int n)47 {48 if (n < 2) return 1;49 return (recFactorial(n/2)^2) * swing(n);50 }This is a correct, more general and recursive formulationof the observation you obviously refer to.Gruss Peter >46 Integer recFactorial(int n)>47 {>48 if (n < 2) return 1;>49 return (recFactorial(n/2)^2) * swing(n);>50 }>>This is a correct, more general and recursive formulation>of the observation you obviously refer to.Very interesting for n=4. What does the swing do?-- Surendar Jeyadev jeyadev@wrc.xerox.bounceback.com n)>47 {>48 if (n < 2) return 1;>49 return (recFactorial(n/2)^2) * swing(n);>50 }> Very interesting for n=4.Not more and not less interesting then for anyother n. y := recFactorial(n/2)^2< y := recFactorial(n/2); y := y^2;> What does the swing do?How much of the thread do you read, before you write? Michel OLAGNON schrieb> An interesting property is that for n = 2m,>> n! = 2^m (m!)^2>>Sure? I tried Maple:>OLAGNON := proc(m) n := 2*m; m!^2*2^m end;>>seq(OLAGNON(i),i=0..7);>1, 2, 16, 288, 9216, 460800, 33177600, 3251404800>>seq(i!,i=0..7);>1, 1, 2, 6, 24, 120, 720, 5040>>Ups. But I know what you mean. If you read carefully>the function given above, you willfind:>>46 Integer recFactorial(int n)>47 {>48 if (n < 2) return 1;>49 return (recFactorial(n/2)^2) * swing(n);>50 }>>This is a correct, more general and recursive formulation>of the observation you obviously refer to.>Yes, indeed, I had not meant to solve the whole thing, justto give a hint for even n, and let the OP nd out how touse it for any n.Michel =Hallo Liste,ich hoffe es ist ok, wenn ich nicht in English schreibe?Der Simple Algorithmus f.9fr station.8are Str.9amungen besteht aus folgendenTeilen:1) L.9asen der Impulsgleichung, u_n+1 = f(u_n) (n.8achsterIterationsschritt u ist eine Funktion vom Vorg.8anger)2) Massenquelle berechnen aus der Konti-Gleichung3) Druckkorrektur4) Geschwindigkeitskorrekturen anpassen5) siehe 1)Ich habe nun folgendes Problem:Ich m.9achte zum L.9asen der Impulsgleichung ausschlielich die nichtlinearen Terme als Iterationsvorg.8anger benutzen.z.B.: u_n+1= (u_n) + ...Dies hat nur leider (bei mir) zur Folge, da dieDruckkorrekturgleichungen nicht mehr linear anb.8angig voneinander sind.Mir wurde erz.8ahlt, da diese Variante zum L.9asen der Impulsgleichungsehr wohl konvergieren w.9frde.Was hat man allerdings nun dabei zu beachten, insbesondere bei derDruckkorrekturgleichung, damit dieses Verfahren auch das macht, was essoll?Ist diese Art der Diskretisierung falsch der Impulgleichung falsch?GruKai =I have searched for C/C++ source code for calculating thechisquare_inv function, but with no success. Does anyone know where tosearch? I have searched for C/C++ source code for calculating the> chisquare_inv function, but with no success. Does anyone know where to> search?> - Function File: chisquare_inv (X, N)> For each element of X, compute the quantile (the inverse of the> CDF) at X of the chisquare distribution with N degrees of> freedom.> take a lool at the GSL-library and its inverse of theChi-square functionhttp://sources.redhat.com/gsl/ref/gsl-ref_19.html# SEC301Hope that helps.Axel =I have a function of the form:t(p,q,c) = {Xp + Yq + Zc if t < Tmax {Tmax otherwiseand a relationq = t^{-1}(p,c)where t^{-1}(p,c) is the inverse of t(p,q,c) in qApparently t^{-1}(p,c) can be calculated numericallyusing the Newton-Raphson method but I cant seehow it is applied. Any hints or references appreciated.rgdsrob =However, all these techniques assume the matrix is NON-singular, has therebeen any generalization to singular matrices, but still without utilizingthe transpose of the matrix in the calculations?i.e. the only operation required is to supply a routine that generates A*xfor a certain x.Alien+> I have been looking for techniques based on GMRES or Transpose-Freemethods> like CGS/QMR that can be utilized for singular matrices. I understand all> these techniques require nonsingular matrices. Any one knows if these> techniques have been extended to singular and/or very ill-conditioned> systems?> Alien+> However, all these techniques assume the matrix is NON-singular, has there> been any generalization to singular matrices, but still without utilizing> the transpose of the matrix in the calculations?> i.e. the only operation required is to supply a routine that generates A*x> for a certain x.> Alien+> I have been looking for techniques based on GMRES or Transpose-Free> methods> like CGS/QMR that can be utilized for singular matrices. I understand all> these techniques require nonsingular matrices. Any one knows if these> techniques have been extended to singular and/or very ill-conditioned> systems?Applying iterative methods to singular or ill-conditioned systems usually has a regularizing effect, irrespective of the method; nothing special needs to be done. One stops when the residual is slightly above the expected noise level in theright hand side (or with more sophisticated methods like L-curves)Arnold Neumaier > I would want to point out that the main advantage for utilizing QMR/CGS,>> etc. is that they avoid the utilization of the Transpose,> Not QMR. For Gmres or BiCGstab (much better than CGS) youre right.There is a transpose-free QMR (TFQMR) available in qmrpack on Netlib. There is a transpose-free QMR (TFQMR) available in qmrpack on Netlib.Which is not as the name suggests an implementation of QMR without usingtransposes, but rather CGS with residual smoothing (Walker and Zhou,Weiss) applied to it.V.-- homepage: cs utk edu tilde lastname Could somebody up there help me out by plugging>the following into Mathematica or equivalent and>>(I m sure there is a result because the Mathworld Integrator>gives me one for the indenite case - but its a bit messy)>>Integrate[Cos[x]*Log[-Cos[x] + 1 + Sqrt[D^2 + 2 + 2*Cos[x]]],{x,0,Pi}]>I know this is more of a sci.math question, but overthere i m not>getting a lot of response...Yes, well in sci.math.num-analysis you should expect to get informationabout to evaluate the integral numerically (for any xed D ), notsymbolically. For that, you should turn to sci.math.symbolic.To work symbolically it may be easier to get rid of the trig:use the half-angle substitutions cos(x) = (1-t^2)/(1+t^2) andsin(x) = 2t/(1+t^2) (and use d sin(x) = cos(x) dx to concludedx = 2dt/(1+t^2) ) to write this as the integral over (0, infty) of 2(1-t^2)/(1+t^2)^2 * log( 2t^2/(1+t^2) + sqrt( D^2 + 4/(1+t^2) ) )You can further eliminate the logarithms by doing integration by parts.This then leaves you with a purely algebraic integrand.For almost all D, the equation D^2 + 4/(1+t^2) = u^2 describes aRiemann surface of genus 1, so at best you should expect the antiderivativeto involve elliptic functions. Thats likely to be a mess as you say.(Though since you are only interested in a denite integral, you maybe able to compute it with residues; I didnt try.) In any event,are you sure thats going to be useful? Might it not, perhaps, besimpler to call the integral F(D) and then deduce whateverinformation you need about the function F straight from its denitionof as an integral?dave =alex schrieb im Newsbeitrag> Could somebody up there help me out by plugging> the following into Mathematica or equivalent and>> (I m sure there is a result because the Mathworld Integrator> gives me one for the indenite case - but its a bit messy)>> Integrate[Cos[x]*Log[-Cos[x] + 1 + Sqrt[D^2 + 2² +2*Cos[x]]],{x,0,Pi}]Alex, numerially solved using Gaussian Quadrature Integration forD = 1.23456f = Cos(x) * Log(-Cos(x) + 1 + Sqrt(D ^ 2 + 2 + 2 * Cos(x)))Integral = 0.499159841831736--