Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@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 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.

@J4James Sorry about that. We can't use diff(J(y),y) for this because it doesn't appear in the solutions. Instead, use P1 directly:

seq(eval(P1, F2[Q]((h2)/2)), Q= -3..3, ec);

@Carl Love Thanks for the Votes Up.

I didn't Answer your other Question---Why do the strings appear?---because I'm not sure of the reason. However, that is the more-important question. My first guess is that it's because the 1st row is being treated as regular data rather than column headers. You should use the optional 3rd argument of Import to exclude that 1st row. I think this may do it:

B:= ExcelTools:-Import(
    "C:/Users/Maplelover/Desktop/test.xslx",
    "Table 1",
    "A2" #Start in 1st column 2nd row
);

Let me know if that works. If it does, the headers, if they're wanted, can be imported separately.

@Spirithaunter Given the extent of my Answer, I was hoping that you could say more about how you put its information to use.

Regarding the integration on line 6: (This comment is based solely on thinking about it in my mind rather than working out the code.) I think that the integrands have simple polynomial numerators with each iteration adding the next higher order term. The integrals for the terms of each order could be cached, so each iteration would only need to integrate a single power of x over the denominator. Maple makes caching very easy.

@J4James To evaluate P1 numerically, you need a numeric value of y. For example, eval(diff(J(y), y), F2[Q](h2)).

 

@BrettKnoss A Maple series structure (which includes Taylor series) is only generated to a finite number of terms, without the general term. So there's no way to do convergence tests with those.

But for the few Taylor series that you can get via FormalPowerSeries, you can do exactly as shown above.

@Wilks Your problem is a (very simple) differential equation with initial conditions, i.e., an initial-value problem or IVP. There's no need to explicitly use any integration command or make any explicit reference to any constants of integration. The command dsolve handles all that:

restart:
dsolve(
    {diff(Y1(x), x$2) = (Ay*x-p__2*x^2/2)/E/Iz1, Y1(0)=0, D(Y1)(0)=0}
);
Y1:= unapply(rhs(%), x);

Now you can do Y1(a) for any value of a, whether numeric of symbolic.

First 147 148 149 150 151 152 153 Last Page 149 of 708