Carl Love

Carl Love

28150 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@nm The majority of the code in my procedure above is to compensate for Matlab's weird argument order. The argument X is optional; if it appears, it comes before the required argument Y. The sensible way to do it is to put optional arguments after required arguments.

What options are there other than the third argument, dim?

@gst All I can say about that is "Of course it doesn't work. How could you possibly expect it to work?" The procedure divide5 requires its parameter k to be passed a numeric value, yet you've passed it symbolic i. In order to give you a better answer, I need to know what you want the output of divide5(f,i) to be.

@Kitonum Note that pi and ithprime are inverse functions, so pi(p) = q - pi(q) implies p = ithprime(q - pi(q)). Thus, by making the outer loop iterate on q, the corresponding p (if it exists) can be found in one step, without needing an inner loop. This is many times faster than your double-loop method.

@mmcdara I really like your use of *ML. Your use of parse and double quotation marks is redundant and can be replaced by

code:= (k,N)-> cat(`#mrow(mfrac(mo(`, k, `),mo(`, N, `)))`);

@BrettKnoss I guess that you have an older Maple version than I do. Try this:

restart:
s:= convert((x-1)/(x+2), FormalPowerSeries);
S:= subsindets(s, specfunc(Sum), s-> Sum(op(s), formal= false));
for x in [-2,2] do evalf(S) od;

If the above works for you, then we're okay. If it doesn't, please post the full worksheet of the above as an attached file. Use the green uparrow on the toolbar to attach a file.

@BrettKnoss This is a bit tricky because Maple seems quite reluctant to detect and/or report oscillatory divergence. But it can be done:

(evalf@eval~)(
    subsindets(s, specfunc(Sum), s-> Sum(op(s), formal= false)),
    x=~ [-2, 2]
);
              [-Float(infinity), Float(undefined)]

Which shows divergence at both 2 and -2.

@BrettKnoss Okay:

restart:
AddPlot:= (p, P)-> plots:-display(P, p, _rest):
f:= (x-1)/(x+2):
d:= discont(f,x):
P:= plot(f, x= -3..3, discont, view= [-3..3, -5..5]):
P:= AddPlot(
    plot([seq]([[t,-5],[t,5]], t= d), linestyle= dash, color= cyan),
    P
):
P:= AddPlot(
    plottools:-circle([0,0], 1, color= blue),
    P,
    scaling= constrained
);

@David Sycamore Change k <= n to k < n. Sorry for the confusion. I corrected the code above.

@mmcdara You should use the discont option for the plot of the rational function to avoid the appearance of the asymptote (which is a floating-point artifact, not a part of the plot).

@Spirithaunter Thank you: Your response is now sufficiently detailed. Let me know if you have any further questions. 

Just a reminder: Calling a Maple procedure with fewer arguments than its number of declared parameters is not necessarily an error. Although, I do understand why you'd still want mint to notify you of it.

@Wilks Replace the restart with Y1:= 'Y1'. If that doesn't fix the problem, post the entire worksheet. 

@ActiveUser Maple has no inherent limitations on the size of objects stored in text files. If L is your list, you can do

save L, "file.txt";

where "file.txt" is any appropriate filename on your system. 

@Kitonum Although what you say about choosing from a finite set is true (on any computer system), the range needn't be explicitly specified, and can effectively be made infinite like this: 

Rand:= ()-> tan(rand(evalf(-Pi/2) .. evalf(Pi/2))()):
a_1:= Rand();

Tickmarks of any number of lines can be created by inserting newline characters (`\n`) into symbols created with nprintf. The same is true for any of the string or symbol components of a plot. For numeric fractions, it's a bit tricky to do this simply because varying character widths make it difficult to get the centering perfect. But it works perfectly for left-justified text.

Here's your fractions example done this way:

`print/%/`:= (n,d)->
local ln:= length(n), ld:= length(d), m:= 2*max(ln,ld);
     cat(
         ` `$iquo(m-ln, 2),
         nprintf("%d\n", n), 
         `-`$m, `\n`, 
         ` `$iquo(m-ld, 2),
         nprintf("%d", d)
     )
:
plot(
    sqrt(x) - 0.5, 
    x= 0..10, 
    xtickmarks= (
        [seq](2..8, 2)=~ 
            `%/`~([123, 456, 789, 101112], [seq](1900..1960, 20))
    ), 
    axesfont = [TIMES, BOLD, 10]
);

I'm not suggesting that this is a great way to do this for numeric fractions. I'm saying that's it's good to keep in mind for arbitrarily complicated multi-line ticks that have a string representation.

First 149 150 151 152 153 154 155 Last Page 151 of 711