Robert Israel

6577 Reputation

21 Badges

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

MaplePrimes Activity


These are replies submitted by Robert Israel

This may give a pretty good solution, but I think it's unlikely to give the optimal solution.  For example, consider

A:= <<2 | -2>,<1| 0>, <0 | 2>>; b:= <4, 2, 1>;
 

The least squares solution to A.x = b, as reported by LinearAlgebra:-LeastSquares, is <7/3, 5/12>.  Now suppose you impose this constraint that the variables are in the interval 0 .. 2.  Your answer, if I understand you correctly, would be <2, 5/12>, which leaves residuals <-5/6, 0, -1/6>, whose sum of squares is 13/18.  But the optimal answer, which LSSolve reports (up to roundoff error), is
<2, 1/4>, with residuals <-1/2, 0, 1/2> whose sum of squares is 1/2. 

 

This may give a pretty good solution, but I think it's unlikely to give the optimal solution.  For example, consider

A:= <<2 | -2>,<1| 0>, <0 | 2>>; b:= <4, 2, 1>;
 

The least squares solution to A.x = b, as reported by LinearAlgebra:-LeastSquares, is <7/3, 5/12>.  Now suppose you impose this constraint that the variables are in the interval 0 .. 2.  Your answer, if I understand you correctly, would be <2, 5/12>, which leaves residuals <-5/6, 0, -1/6>, whose sum of squares is 13/18.  But the optimal answer, which LSSolve reports (up to roundoff error), is
<2, 1/4>, with residuals <-1/2, 0, 1/2> whose sum of squares is 1/2. 

 

The first argument to LSSolve should be the list of "residuals", i.e. the quantities that your equations say are 0.  In your case, if I understand you, the Maple command would be

Optimization[LSSolve]([ seq(A[i,1]*s1 + A[i,2]*s2 + A[i,3]*s3 + A[i,4]*s4 - B[i],
   i = 1 .. 14)], s1 = 5 .. 500, s2 = 5 .. 500, s3 = 5 .. 500, s4 = 5 .. 500);

 

 

 

The first argument to LSSolve should be the list of "residuals", i.e. the quantities that your equations say are 0.  In your case, if I understand you, the Maple command would be

Optimization[LSSolve]([ seq(A[i,1]*s1 + A[i,2]*s2 + A[i,3]*s3 + A[i,4]*s4 - B[i],
   i = 1 .. 14)], s1 = 5 .. 500, s2 = 5 .. 500, s3 = 5 .. 500, s4 = 5 .. 500);

 

 

 

I don't understand

"this is just an information, it may not be used in the solution".

It's either true or it's not true.  In this case I strongly suspect it's not true.

As I said, if X(t)/M(t) is constant, and X(t)=  Xo- M(t) (where Xo is constant), then either  Xo is 0 or M(t) is constant.  Similarly, if Y(t)/R(t) is constant and Y(t) = Yo - R(t) (where Yo is constant), then either Yo is 0 or R(t) is constant.

Now your system, which (after making the indicated substitutions) is

{diff(X(t),t) = b*(Xo-X(t))*(Xo-X(t)+Yo-Y(t))-a*X(t)*(Zo-Xo+X(t)-Yo+Y(t)), diff(Y(t),t) = e*(Yo-Y(t))*(Xo-X(t)+Yo-Y(t))-c*Y(t)*(Zo-Xo+X(t)-Yo+Y(t))}

does have constant solutions, but I don't think that's what you're looking for.

I don't understand

"this is just an information, it may not be used in the solution".

It's either true or it's not true.  In this case I strongly suspect it's not true.

As I said, if X(t)/M(t) is constant, and X(t)=  Xo- M(t) (where Xo is constant), then either  Xo is 0 or M(t) is constant.  Similarly, if Y(t)/R(t) is constant and Y(t) = Yo - R(t) (where Yo is constant), then either Yo is 0 or R(t) is constant.

Now your system, which (after making the indicated substitutions) is

{diff(X(t),t) = b*(Xo-X(t))*(Xo-X(t)+Yo-Y(t))-a*X(t)*(Zo-Xo+X(t)-Yo+Y(t)), diff(Y(t),t) = e*(Yo-Y(t))*(Xo-X(t)+Yo-Y(t))-c*Y(t)*(Zo-Xo+X(t)-Yo+Y(t))}

does have constant solutions, but I don't think that's what you're looking for.

Maybe.  If it works, it works.  If it doesn't work, you have to be more careful.

Maybe.  If it works, it works.  If it doesn't work, you have to be more careful.

You might try something like this:

> plot([seq(seq(900*d+c*exp(t/5),c=cvalues),d=dvalues)],t=0..5,thickness=2,
    colour=[red,"Coral",orange,yellow,green,"Olive",
      blue,cyan,violet,"DarkGray","Khaki",black], 
    legend = [seq(seq(``('c'=c,'d'=d),c=cvalues),d=dvalues)]);

You might try something like this:

> plot([seq(seq(900*d+c*exp(t/5),c=cvalues),d=dvalues)],t=0..5,thickness=2,
    colour=[red,"Coral",orange,yellow,green,"Olive",
      blue,cyan,violet,"DarkGray","Khaki",black], 
    legend = [seq(seq(``('c'=c,'d'=d),c=cvalues),d=dvalues)]);

Actually the result is not true if you just assume a,b,k are real.

> eval((a+b*I)^k+(a-b*I)^k, {k=3, a=-1, b=1});

   4

> eval(2*exp(1/2*k*ln(a^2+b^2))*cos(k*arctan(b/a)), {k=3,a=-1,b=1});

 -4

The problem is that arctan(b/a), which is arg(a+b*I) if a > 0, but not if a < 0.  What would work is the two-argument form arctan(b,a) instead of arctan(b/a).

Actually the result is not true if you just assume a,b,k are real.

> eval((a+b*I)^k+(a-b*I)^k, {k=3, a=-1, b=1});

   4

> eval(2*exp(1/2*k*ln(a^2+b^2))*cos(k*arctan(b/a)), {k=3,a=-1,b=1});

 -4

The problem is that arctan(b/a), which is arg(a+b*I) if a > 0, but not if a < 0.  What would work is the two-argument form arctan(b,a) instead of arctan(b/a).

This is another reason to avoid using 2D math input.  Use 1D Maple input instead.  This has been discussed here many times.  Press Ctrl-M to switch (for one input region), or from the menu bar choose Tools, Options, Display, and switch Input display to "Maple notation".  Then click "Apply Globally" to make this choice permanent.

As for the question about entering the expression twice, once for the real part and once for the imaginary part, the simplest thing to do is assign your expression to a variable, so you just have to enter the name of the variable twice.

This is another reason to avoid using 2D math input.  Use 1D Maple input instead.  This has been discussed here many times.  Press Ctrl-M to switch (for one input region), or from the menu bar choose Tools, Options, Display, and switch Input display to "Maple notation".  Then click "Apply Globally" to make this choice permanent.

As for the question about entering the expression twice, once for the real part and once for the imaginary part, the simplest thing to do is assign your expression to a variable, so you just have to enter the name of the variable twice.

Not only is it not a function, but it is not a PDF (the F in PDF stands for function).  This is what's called a "distribution of mixed type"  (partly discrete, partly continuous).   See e.g. www.math.uah.edu/stat/dist/Mixed.xhtml

 

First 77 78 79 80 81 82 83 Last Page 79 of 187