mm-465 ==== Subject: Re: Solving a Cubic Equation> How do you solve the following:> Find the cubic equation with solutions -1/2, 4, and -4.Presumably, had you paid attention to your professor or read thetext, you would have come across the factorization theorem ofalgebra. A polynomial in a single variable, p(z,n) = a_n z^n + a_{n-1} z^{n-1} ... + a_1 z + a_0has two important properties: 1. If the coefficients a_k are complex numbers, p(z,n) has exactly n (complex) roots (fundamental theorem of algebra!!). 2. p(z,n) = a_n * (z - z_1) * (z - z_2) * ... (z - z_n) (polynomial factorization theorem).Thus you can't find THE cubic equation with those roots (do you see why?)but you can find A cubic equation with those roots. ===Subject: Re: understanding time domain by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i3ALgS015336;Came across this question while browsing the net, i have same questionwhy use t = 0:0.001:0.6, why not t = 0:0.001:0.8 or 0.7 for thatmatter. > what is the relationship with time,(t = 0:0.001:0.6), and the restof> the signal or code in the following tutorial:> t = 0:0.001:0.6;> x = sin(2*pi*50*t)+sin(2*pi*120*t);> y = x + 2*randn(size(t));> plot(1000*t(1:50),y(1:50))> title('Signal Corrupted with Zero-Mean Random Noise')> xlabel('time (milliseconds)')> It is difficult to identify the frequency components by looking atthe> original signal. Converting to the frequency domain, the discrete> Fourier transform of the noisy signal y is found by taking the> 512-point fast Fourier transform (FFT):> Y = fft(y,512);> The power spectrum, a measurement of the power at variousfrequencies,> is> Pyy = Y.* conj(Y) / 512;> Graph the first 257 points (the other 255 points are redundant) ona> meaningful frequency axis:> f = 1000*(0:256)/512;> plot(f,Pyy(1:257))> title('Frequency content of y')> xlabel('frequency (Hz)')> This represents the frequency content of y in the range from DC upto> and including the Nyquist frequency. (The signal produces thestrong> peaks.)>I'm not sure if I understand the question, but if you are new tomatlab let>me explain a little. Time here is a vector that will have length601, with>values from 0 to 0.6, incremented in 0.001. When you say:>x = sin(2*pi*50*t)+sin(2*pi*120*t);>what x becomes a vector summation of two sinusoids of frequencies50Hz and>120 Hz, from time 0 to 0.6 seconds. The randn function returns avector of>the same length as t and x, with random values with mean 0, var=1,STD=1.>Once you've summed the two vectors into y, you now have yourresulting noisy>time domain signal, which you will perform FFT on. Your 'samplingfreq'>here is 1000, which you need for display of your FFT. I hope thisclears up>a little of how time is used in the demo.>Tim===Subject: Re: Fourier Analysis> Is there any Routine to compute only selected fourier coefficients of a> periodic sequence? Fourier analysis is in fact a special application of least squares curvefit,where the x-variables are of type cos(twopi/N)It is possible to select an arbitrary set of those, tabulate them with y,and use a normal regression analysis routine.Arto.Huttunen at estlab dot com===Subject: Re: Vector Crossproduct in polar coordinates>As GORDO said you do it in exactly the same way as for rectangular>coordinates. Use the determinant method with the top row (er, etheta, ez) as>unit vectors instead of (i, j, k). The second row is (ar, atheta, az) for>vector a and the third row is (br, btheta, bz) for vector b. This gives a X>b where a and b are the components of the vectors in polar coordinates and>the cross product is also in polar coordinates. Ditto for spherical>coordinates.It doesn't seem to workI took two vectors in rectangular and cylindrical coordinates as follows:Rectangular[1 0 5 1][0.5 1 1]Their crossproduct is [-0.5 -0.5 .75] I checked this manually and with an HP49 calcin Radians[1.12 <0.46 1][1.12 <1.11 1] Their crossproduct is[.71 <-2.36 .75] I calculated this with the HP49gUsing the matrix definition of cross product, I got exactly the result for therectangular coord case. ( No big surprise!!)For the Cylindrical coordinate caseUsing the matrix definition :R Theta Z1.12 0.46 11.12 1.11 1R is 0.46 -1.11 = 0.65Theta is 1.12 -1.12 =0Z is 1.12*1.11 -1.12*.46 = 0.73Summarizing:0.65 <0 0.73 is not the same as 0.71 <-2.36 0.75What am I doing wrong?? ===Subject: Re: Vector Crossproduct in polar coordinates> As GORDO said you do it in exactly the same way as for rectangular> coordinates. Use the determinant method with the top row (er,> etheta, ez) as unit vectors instead of (i, j, k). The second row is> (ar, atheta, az) for vector a and the third row is (br, btheta, bz)> for vector b. This gives a X b where a and b are the components of> the vectors in polar coordinates and the cross product is also in> polar coordinates. Ditto for spherical coordinates.> It doesn't seem to work> I took two vectors in rectangular and cylindrical coordinates as> follows: Rectangular> [1 0 5 1]> [0.5 1 1]> Their crossproduct is> [-0.5 -0.5 .75] I checked this manually and with an HP49 calc> with Theta in Radians> What am I doing wrong??You are confusing components of vectors with coordinates of points. Avector v in cylindrical coordinates does not have components (r,theta,z) but(v_r, v_theta, v_z), where the r, theta, and z directions at a point aredefined as the directions of initial movement if only one coordinate ischanged. The r and theta directions are position-dependent. Look up topicssuch as orthogonal coordinate systems, orthogonal coordinatetransformations, and change of basis. To return to your original question,cross products are computed the same way in all orthogonal coordinatesystems (including Cartesian, cylindrical, and spherical). A positionvector cannot be given in cylindrical coordinates, since the r and thetadirections are ambiguous at the origin. If you want to compute the crossproduct of two position vectors, those vectors have to be expressed inCartesian coordinates.===Subject: Re: Vector Crossproduct in polar coordinates> As GORDO said you do it in exactly the same way as for rectangular> coordinates. Use the determinant method with the top row (er,> etheta, ez) as unit vectors instead of (i, j, k). The second row is> (ar, atheta, az) for vector a and the third row is (br, btheta, bz)> for vector b. This gives a X b where a and b are the components of> the vectors in polar coordinates and the cross product is also in> polar coordinates. Ditto for spherical coordinates.> It doesn't seem to work> I took two vectors in rectangular and cylindrical coordinates as> follows: Rectangular> [1 0 5 1]> [0.5 1 1]> Their crossproduct is> [-0.5 -0.5 .75] I checked this manually and with an HP49 calc> with Theta in Radians> ...> What am I doing wrong??> You are confusing components of vectors with coordinates of points. A> vector v in cylindrical coordinates does not have components (r,theta,z)but> (v_r, v_theta, v_z), where the r, theta, and z directions at a point are> defined as the directions of initial movement if only one coordinate is> changed. The r and theta directions are position-dependent. Look uptopics> such as orthogonal coordinate systems, orthogonal coordinate> transformations, and change of basis. To return to your originalquestion,> cross products are computed the same way in all orthogonal coordinate> systems (including Cartesian, cylindrical, and spherical). A position> vector cannot be given in cylindrical coordinates, since the r and theta> directions are ambiguous at the origin. If you want to compute the cross> product of two position vectors, those vectors have to be expressed in> Cartesian coordinates.> GordoTo add to what Gordo says, the easiest way to see why what you propose doesnot work is to look at the units. The (r,Theta, z) coordinates of a positionvector are not all in the same units. r and z are in length units whileTheta is in radians (or degrees). The cross product of two position vectorsin these units would give the Theta component of the product as lengthsquared and the other two components as Length X radians, which is obviouslyinvalid.For a position vector the change from x,y,z coordinates to r,Theta,zcoordinates can be looked at as a coordinate rotation about the z-axis sothat r is the vector sum of x and y. The theta component in the rotatedsystem is in this sense zero. However if you take a different vector andlook at its cylindrical coordinates they define a different local coordinatesystem incompatible with the first vector, so you can't just find the crossproduct of (ra,0,za) and (rb,0,zb) because the r and theta directions aredifferent for the two cases.===Subject: Re: Matrix algebra question> Does anyone know what the condition for the following matrix product to> equal the identity matrix:> A'((AA')^-1)A> I'm finding this often is true - but is it aways true (provided (AA') is> non-singular)?> Let me take a crack at it:> Being (AB)^-1 = (B^-1)(A^-1)> Then:> A'((AA')^-1)A = A'(A'^1)(A^-1)A> So, having in mind that :> A(A^-1) = I> Then it leads to:> A'(A'^1)(A^-1)A = I I = I> So, as far as I can tell, the only conditions A and A' must follow is that> they must allow inversion (non-singular square matrix) and that A and A'> should be multipliable (compatible dimensions). All in all, A and A' should> be non-singular, square and with the same dimension.> Therefore it seems that yes, it is always true (provided (AA') is> non-singular).> Please correct me if I'm wrong.not really A can be rectangular and AA' be invertable. the result caneven be singular. it is true that A = A *(A'*inv(AA')*A) always.maple Vr4 output is shows a counter example...> restart;> with(linalg):> A := matrix(2,3,[1,2,3,4,5,6]); [1 2 3] A := [ ] [4 5 6]> B :=A &* transpose(A):evalm(B); [14 32] [ ] [32 77]> det(B); 54> C := transpose(A) &* inverse(B) &* A:evalm(C); [5/6 1/3 -1/6] [ ] [1/3 1/3 1/3 ] [ ] [-1/6 1/3 5/6 ]> det(C); 0> E := A &* C:evalm(E); [1 2 3] [ ] [4 5 6]> evalm(A); [1 2 3] [ ] [4 5 6]#endof output.===Subject: Simple question regarding frequencies detection by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i3B1oGC11228;Hi all,I have a question similar to one asked a while ago by Atri Mandal.For my project, I obtain a signal with a bandwidth of (maximum)100,000 Hz. (128 data samples acquired in a 1.3 msec). There aremultiple peaks within the signal, and I want to know the peakfrequencies. That is, I do not care to know the magnitude of thepeaks, aside perhaps from the fact that they exceed a certain noisethreshhold. I just want to know the frequencies at which they occur. Some of these peaks may be flat, in which case something akin to themedian frequency should be returned.Is there a fast, efficient algorithm for detecting the numericalfrequency values of a spectrum without calculating the full FFT? Anyhelp is appreciated.Saptarshi Bandyopadhyay===Subject: Re: Simple question regarding frequencies detectionI'm not sure if I understand what you are trying to do correctly, but if youare merely trying to calculate how often these peaks occur, why not justcount the interval between neighbouring peaks.Chris> Hi all,> I have a question similar to one asked a while ago by Atri Mandal.> For my project, I obtain a signal with a bandwidth of (maximum)> 100,000 Hz. (128 data samples acquired in a 1.3 msec). There are> multiple peaks within the signal, and I want to know the peak> frequencies. That is, I do not care to know the magnitude of the> peaks, aside perhaps from the fact that they exceed a certain noise> threshhold. I just want to know the frequencies at which they occur.> Some of these peaks may be flat, in which case something akin to the> median frequency should be returned.> Is there a fast, efficient algorithm for detecting the numerical> frequency values of a spectrum without calculating the full FFT? Any> help is appreciated.===Subject: Underdetermined system least squares I am doing some linear least square calculations. I have been usingthe non-negative least squares algorithm written by Lawson and Hanson.Unfortuantely I don't have a copy of their book, (its on order).The problem involves seismic wave-form modeling. Depending on thenumber of Green's functions I attempt to fit to the data, my problemcan either be overdetermined (if I use relatively few green'sfunctions) or underdetermined ( great gobs of green's functions).Essentially I'm solving for the weights or amplitude (which can't benegative) of the green's functions that result in the best fit to theobserved wave forms.My question is do the solutions I get from the non-negative leastsquares algorithm have any meaning when the system is underdetermined?I'm not sure exactly what NNLS written by Lawson and Hanson do in thatcase.Truth be told, the results I get look reasonable. Course, that doesn'tmean they are not bull.===Subject: want to know by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i3BCNtR12584; please can anybody tell other names of the following methods crouts method two point quadrature formula three point quadrature formula===Subject: Diferential eq - solve for function of P with respect to X by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i3BCNoQ12464;The marginal profit function gives the change in the total profit (P)of a business due to a change in the business. A company, determinesthat dP/dx = e^(-x)^2 - 2Px, where x is the amount invested inmachinery. Determine total P as a function of x, if P=0 for x=0.Given: P = total profit, dP/dx = marginal profit = e^(-x)^2 - 2Px x = amount invested Find: f(x) = P, if P =0 for x = 0 (P,X) = (0,0)For some reason, I believe there is a typo in the question. I thinkthat dP/dx = [e^(-x)^2] times [- 2Px]then dP/P = {[e^(-x)^2] times [- 2x]}dx --> now integrateln|P| = [e^(-x)^2] + ln|c| P = (-x^2)lne + e^ln|c| = -x^2 + c where c is the constant ofintergrationIf in fact that, dP/dx = e^(-x)^2 'minus' 2Px , then I'm at a lossPlease help===Subject: Re: Diferential eq - solve for function of P with respect to X> Given: P = total profit, dP/dx = marginal profit = e^(-x)^2 - 2PxI pressume that you mean dP/dx + 2Px = exp(-(x^2))Definef = P*exp(x^2)This givesdf/dx = (dP/dx + 2xP)*exp(x^2) df/dx = 1f = x + cP = (x + c)exp(-x^2)===Subject: Re: Diferential eq - solve for function of P with respect to XJacob Payant schrieb im Newsbeitrag> The marginal profit function gives the change in the total profit (P)> of a business due to a change in the business. A company, determines> that dP/dx = e^(-x)^2 - 2Px, where x is the amount invested in> machinery. Determine total P as a function of x, if P=0 for x=0.> Given: P = total profit, dP/dx = marginal profit = e^(-x)^2 - 2Px> x = amount invested> Find: f(x) = P, if P =0 for x = 0 (P,X) = (0,0)> For some reason, I believe there is a typo in the question. I think> that> dP/dx = [e^(-x)^2] times [- 2Px]> then dP/P = {[e^(-x)^2] times [- 2x]}dx --> now integrate> ln|P| = [e^(-x)^2] + ln|c|> P = (-x^2)lne + e^ln|c| = -x^2 + c where c is the constant of> intergration> If in fact that, dP/dx = e^(-x)^2 'minus' 2Px , then I'm at a lossI solved it numerically: Seehttp://homepages.compuserve.de/Jan390906/news/z-ng-04-04-11 -15.htmEmail account locked up due to spams===Subject: about theorems in numerical methods by support1.mathforum.org (8.11.6/8.11.6/The Math Forum, $Revision: 1.9 primary) id i3BCOOQ12678; i want to know the other names of the following methods 1. crouts method 2. two point quadrature formula 3. three point quadrature formula===Subject: Re: Uniform distribution of Barycentric coordinates?> Barycentric coordinates are numbers that specify the position of a point> in a simplex. For an n-dimensional simplex there are n+1 coordinates,> say t_i, such that the t_i all sum to 1, that is,> n+1> SUM t_i = 1> i=1> Does anyone know how to get a uniform distribution of such points in a> simplex?> E.g. generate a random set of points in a simplex that are uniformly> distributed (in the limit of large number of points, of course).Let (x,y,z) be uniformly distributed in the simplexS3={(a,b,c):a+b+c=1,a>=0,b>=0,c>=0}, that is, theprobability that (x,y,z) will fall in a subset of S3is proportional to the area of the subset.Two commonly used methods for generating such a point(x,y,z) are: Choose two ordered uniform [0,1) variates U1 Two commonly used methods for generating such a point> (x,y,z) are:> Choose two ordered uniform [0,1) variates U1 put x=U1,y=U2-U1,z=1-U2.Are U1 and U2 chosen separately, first, from [0,1) or is U1 chosen from [0,1) and U2 from [0,U1)? The latter seems like a bad idea, but I figured I better ask.How does this generalize to an n-simplex?I have to think about the exponential one. I don't really understand it, yet. That is, why an exponential variate set gives the proper distribution..===Subject: Re: using GSLThe error message means the linker doesn't findthe definition for the external symbolgsl_sf_bessel_K1Since you have the source code look at the definition of thesymbol in some source file.grep gsl_sf_bessel_K1 *.c *.hwould be a starting approach.When you find the definition, include the source filewith the definition in the link command line.You may have to add some source file thatis missing in the msvc project.http://www.cs.virginia.edu/~lcc-win32.===Subject: Re: using GSL> http://sources.redhat.com/gsl/> As Googling gsl would have told you, GSL is the GNU Scientific> Library, a comprehensive math library written in C.Since I wasn't being paid to answer the man's question, I didn't feel I should have to spend my good time on side issues.