Robert Israel

6577 Reputation

21 Badges

18 years, 211 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are answers submitted by Robert Israel

 If you have a list L of your points, then

> map(fg, L);

will give you the list of transformed points.

You have only 2370 points.  I'll use ArrayInterpolation from the CurveFitting package to produce the data the AudioTools wants, which is sampled at  44100 time values.  In this case it's using spline interpolation.

> data:= Array(readdata("c:/test/audiodata.txt", 2));
  A:= AudioTools[Create](duration=1);
  CurveFitting[ArrayInterpolation](data, <seq(i/44099.0, i=0..44099)>, method=spline, container=A);
  AudioTools[Write]("c:/test/audiodata.wav", A);

 

 

For  symbolic solutions, e.g.:

> solve(x^2 + a*x + a = 0, x);

-1/2*a+1/2*(a^2-4*a)^(1/2), -1/2*a-1/2*(a^2-4*a)^(1/2)

For numerical solutions, e.g.:

> fsolve(x^2 + 5*x + 5 = 0, x);

-3.618033989, -1.381966011

a) You don't need to make it symbolic: any variable that doesn't have a numerical value assigned to it is already symbolic.

b) Fix the error and re-execute the worksheet.

c) with(LinearAlgebra):

You need the LinearAlgebra package if you want to use any of the commands it contains.

 

Write each complex variable in terms of its real and imaginary parts.  Each equation splits into two, one for the real part and one for the imaginary part.  For example: if the original system is sys with variables x(t) and y(t), your new system, using variables xre(t), xim(t), yre(t), yim(t), is

> newsys:= map(eq -> (evalc(Re(eq)), evalc(Im(eq))), 
    eval(sys, {x(t) = xre(t) + I*xim(t), y(t) = yre(t) + I*yim(t)})); 

 

 

Let U be an n x n orthogonal matrix, and L a list of n nonnegative numbers. 
Then C = U.DiagonalMatrix[L].U^%T is a positive definite matrix (which could be a covariance matrix). 
To get a correlation matrix, divide C[i,j] by sqrt(C[i,i]*C[j,j]).  This ought to do it.   I got the method of
finding a random orthogonal matrix from groups.google.ca/group/sci.math/browse_frm/thread/a11532d21db23953

> with(LinearAlgebra):  with(Statistics):
   n := 5; # change to whatever size you want
   N:= RandomVariable(Normal(0,1)):
   U:= IdentityMatrix(n): 
   for j from 2 to n do
     a:= Sample(N,j);
     a[j]:= a[j] - 1;
     if j = n then
       U:= U . HouseholderMatrix(a)
    else 
      U:= U . <<HouseholderMatrix(a),ZeroMatrix(n-j,j)>|<ZeroMatrix(j,n-j),IdentityMatrix(n-j)>>;
    end if  
  end do:
  C:= U . DiagonalMatrix(Sample(Uniform(0,1), n)) . U^%T:
  R:= Matrix(n,n, (i,j) -> C[i,j]/sqrt(C[i,i]*C[j,j]), shape=symmetric);


 
 

> pq := <<-P^2, -P*Q+c>|< P*Q+c, Q^2>>;
  subs(v = <g.P,g.Q>, M = pq, 2*v = M . <alpha, beta>);

 

You're using the wrong syntax for specifying starting values.  It would be

> fsolve(testset, inits);

except that you haven't given initial values for some of the variables.  So try

> fsolve(testset, inits union (indets(testset, name) minus indets(inits, name)));

It takes a while, but I do get an answer (which happens to be the same one that I get without specifying initial values at all).
If this is not the answer you're looking for, you might try specifying intervals rather than initial values.

I suppose you want a curve that passes through (or close to) the points [i, V[i]] for i = 1 to 8. 

Well, this looks very much like exponential decay to a constant.

> f:= Statistics[Fit](a*exp(-b*t)+c, [$1..8], V, t);
  with(plots):
  display([plot(f, t=1..8), listplot(V, style=point, symbol=circle)]);

 

 

If you're willing to write the command yourself, rather than using a procedure such as Doug's:



> coeff(coeff(coeff(f(x,y,z), x^2), y), z^3);

 

The problem is that sum is calling G with the symbolic argument 13-j, and G is not set up to allow that. 

The cure is to use add instead of sum, since add does not evaluate its arguments first. 

> add(G(13-j), j = 0 .. 2);

It's nearly always better to use add instead of sum when what you want to do is explicitly add a given finite collection of terms. Use sum for an infinite series or a symbolic formula for a sum.

 

Try Import in the ExcelTools package to real an Excel spreadsheet (in .xls format).  The result will be a two-dimensional Array that can be converted to a Vector if there's just one column.

With a text file containing one number per line, you can use readdata or  fscanf.  The simplest is readdata.

> Vector(readdata("c:/myfolder/myfile.txt"));

or (if there are m lines)

> Vector(fscanf("c:/myfolder/myfile.txt", "%{"|| m || ",1}am"));

 

with(plots): with(plottools):
polygonplot([op(op(arc([0,0],2,5*Pi/3..7*Pi/3))), op(op(arc([0,0],3,7*Pi/3..5*Pi/3)))],
    colour=blue, axiscoordinates=polar);

Leave out the axiscoordinates=polar if you're using the Classic GUI or an older version of Maple (before Maple 12, I think).

I assume you mean you want to fit the equation y = a*sin(b*x+c) + d to your data.

> with(Statistics):
   X:= [0.1, 0.2, 0.3, 0.5, 0.9, 1.5];
   Y:= [2.2, 2.0, 1.7, 1.4, 1.2, 2.4];
   f:= Fit(a*sin(b*x+c)+d, X, Y, x);

f := -1.15580028879341712*sin(2.22069518969496293*x-.130332816749035546)+2.32490667588415256

> with(plots):
   display(pointplot(zip(`[]`,X,Y),symbol=circle), plot(f, x = 0 .. 1.6));

 

 

Your equations are missing variables for the second differentiation.  Perhaps they should be

> de1:= c1*diff(y1(x,y),x) + c2*diff(diff(y2(x,y),y),y) = r1;
   de2:= c3*diff(y1(x,y),y) + c4*diff(diff(y2(x,y),x),x) = r2; 

Then you can try

> DEtools[rifsimp]([de1,de2]);

 

 

First 66 67 68 69 70 71 72 Last Page 68 of 138