Carl Love

Carl Love

28035 Reputation

25 Badges

12 years, 326 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@williamov Use command add to do sums with specific numeric arguments.

add(XXXX, n= 0..3);

But like I said before, I DID NOT INTEND FOR YOU TO USE DetAn IN A SUMMATION. If it could be done in Maple, I would've done it in the first place. I intended for you to do this:

seq(DetAn(k), k= 0..9);

 

@williamov Use command add to do sums with specific numeric arguments.

add(XXXX, n= 0..3);

But like I said before, I DID NOT INTEND FOR YOU TO USE DetAn IN A SUMMATION. If it could be done in Maple, I would've done it in the first place. I intended for you to do this:

seq(DetAn(k), k= 0..9);

 

@williamov I did not intend for the procedure DetAn to be used in a summation! I wrote it so that you could look at the determinants. It can only be called with specified integer arguments. You cannot "convert" a symbol into an integer just by using a convert command!

@williamov I did not intend for the procedure DetAn to be used in a summation! I wrote it so that you could look at the determinants. It can only be called with specified integer arguments. You cannot "convert" a symbol into an integer just by using a convert command!

@Alejandro Jakubi Thank you for bringing this shocking and sad situation to my attention. Unfortunately, I am seeing more and longer sections of code written in the 2d input and it is more difficult to read and to debug.

@Alejandro Jakubi Thank you for bringing this shocking and sad situation to my attention. Unfortunately, I am seeing more and longer sections of code written in the 2d input and it is more difficult to read and to debug.

@casperyc Sorry that my little joke about the real reals was not understood. What I meant was that you should generate random floating-point numbers using the full value of Digits that you're working with. That way you're sampling from an essentially infinite set of numbers, rather than the 601 that you get from rand(-300..300)/100. You can make a generator procedure for a list of 4 floats in -3..3 like this:

myRand:= RandomTools:-Generate(
     list(float(range= -3..3, digits= 15), 4),
     makeproc
):
myRand();

[-1.96641365834694, 0.97863816019558, 1.64810779924759, 2.15154588529516]

You are correct that the (true) rank of a numeric matrix cannot be greater than the rank of the symbolic matrix from which it is derived. Any apparent counter-example must be due to an accumulation of round-off errors in the numeric rank algorithm. LinearAlgebra:-Rank uses a singular value decomposition for float-point matrices. If you find another example of such a Matrix, I'd be very interested in looking at its singular values.

@casperyc Sorry that my little joke about the real reals was not understood. What I meant was that you should generate random floating-point numbers using the full value of Digits that you're working with. That way you're sampling from an essentially infinite set of numbers, rather than the 601 that you get from rand(-300..300)/100. You can make a generator procedure for a list of 4 floats in -3..3 like this:

myRand:= RandomTools:-Generate(
     list(float(range= -3..3, digits= 15), 4),
     makeproc
):
myRand();

[-1.96641365834694, 0.97863816019558, 1.64810779924759, 2.15154588529516]

You are correct that the (true) rank of a numeric matrix cannot be greater than the rank of the symbolic matrix from which it is derived. Any apparent counter-example must be due to an accumulation of round-off errors in the numeric rank algorithm. LinearAlgebra:-Rank uses a singular value decomposition for float-point matrices. If you find another example of such a Matrix, I'd be very interested in looking at its singular values.

I am not familiar with the details of the bug that Alejandro mentioned. Since I never use 2d input, it hasn't affected me. But I think that there may have been a syntax change since Maple 12 such that if...then...elif...else...end if statements are now allowed immediately after the operator-defining arrow -> (and are the only statements allowed there). For the older Maple, the operator form `if`(...) may be required. So try this:

DetAn:= (n::nonnegint)-> LinearAlgebra:-Determinant(
     Matrix(
          n, n,
          (i,j)->
               `if`(
                    j >= i and (j-i)::even,
                    (j-i+1)*(j-1)!/(i-1)!*a(j-i+1)*x,
                    `if`(i-j = 1, -1, 0)
                )               
     )
):

It's unfortunate, because for a compound conditional, I think that the statement form is easier to read.

I am not familiar with the details of the bug that Alejandro mentioned. Since I never use 2d input, it hasn't affected me. But I think that there may have been a syntax change since Maple 12 such that if...then...elif...else...end if statements are now allowed immediately after the operator-defining arrow -> (and are the only statements allowed there). For the older Maple, the operator form `if`(...) may be required. So try this:

DetAn:= (n::nonnegint)-> LinearAlgebra:-Determinant(
     Matrix(
          n, n,
          (i,j)->
               `if`(
                    j >= i and (j-i)::even,
                    (j-i+1)*(j-1)!/(i-1)!*a(j-i+1)*x,
                    `if`(i-j = 1, -1, 0)
                )               
     )
):

It's unfortunate, because for a compound conditional, I think that the statement form is easier to read.

@Markiyan Hirnyk Numeric solution is almost always simpler to achieve. But more can be known about the function by symbolic solution when the answer is simple. Also, this symbolic solution can be numerically evaluated to a far higher accuracy than a dsolve(..., numeric). I think that a piecewise elementary function is simple enough.

Rather than getting constants of integration, I used the same initial conditions that Markiyan used in his numeric solution.

 

restart:

p:= piecewise(x < 10, 2, x < 11, 10, 2):

ode:= diff(z1(x),x) = simplify(p*(1+z1(x)^2)^(1/2), piecewise);

ode := diff(z1(x), x) = piecewise(x < 10, 2*sqrt(1+z1(x)^2), x < 11, 10*sqrt(1+z1(x)^2), 11 <= x, 2*sqrt(1+z1(x)^2))

dsolve({ode, z1(0)=2}, z1(x));

z1(x) = piecewise(x < 10, sinh(arcsinh(2)+2*x), x < 11, sinh(10*x-80+arcsinh(2)), 11 <= x, sinh(2*x+8+arcsinh(2)))

sol:= dsolve({diff(z(x),x)=rhs(%), z(0)=1}, z(x));

sol := z(x) = piecewise(x < 10, sinh(2*x)+(1/2)*sqrt(5)*cosh(2*x)+1-(1/2)*sqrt(5), x < 11, 1-(1/2)*sqrt(5)+(1/10)*sqrt(5)*cosh(10*x-80)+(2/5)*sqrt(5)*cosh(20)+(1/5)*sinh(10*x-80)+(4/5)*sinh(20), 11 <= x, 1-(1/2)*sqrt(5)-(4/5)*sinh(30)-(2/5)*sqrt(5)*cosh(30)+(2/5)*sqrt(5)*cosh(20)+(4/5)*sinh(20)+(1/2)*sqrt(5)*cosh(2*x+8)+sinh(2*x+8))

 

The last line got cut off by the MaplePrimes editor, but you can see it in the worksheet.

Download piecewisedsolve.mw

Wow, I've looked this over for about 30 minutes, and tried every trick I could to analyze it, and I'm stumped.

Setting Digits:= 15, all plots are identical with very smooth convergence to 0.06188 at z = 0. Since that is my default value of Digits, I didn't notice the numeric instability until Markiyan posted his plot.

Setting Digits:= 15, all plots are identical with very smooth convergence to 0.06188 at z = 0. Since that is my default value of Digits, I didn't notice the numeric instability until Markiyan posted his plot.

I know that you said that you "do not want an analytical solution", but would your opinion change if I told you that an analytic solution was fairly simple, and fairly easy to obtain?

First 657 658 659 660 661 662 663 Last Page 659 of 708