Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@sunflower 

No, they're not the same. The first one has an extra space. Look at them lined up:

printf ("*");
printf("*");

See? The first one is longer because it has an extra space. That extra space is illegal in Maple's 2D input.

@perr7 

The message "Length of output exceeds limit if 1000000" is NOT an error message. It's an indication that the computation has been sucessfully completed but the results are too long to show on screen. When you assign a plot or an animation to a variable, there's usually no need to see the algebraic form of the plot structure. Just end the command with a colon to suppress the output.

If you need further help, you'll probably need to post the full code so that we can execute it.

@Christopher2222 

Your procedure needs adjustment for the cases when the exponent (the second operand of the float) is nonnegative and for the special weird case of negative zero (which is a separate float in Maple). Here's my procedure that handles those cases:

`convert/floatsymbol`:= (a::coerce(float, (a::realcons)-> evalf(a)))->
     (e->
          nprintf(
               cat(
                   `if`(CopySign(1,a) < 0, "-", ""),
                   "%.",
                   max(-e,0),
                   "f",
                   `if`(e < 0, "", ".")
               ),
               abs(a)
          )
     )(op(2,a))
:

Usage:

convert(.006, floatsymbol);
convert(-1000., floatsymbol);
convert(-0., floatsymbol);

@Athar Shahabinejad 

The number that you got means the same as 5.275440947*10^6 or 5275440.947 or 5.275440947E6. The number format is called scientific notation.

@ 

In my experience, when it's applied to univariate polynomials, fsolve is totally reliable and very easy to use. Do you have an example where it's not?

 

@J4James The purpose of the seq is to specify which contours to plot. In this case, there are 21 evenly spaced from 1 to 3.

@Preben Alsholm 

I find the 14 + (-1) particularly odd. That should be covered by automatic simplification.

It's also odd that (x^2-1) got changed to (x^2+(-1)).

In some ways it seems as if -1 is being treated as a symbol.

@Carl Love 

And here's my Radau procedure:

LegP:= (n::posint, x::name)-> diff((x^2-1)^n, x$n)/2^n/n!:

Radau:= proc(f::algebraic, R::name=range(realcons), n::posint)
local
     x:= lhs(R), a, b,
     Pn:= LegP(n,x), Pnm1:= LegP(n-1,x),
     F, oldDigits, r
;
     oldDigits:= Digits;
     Digits:= Digits+1+ilog2(Digits)+iroot(n,3)^2;
     (a,b):= op(evalf(rhs(R)));
     F:= unapply(eval((b-a)/2*f, x= (b-a)/2*x + (a+b)/2)*(1-x)/n^2/Pnm1^2, x);
     r:= (b-a)*eval(f, x= a)/n^2 + add(F(x), x= [fsolve(Pn+Pnm1)][2..]);
     evalf[oldDigits](r)
end proc:

Digits:= 15:

Radau(sin(sin(x)), x= 0..Pi, 13);

     1.78648748195005

So, the Radau can do this integrand with one less evaluation than the Lobatto required.

 

@H-R There is only one orientation where the color sequence goes green, then yellow, then blue.

@CapnSwing So, you have reference solutions. Perchance are they complex?

@Markiyan Hirnyk 

I was aware of that, but I didn't mention it because it doesn't work for `^`. I wanted consistent techniques.

@tomleslie 

DirectSearch:-SolveEquations will almost always return some sort of least-squares solution, i.e., a "solution" with a relatively minimal value of the sum of the squares of the residuals, even if that sum is very far from 0. These are not what would ordinarily be called solutions.

PS: This information about the residuals and the sum of their squares is returned as the first two items in the list returned by SolveEquations, so there's no need for you to check the residuals yourself.

@Markiyan Hirnyk Note that it was only accounts with 0 reputation AND hyperlinks in the biographical info fields that were deleted. Since you currently have no biographical info posted at all, it seems unlikely that you had biographical info with hyperlinks when you had 0 reputation.

@sejwal Given that my Answer appears now with a green banner, you evidently did accept it. You do this by clicking on the cup symbol at the right edge of the banner.

Markiyan: To shed some light, or perhaps darkness, on the situation: There are well over 1000 procedures in module RegularChains. I have no idea what they do. Most seem to do some small thing and then pass the job on to another procedure.

When fsolve returns with essentially the same command that you gave, it usually means one of three things:

  1. There is no solution, but it couldn't prove that. (If it can prove that there's no solution, it returns NULL.)
  2. There is a solution, but it couldn't find it.
  3. It found a solution, but it couldn't refine it to the requested level of accuracy (as specified by Digits) using however many extra digits for computation that it chooses to use.

Unfortunately, there's no sure way to distinguish these cases; it's a major shortcoming of fsolve. Number 3 is particularly frustrating because there's no way to tell it how many extra digits to use.

It's possible (although a bit awkward) to see the solution guesses that fsolve makes. You can do this by making the equations into a procedure that computes the residuals and giving the procedure option remember. Doing this, you can sometimes discriminate between the cases.

First 442 443 444 445 446 447 448 Last Page 444 of 709