Carl Love

Carl Love

28150 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@gst There's nothing fundamentally problematic with doing what you just said. The error that you had is simply due to attempting to evaluate the truth of i < 3 for symbolic i. You could instead write

if k::numeric and k < 3 then 0 else ... fi;

That would work fine.

@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();

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