Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@Carl Love My experience with Feedly so far is that

  1. There's a lag of about an hour before messages appear on it;
  2. I can't find any option for it to send notifications, i.e., to make my phone beep. 

It seems that you intended to attach a worksheet, but there's none attached. Please try again.

@Scot Gould Thanks, I will try Feedly. At this point, I know so little about this that I couldn't tell you if it's what I want. I realized that I'd get some spam notifications also, but that's okay since I'm one of the people who deletes them.

@Joe Riel An operator with a type declaration requires parentheses around the parameter declaration. This affects your second example.

If you have any questions about the above worksheet, I'd be happy to answer them.

If the assignment had just asked for a table of the corrected values, that could've been done much more easily with a stock Maple command: 

dsolve(
   
..., numeric, method= classical[heunform], stepsize= h, output= Array(h*~[$0..n])
);


But to also get the predicted values requires the work to be done at a low-level and in a loop. I edited my Answer to also give these stock Maple corrected values for comparison purposes.

@Stretto You can override that behavior for 0 or 1 arguments while keeping the original behavior for more arguments like this:

`%+`:= ()-> `if`(nargs=0, 0, `if`(nargs=1, args, 'procname'(args))):

I wrote a substantial Answer to your Question. It offends me that you haven't responded.

You should make it a procedure. In doing so, you can substantially shorten and simplify the code and substantially increase its functionality at the same time.

The increased functionality comes from loosening the definition of "equals" and adding flexibility to the definition of "less than". In the example below, I consider floats to be equal if they match to a certain number of decimal places; and I exchange the roles of `<` and `>`. 

Maple's "neutral operator" syntax makes it possible to add this functionality with adding only 2 characters to the body of the procedure.
 

restart:

BinarySearch:= proc(
    AA::And(rtable, satisfies(rtable_num_dims=1)), KEYVALUE, #item to look for
    {`&<`::appliable:= :-`<`, `&=`::appliable:= :-`=`} #optional arguments
)
local low:= lowerbound(AA), high:= upperbound(AA), mid;
    while low <= high do
        mid:= iquo(low+high, 2);
        if AA[mid] &= KEYVALUE then return mid fi;
        if AA[mid] &< KEYVALUE then low:= mid+1 else high:= mid-1 fi       
    od;
    false
end proc
:

R:= rand(-1.0..1.0):
A:= Statistics:-Sample(Uniform(-1,1), 10^6):

A:= sort(A, `>`): #i.e., in descending order

x:= R();

-.735125654

BinarySearch(A, x, `&<`= `>`, `&=`= ((x,y)-> abs(x-y) < .5e-5));

868278

A[%];

HFloat(-0.7351272592187323)

x:= R();

.681623130

BinarySearch(A, x, `&<`= `>`, `&=`= ((x,y)-> abs(x-y) < .5e-6));

159450

A[%];

HFloat(0.6816232246082847)

x:= R();

-.893854871

BinarySearch(A, x, `&<`= `>`, `&=`= ((x,y)-> abs(x-y) < .5e-6));

false

 

``


 

Download BinSearch.mw

 

Please use a bit more discrimination when deciding whether to make something a Post or a Question. The latter are far more common.

I tried your code up until your first error message. It works fine for me. You've not made any syntax or mathematical errors (at least up to that point). The error messages to me suggest (I'm just guessing) some sort of very weird, and serious, configuration problem. Note that the error messages spell out in some extremely verbose form exactly what you typed in: comma, lpar = left parenthesis, verbar = vertical bar, etc. I've never seen anything like it.

Are you able to perform any simple calculations with your Maple?

@permanoon123 While method= _NCrule does substantially increase the speed, its accuracy is unacceptable for this particular integral. 

@paulmcquad You had a Post (which I changed to a Question) requesting a symbol-size menu option (or perhaps you call it "bullet size" or "point size"). I guess that Post/Question got deleted. Anyway, the menu option already exists: Bring up the plot context menu, then select Symbol (7th item down in my version), then Symbol Size (bottom item), then enter a number.

Alternatively you can use the option symbolsize= in a plotting command, as shown in my Answer.

Note that my Answers (almost) always give the complete plaintext code needed to produce the results that I show, without any menu commands needed. That's because I like having reproducible results. 

@paulmcquad The equation of the perpendicular line that passes through (2, -1) is y = -7/3 + 2/3*x, not -5/3 + 2/3*x. Check your work on that, or do it with Maple (as I showed in my Answer).

In preparing my Answer, I misread the given point as (2,1) rather than (2,-1). However, the techniques of that Answer still apply; just change the point.

The best addition that you could make to your plot is adding option scaling= constrained. This makes the unit of measure on the two axes the same, thus perpendicular lines will actually appear perpendicular.

@goli Sometimes the roots of a polynomial can be expressed using sin and cos even though they can't be expressed in radicals. For example, it's easy to see that the 13 roots of x^13 - 1 are

[seq(cos(2*Pi/13*k)+I*sin(2*Pi/13*k), k= 0..12)]

although I believe that there's provably no way to put those in radical form (if I'm wrong about that, there are definitely larger denominators for which it is provably impossible).

@goli The outermost RootOf expression is degree 3, so there can't be a root with index=4. Each index applies only to the specific RootOf that it's an argument of, not to the overall system.

First 217 218 219 220 221 222 223 Last Page 219 of 709