Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Al86 You need to remove the restart from the middle of your worksheet. Then vv's Answer works.

@Al86 Your uploaded code still won't download. My guess is that MaplePrimes can't handle file names with plus signs. Please try again with a different name.

@necron The first operand of an unevaluated integral is the integrand. For example, if

J:= Int(x^2, x= 0..1);

then op(0, J) is Intop(1, J) is x^2, and op(2, J) is x= 0..1.

In addition to what Tom said, capitalization is important: It's ShowSolution, not showsolution.

@shadi alomari 

Yes, it does appear that your package has no Maple-accessible help file. If it did, there'd be a file named *.hdb (for your Maple 13) or *.help (which'd only work in more-recent Maple). If there was a help file, you'd access it just like regular Maple help. 

@Preben Alsholm In addition to what was mentioned by Christopher, a reason to not prepend to libname is that it makes it impossible to override a pre-installed command with another of the same name. My warning---with its capital letters and exclamation points---makes it seem that prepending would be as disastrous as overwriting. I didn't mean that, so I updated my Reply to mollify the strength of my warning for the prepend case.

@acer Perhaps my comment was misconstrued. I didn't mean to imply that map[evalhf] was better than the prepackaged commands. I simply meant that map[evalhf] was better than plain map. I updated the Reply to make this more clear.

@ccAndrew Ah, good idea! It never occurred to me to use an inverted range with FitIntensity.

If you're going to use map on an image instead of using the prepackaged commands, then you should do it like this:

img1:= map[evalhf](x-> 1-x, img);

Test it for time. You'll see that it's many, many times faster than evalf(map(...)).

If you have no reason to save the original img, then even better is

map[evalhf, inplace](x-> 1-x, img);

(This Reply was updated for clarity due to Acer's Reply below.)

@tomleslie I assumed that it was a browser problem. Often, + or - signs don't show on my phone's browser (Chrome for Android). Since the minus sign shows up here, I assumed that the missing operator was +.

@mobiusinfi Yes, I realized the confusion. I always use boldface for Maple code words. I saw that Robert hadn't, so I changed his "try" to try after your Reply. It's not your fault for missing it.

@Vishal 

  1. This is a new Question, and you should post it as such.
  2. First try to get the integral for a specific finite interval: Change -infinity..ss to -1..0.
  3. Even for -1..0, I've had no luck so far.
  4. A term 10^(-12038)*I is suspect. It looks like simply round-off error from a prior computation.

@Markiyan Hirnyk In Maple 18, evalc doesn't automatically map over matrices, but Re does. So that needs to be evalc~(Re(A)). I can't say if that has changed in Maple 2015.

@mobiusinfi Try ?try.

@mobiusinfi 

vv is correct. NULL isn't the same false. You can check for NULL like this:

r:= fsolve(...);
h[i+1]:= `if`(r = NULL, 0, `if`(r >= 0, 0, r));

The above isn't entirely safe because the fsolve may return unevaluated. Doing a type check is safer.

@mobiusinfi Then you use a try ... catch statement. See ?try.

For example, to apply it to your situation do

for i from 1 by 1 while(i<150 and h[i]<0) do
     p1[i] := #long polynomial omitted
     r:= fsolve(p1[i]-0.312e-1, x, -.2 .. 0);
     try
          if r < 0 then h[i+1]:= r end if
     catch "cannot determine":
          h[i+1]:= 0
     end try;
     print(i, h[i])
end do;

But, in my opinion, it's much better to prevent an error (when possible) than to "catch" it. This particular error is prevented by the code in my Answer: Do a type check before an inequality check:

if expression :: type implies inequality then ...

On the other hand, there are many situations where it's impossible to prevent an error. In those cases, a result may nonetheless be produced by using the try ... catch statement.

First 455 456 457 458 459 460 461 Last Page 457 of 709