Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 104 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@tomleslie Tom, you're right about that syntax error. I assumed that the syntax was correct because plot was happy to plot the real and imaginary parts of DETM2. (I'll have to investigate why that is.) If I correct that syntax error, then fsolve(DETM2 = 0, complex) finds a root in about 10 seconds (in Maple 16 at both Digits = 10 and Digits = 15). That root is

I removed the evalf[4] before doing any of this; however, if I include it, it makes no significant difference in the root that fsolve finds.

@dorna01 

Do you have some reason to believe that a solution exists? Do you have some approximate ranges for the real and imaginary parts? By "numerical techniques", I primarily mean fsolve and DirectSearch combined with some plotting. Unless you're sure that there's a solution and can come up with some ranges, I can't think of anything else in Maple to try.

You can find DirectSearch in the Maple Applications Center. Yes, it runs in Maple 18. It's trivial to install. I need to go to sleep right now. It's very likely that someone else will provide more information very soon.

The error is apparently due to a bug in solve; there's nothing syntactically wrong with your equation. However, there's no hope for obtaining a symbolic solution to such an equation. If there's a solution, only numerical techniques can find it. So, I'm trying with fsolve, and then I'll move to DirectSearch (a third-party add-on package). By plotting, I'm convinced that there's no real solution with magnitude less than 10^8. I will look for complex solutions.

Please post the code and the erroneous use instance.

@kelvin goh But if you include undefined at the end as in the code that I gave, then f(0) <> 0.

Note that "piecewise-continuous" isn't the same as continuous. In case you thought otherwise, there is no need in Maple for a piecewise function to be continuous. Indeed, it can accomodate a step function, as in

piecewise(x < 0, 0, 1)

@sunflower For the third time I'll say that you can't assign to a formal parameter. That means that the line p0:= p produces the error. To correct this, make a local p1 and initialize it to p0. Then never use p0 again.

@sunflower You corrected the first two errors that I pointed out, but not the third: You can't make a direct assignment to a formal parameter. In other words, the line p0:= p is illegal. To correct this, make a local p1 and initialize it to p0. Then never use p0 again.

You'll also need to change diff(f(p0), x) to D(f)(p1).

@sunflower You didn't correctly transcribe what I wrote. The line

det:= LinearAlgebra:-Determinant(A)

needs to be inside the while loop.

@sunflower wrote:

I don't know how to create a matrix which have det=2. I don't understand

Multiplying a row or column of a matrix by c causes the determinant to be multiplied by c. So, multiplying a whole matrix by c^(1/n), c > 0, causes the determinant to be multiplied by c.

@vv Thanks for spotting the problem and suggesting the solution. Correcting the sign with signum(det) doesn't always work. Here's some corrected code:

restart:
macro(LA= LinearAlgebra):
n:= 9:
while not det::positive do
     A:= LA:-RandomMatrix((n,n), datatype= float[8], shape= symmetric);
     det:= LA:-Determinant(A)
end do:
A:= (2/det)^(1/n)*A;

@JohnS Take heart, John S: Your posted solution is far more elegant than my first two attempts, each of which I almost posted. The first of these was to multiply the first row by 2/det. The second was to take the first attempt and multiply by a random permutation matrix and then adjust for the sign of the permutation.

So, I promoted your Reply to an Answer and gave it a vote up.

Note that your code doesn't use RandomTools.

For more-elegant posts, note that you can use Shift-Enter in MaplePrimes to avoid those ugly blank lines between lines of code.

@tomleslie The OP picked up this usage of uses from reading my code examples. 

Stylistically, I object to the form

uses <package 1>, <package 2>, ...;

preferring instead the form

uses <abbrev 1>= <package 1>, <abbrev 2>= <package 2>, ...;

The reason that I object to the former is that it makes it difficult for a reader to know which global names come from which packages and which come from the writer's own definitions.

Likewise, I generally object to using the with command and I use instead, for example,

macro(LA= LinearAlgebra);

I will use a with command to load overloaded operators from a package; using infix operators in prefix form with a package prefix is too much for me.

 

 

@Ramakrishnan The midpoint methods avoid evaluating a BVP system at the boundary points, and thus avoid some singularities. You can access them using option method= bvp[midrich] or method= bvp[middefer]. See help page ?dsolve,numeric,bvp.

What makes you (Sunflower) think that there are errors?

@asa12 You are correct that the bracket represents dot product. The symbol that you're transcribing as 1_i_j is almost certainly the Kronecker delta. It's defined as 1 if i = j, and 0 otherwise.

Each entry of the matrix product A.B (for real-valued A and B) comes from taking the dot product of one row of A with one column of B. So yes, the matrix product B.B^* is equivalent to taking the dot product of each vector with each other vector, including with itself.

First 446 447 448 449 450 451 452 Last Page 448 of 709