Carl Love

Carl Love

28045 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@casperyc It doesn't matter whether you use { } or [ ]. Either one will take much too long if you try to do all the substitutions at once. The trick is to do them individually and in reverse order.

Casper wrote:

That makes me think, how do Maple actually do it in simplify(kappa, {newpar}) ? Is it done in the natural order? or 'parrellel'?

It is done in an order determined by the monomial ordering. I don't know what that order is by default. Alphabetization could have something to do with it. Studying it further might require a book on Groebner bases and/or Buchberger's algorithm.

You need to give more-detailed examples of your data. What exactly does "text1" look like? It must contain a number somehow. How exactly is the timestamp represented? It must be some sort of string, but you did not use any quotes. What is the +0000? Is that a timezone representation? Is that value ever different from +0000?

I guess that each bar in the graph represents one month. What do the different colors repesent?

There is probably a syntax error, perhaps unmatched parentheses, in one of the statements after the if and before the else. Please post the code: I can find it quicker than it took me to type this.

Are the time values evenly spaced?

Are the time values evenly spaced?

@Carl Love I should add that the functional way is not always the best way to plot a numeric integration. It can prevent Maple from being able to choose the most efficient numeric algorithm. In particular, if you have an analytic expression for the integrand, then you should not use a procedure as the integrand. You can do this:

plot(z-> Int(x-floor(x), x= 0..z), -4..4);

Jay's method of solving a differential equation and using DEplot is also a fine idea when the plotting variable is one of the limits of integration. But if the plotting variable appears as a parameter in the integrand, that can be difficult or impossible to implement.

@Carl Love I should add that the functional way is not always the best way to plot a numeric integration. It can prevent Maple from being able to choose the most efficient numeric algorithm. In particular, if you have an analytic expression for the integrand, then you should not use a procedure as the integrand. You can do this:

plot(z-> Int(x-floor(x), x= 0..z), -4..4);

Jay's method of solving a differential equation and using DEplot is also a fine idea when the plotting variable is one of the limits of integration. But if the plotting variable appears as a parameter in the integrand, that can be difficult or impossible to implement.

@N00bstyle 

[] means "take the brackets off of a set or list".

So, if L = [a,b,c], then L[] = a,b,c.

Let's go through how the parser interprets rhs(test[2][]). Index expressions associate to the left (*footnote), so the first thing is test[2]. That means the second item of list test. That item is itself a list. The [] means "take the brackets off that", leaving the equation t = number. Then the rhs selects number. In the case of test[2][1], it means "take the second item, then take the first item of that". It could also be expressed test[2,1].

*footnote: "Associates to the left" means that test[2][] is parsed the same as (test[2])[] and not as test([2][]).

Is that a sufficient explanantion?

@N00bstyle 

[] means "take the brackets off of a set or list".

So, if L = [a,b,c], then L[] = a,b,c.

Let's go through how the parser interprets rhs(test[2][]). Index expressions associate to the left (*footnote), so the first thing is test[2]. That means the second item of list test. That item is itself a list. The [] means "take the brackets off that", leaving the equation t = number. Then the rhs selects number. In the case of test[2][1], it means "take the second item, then take the first item of that". It could also be expressed test[2,1].

*footnote: "Associates to the left" means that test[2][] is parsed the same as (test[2])[] and not as test([2][]).

Is that a sufficient explanantion?

@tobsam Please post your worksheet.

@Markiyan Hirnyk Your timings and memory data are confounded by the fact that simplify is using remember tables. Here's a more accurate comparison:

(**)

f:= x^5+a*x^4+b*x^3+c*x^2+d*x+e:

(**)

st:= time():
to 10^4 do
     simplify(f, {x^3=1});
     forget(simplify)
end do:
time()-st;

7.831

(**)

st:= time():
to 10^4 do
     algsubs(x^3=1, f);
     forget(algsubs)
end do:
time()-st;

14.555

(**)

st:= time():
to 10^4 do
     rem(f, x^3-1, x);
     forget(rem)
end do:
time()-st;

7.675

(**)

macro(CTU= CodeTools:-Usage):

(**)

CTU(simplify(f, {x^3-1}));

memory used=12.90KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns

e+b+(a+d)*x+(c+1)*x^2

(**)

CTU(algsubs(x^3=1, f));

memory used=34.76KiB, alloc change=0 bytes, cpu time=0ns, real time=1000.00us

e+b+(a+d)*x+(c+1)*x^2

(**)

CTU(rem(f, x^3-1, x));

memory used=18.67KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns

e+b+(a+d)*x+(c+1)*x^2

(**)

 

 

Download algsubs_vs_rem.mw

 

@Markiyan Hirnyk Your timings and memory data are confounded by the fact that simplify is using remember tables. Here's a more accurate comparison:


(**)

f:= x^5+a*x^4+b*x^3+c*x^2+d*x+e:

(**)

st:= time():
to 10^4 do
     simplify(f, {x^3=1});
     forget(simplify)
end do:
time()-st;

11.031

(**)

st:= time():
to 10^4 do
     algsubs(x^3=1, f);
     forget(algsubs)
end do:
time()-st;

17.766

(**)

st:= time():
to 10^4 do
     rem(f, x^3-1, x);
     forget(rem)
end do:
time()-st;

10.562

(**)

macro(CTU= CodeTools:-Usage):

(**)

CTU(simplify(f, {x^3-1}));

memory used=12.90KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns

(c+1)*x^2+(a+d)*x+b+e

(**)

CTU(algsubs(x^3=1, f));

memory used=34.76KiB, alloc change=0 bytes, cpu time=0ns, real time=1000.00us

(c+1)*x^2+(a+d)*x+b+e

(**)

CTU(rem(f, x^3-1, x));

memory used=18.67KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns

(c+1)*x^2+(a+d)*x+b+e

(**)

 


Download algsubs_vs_rem.mw

@Xucu Sorry, I have no ideas about your problem.

Why not just do two substitutions, one to get rid of the W[n](t) and the other to get rid of the A?

 

pdsolve(..., numeric) is very fussy about how you put the extra equations into the system, much more so than dsolve. I can't describe precisely what makes it work; I need to play with it. So, you should post your system and say which second derivative you want.

First 632 633 634 635 636 637 638 Last Page 634 of 709