Carl Love

Carl Love

27641 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@vshyam Wikipedia and crowd-sourcing are great.

Are you trying some special numerical integration that Maple can't otherwise handle? Or are you just studying the method?

@vshyam Wikipedia and crowd-sourcing are great.

Are you trying some special numerical integration that Maple can't otherwise handle? Or are you just studying the method?

Note that Maple does allow for an empty Matrix, Matrix(0,0) or simply Matrix(), whose determinant is 1. So you don't need to treat n = 0 as a separate case.

Note that Maple does allow for an empty Matrix, Matrix(0,0) or simply Matrix(), whose determinant is 1. So you don't need to treat n = 0 as a separate case.

@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

First 652 653 654 655 656 657 658 Last Page 654 of 704