Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

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

@ You wrote:

  • Though not stated, I tried substituting dy for dx.

Yes, most definitely "not stated". I suggested changing x to y in dx, not changing dx to dy. Apparently, it will allow you to change the "d". I think that that should be considered a bug; it shouldn't be allowed.

I have no trouble computing a double integral of a product of functions. In the link below, I compute

f(x,y):= x*sin(y);
g(x,y):= y*cos(x);
int(int(f(x,y)*g(x,y), x= 0..y), y= 0..Pi/4);

following the simple steps I originally described.

https://learn.maplesoft.com/index.html#/?d=EJKMAUGQFPAUOKGKDKKGAUBNBILLFNLFCPBFLONTOQLIFFLULUFMDUDTGKCMIUDMMGGTEUBHNKHJAPCPGSJPHMPMHIMLEKLIJRMR

 

@Wilks The code that I posted above will work for any certain x, numeric or symbolic, so I'm not sure what you mean by "still experiencing problems". Are you simply asking why your original formulation didn't work and why it gave the error message that it did?  Okay, here's your original Y1:

Y1 := x-> int(`Y1"`(x), x)+C1

Thus, Y1(0), before it's fully evaluated, is int(`Y"`(0), 0)+C1. Does that make any sense to you, to perform an integration using 0 as the variable of integration? In other words, you're trying to use the bound variable x (a variable that cannot be arbitrarily replaced by a value) as if it were a free variable (a variable that can be replaced by a value). There are several solutions to this order-of-evaluation problem. The way that chose was to use intat instead of int because intat is specifically intended for this situation. The other solutions are much-more-general techniques for addressing order-of-evaluation problems, and Maple has many of them. One of them is unapply, as shown by Kitonum. If for some reason my intat solution is inadequate for you, I'll post one of these other techniques.

@Kitonum Maple Learn is a web-browser-based calculator. Go to learn.maplesoft.com/#/ or simply follow the link in my Answer above.

@acer Yes. I based my Answer on the OP's exposition alone; I didn't read or execute their code.

Regarding "persistent store": This slightly awkward and confusing phrase simply refers to the existence of Maple's "library" or "archive" system. The warning should probably be reworded to "Warning: readlib is deprecated; Maple archives make it obsolete", or, with a bit of humor, "Warning: readlib has been deprecated; Maple's brand-new archive system makes it obsolete, although harmless".

First 148 149 150 151 152 153 154 Last Page 150 of 709