tsunamiBTP

292 Reputation

9 Badges

15 years, 261 days

MaplePrimes Activity


These are replies submitted by tsunamiBTP

@tomleslie @acer

I meant Sum not sum.

@acer 

OK, I used the evalhf command to operate on my expression for S5?  I wanted to see the effect on S5 as compared to Sac.  The results are the same.  So why the insistence on using add over sum?  I do not see the difference other than add requires m to be defined whereas sum does not.

@acer 

CodeTools:-Usage is not available on MAPLE 12 so I cannot get your code to run.  Can you convert it to MAPLE 12?

By the way, the approach I have used & what you have attempted to show seems to be a AD HOC way to find the answer.  Is there a more appropriate way to find the limit of the series & determine the accuracy of the significant figures?  So far I have had no success of getting the @limit tool to yield anything useful.

This may not be the proper answer, but it allowed me to answer my question to within 5 significant figures.  Instead of using the ACTIVE sum command the INERT Sum command imposes very little on the memory.  Using the evalf command then can evaluate the series with a much larger number of terms, see the link below:

seeking_the_limit.mw

If anyone has another approach I would like to see it.

@tomleslie 

I did try the add command, but it crashed & the memory burden was the cause.  Your worksheet also has significant memory cost as compared to my answer & I ran your worksheet on my computer & MAPLE crashed as well.  You obviously have more memory than what I have.

By the way, why did you demote my answer to a simple reply?  In terms of memory cost my answer outperforms yours.  Try it.  In fact, take m=10^8.  I can do it with my worksheet with a memory cost of only 6Mb.. 

 

 

It was 

Ck is fine.

I need to be careful when cutting & pasting from 1 doc to another.

 

@vv @tomleslie

Both of you have pointed out in different ways that Q1 is clearly periodic; hence, would the roots also be periodic?  Inspection of the plot that @tomleslie provided in his post depicts this periodic behavior.  Periodicity suggests an analytic solution?  I pose this as a question, not a statement.

The root of criticality is actually the very 1st one after the Q1 spike which repeats itself.  Can this somehow be resolved analytically instead of numerically?  Sorry for beating the drum incessantly, but sometimes that has to be done.

I look 4ward to your remarks or any ideas how to obtain an analytic solution.

 

@vv 

Given your input I need to find another way to establish what I am seeking, unless  accept numerical computations.

@tomleslie 

I believe my case fits all of these critrea.  Nonetheless, you are suggesting the solutions can only be resolved numerically, not analytically?

I hope you are WRONG, but I I cannot dispute anything you are espousing, at least at the moment.

@tomleslie 

I believe I follow you somewhat.  I am sort of understanding that if the value of the parameters are not defined a priori then MAPLE must assume some starting point to converge on solutions.  If that starting point is arbitrarily chosen then you can end up elsewhere.  Nonetheless, on my latest posting to this thread Even more peculiar behavior with solve the 2 roots for the solve command in results (6) & (7) do not correlate with any one of the roots for the RootFinding command.  I even narrowed the range for RootFinding to see if I could even generate the 2 roots solve yields & could not get any concurrence.  I should at least be able to do that if those 2 roots are correct.  Does this mean solve is generating incorrect results?

3) Is there a way for the RootFinidng package to express the solutions analytically?

No! RootFinding generates numerical solutions

You have a choice - decide exactly what you want.

Numerical solutions for your problem are trivial to generate. A complete listing of corresponding analytic solutions is (probably?) unobtainable, although you are free to spend the rest of your life lookng for them.

My thoughts on this was that my series is well behaved enough to obtain anayticial solutions in terms of the system parameters.  Hence, I could then substitute in values afterward & know what the roots are for any situation.  Are you suggesting in this particular case that this is TOO ambitious?

Examine results (6)(7), & (8).  It appears the solve command will give different results depending on where the command is invoked in the process.  There are 3 different results for evalf(ysolns,10).  The 1st before parametric values are assigned, then immediately after, & then after reevaluating ysolns2.

I do not understand what solve is doing!  I sort of understanding that if the value of the parameters are not defined a priori then MAPLE must assume some starting point to converge on solutions, but what is being output is very disturbing.  At least the RootFinding command seems to generate correct results, but they are numeric which requires the parameters be defined, correct?

reconcile_solns.mw

 

 

@tomleslie 

The question is about the solve command?  You used the RootFinding as did I.  Perhaps it was your response to my EARLIER & DIFFERENT question that provoked me compare the results of the 2.

Anyway, what you have above does not answer the question in this posting.

I will be more specific:

1) Why does solve & RootFinding not concur in the case of chek?

2) solve seems to overlap the RootFinding solutions ONLY AFTER definition to the parameter values are specified, why is that?

3) Is there a way for the RootFinidng package to express the solutions analytically or symbolically whatever choice of words you choose?

@Carl Love 

I thought I tried this already, BUT I tried again & it worked!!!!

This is what I wanted, THANXXXXX

I obtained this from List of lists.  This is not exactly what I had envisioned.  I assumed the sort command could handle complex numbers by applying some sort of argument as an option.  It appears that it cannot.  So with guidance list pairs are created containing magnitude & argument information & the sort is executed on the magnitude component.  Then in the end the list needs to be converted back to a+ib form.  I am not sure how to do that.  Perhaps someone has some input on how to convert back?  (Actually this is not necessary.  @Carl Love got the sort command to do the job)

It is not a 1 liner, but it is shorter than the other answer, I guess.  Is there not a command option that can sort complex numbers in MAPLE?  MATLAB has one!


 

S3 := -(1/2*I)*(-(2*I)*exp(I*Pi*k*tau/T)*Pi*k-exp(I*Pi*k*tau/T)*T+I*exp(I*Pi*k*tau/T)*Pi*k*tau+(4*I)*Pi*k-(2*I)*exp(-I*Pi*k*tau/T)*Pi*k+exp(-I*Pi*k*tau/T)*T+I*exp(-I*Pi*k*tau/T)*Pi*k*tau)*sin(2*Pi*k*x/T)/(Pi^2*k^2);

-((1/2)*I)*(-(2*I)*exp(I*Pi*k*tau/T)*Pi*k-exp(I*Pi*k*tau/T)*T+I*exp(I*Pi*k*tau/T)*Pi*k*tau+(4*I)*Pi*k-(2*I)*exp(-I*Pi*k*tau/T)*Pi*k+exp(-I*Pi*k*tau/T)*T+I*exp(-I*Pi*k*tau/T)*Pi*k*tau)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

(1)

S3 = ((-I)*(1/2))*((I*Pi*k*tau-(2*I)*Pi*k)*(exp(I*Pi*k*tau/T)+exp(-I*Pi*k*tau/T))-T*(exp(I*Pi*k*tau/T)-exp(-I*Pi*k*tau/T))+(4*I)*Pi*k)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

S3 = -((1/2)*I)*((I*Pi*k*tau-(2*I)*Pi*k)*(exp(I*Pi*k*tau/T)+exp(-I*Pi*k*tau/T))-T*(exp(I*Pi*k*tau/T)-exp(-I*Pi*k*tau/T))+(4*I)*Pi*k)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

(2)

"(->)"true"(->)"true

Despite the the simplifications MAPLE generated above MAPLE does not recognize the expressions as being equivalent.  So set the following for the Fourier coeffs:NULL

Ck := (-I*((2*(I*Pi*k*tau-(2*I)*Pi*k))*cos(Pi*k*tau/T)-(2*I)*T*sin(Pi*k*tau/T)+(4*I)*Pi*k))*(1/(2*Pi^2*k^2))

-((1/2)*I)*(2*(I*Pi*k*tau-(2*I)*Pi*k)*cos(Pi*k*tau/T)-(2*I)*T*sin(Pi*k*tau/T)+(4*I)*Pi*k)/(Pi^2*k^2)

(3)

The Fourier series can now be expressed as a 1 sided series employing both the Sum vs sum vs add commands for comparison:``

S5 := proc (m, x) options operator, arrow; a[0]+sum(Ck*sin(2*Pi*k*x/T), k = 1 .. m) end proc;

proc (m, x) options operator, arrow; a[0]+sum(S3, k = 1 .. m) end proc

(4)

with(RootFinding);

1.231189196+0.5710560398e-1*I

(5)

Q2 := diff(apply(S5, m, x), x):

.5174192336, .4263206748, .1742431404, .8604323288-0.5013693232e-1*I, 1.139355146, 1.331216372, 1.522541961, 1.713598260, 1.904543046, .8604323288+0.5013693232e-1*I

(6)

Y2 := RootFinding:-Analytic(chek2, re = -2 .. 2, im = -2 .. 2);

1.5225419633592, 1.1393551457591, 1.7135982482614, 1.3312163723762, 1.9045430721348, .51741923262340, .42632067761395, .86043232910145-0.50136932346075e-1*I, .17424313716700, -.51741923262335, -.42632067761395, -.86043232910145-0.50136932346065e-1*I, -.17424313716700, -1.5225419633592, -1.1393551457591, -1.7135982482614, -1.3312163723762, -1.9045430721348, -.86043232910145+0.50136932346075e-1*I, .86043232910145+0.50136932346075e-1*I

(7)

Y[1];

.8604323288+0.5013693232e-1*I

(8)

sort([Y]);

[1.522541961, 1.139355146, .8604323288-0.5013693232e-1*I, 1.904543046, .5174192336, .4263206748, .1742431404, 1.713598260, 1.331216372, .8604323288+0.5013693232e-1*I]

(9)

evalf[10](sort([Y2]));

[1.522541963, 1.904543072, -1.713598248, -1.139355146, .8604323291-0.5013693235e-1*I, 1.331216372, -.8604323291+0.5013693235e-1*I, -1.904543072, 1.139355146, -1.522541963, .4263206776, .1742431372, -1.331216372, -.1742431372, .5174192326, -.4263206776, -.5174192326, 1.713598248, .8604323291+0.5013693235e-1*I, -.8604323291-0.5013693235e-1*I]

(10)

L2 := map(proc (x) options operator, arrow; [abs(x), argument(x)] end proc, [Y]);

Matrix([[.1742431404, 0.], [.4263206748, 0.], [.5174192336, 0.], [.8618918171, 0.5820365198e-1], [.8618918171, -0.5820365198e-1], [1.139355146, 0.], [1.331216372, 0.], [1.522541961, 0.], [1.713598260, 0.], [1.904543046, 0.]])

(11)

 

Y3 := evalf(L4(1 .. 10, 1)*cos(arctan(L4(1 .. 10, 2))));

arctan(L4(1 .. 10, 2))

Error, invalid input: arctan expects its 1st argument, y, to be of type algebraic, but received Vector(10, {(1) = 0., (2) = 0., (3) = 0., (4) = 0.5820365198e-1, (5) = -0.5820365198e-1, (6) = 0., (7) = 0., (8) = 0., (9) = 0., (10) = 0.})

 

S7 := S5(10, x); -1; xmax := fsolve(evalf(diff(S7, x)), x = 0 .. 1/5); 1; ymax := evalf(eval(S7, x = xmax)); 1; (ymax-1)*(1/2)

-0.14467123e-2

(12)

forget(evalf); 1; S7 := S5(10000, x); -1; X := evalf[10](sort([RootFinding:-Analytic(diff(S7, x), re = 0 .. 1/1000, im = -0.1e-2 .. 0.1e-2)])); 1; peak := evalf(eval(S7, x = X[1])); 1; (peak-1)*(1/2)

0.893898970e-1

(13)

RootFinding:-Analytic(diff(S7, x), re = 0 .. 1/1000, im = -0.1e-2 .. 0.1e-2)

0.99985001928365e-3, 0.59991001158205e-3, 0.40001999972866e-3, 0.19997000386265e-3, 0.80003999946915e-3

(14)

``


 

Download reconcile_solns.mw

 

@tomleslie 

Cannot the same thing be done using the sort command?  I am having trouble getting the proper syntax & keep getting the errors shown below.  I did use the sort command on the RootFinding command which you utilized in your worksheet.  For some reason the sort command is not listing the roots in proper order as well. (see below)

I would think if the sort command is used properly only 1 line is required whereas, your routine took a number of lines.


 

S3 := -(1/2*I)*(-(2*I)*exp(I*Pi*k*tau/T)*Pi*k-exp(I*Pi*k*tau/T)*T+I*exp(I*Pi*k*tau/T)*Pi*k*tau+(4*I)*Pi*k-(2*I)*exp(-I*Pi*k*tau/T)*Pi*k+exp(-I*Pi*k*tau/T)*T+I*exp(-I*Pi*k*tau/T)*Pi*k*tau)*sin(2*Pi*k*x/T)/(Pi^2*k^2);

-((1/2)*I)*(-(2*I)*exp(I*Pi*k*tau/T)*Pi*k-exp(I*Pi*k*tau/T)*T+I*exp(I*Pi*k*tau/T)*Pi*k*tau+(4*I)*Pi*k-(2*I)*exp(-I*Pi*k*tau/T)*Pi*k+exp(-I*Pi*k*tau/T)*T+I*exp(-I*Pi*k*tau/T)*Pi*k*tau)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

(1)

S3 = ((-I)*(1/2))*((I*Pi*k*tau-(2*I)*Pi*k)*(exp(I*Pi*k*tau/T)+exp(-I*Pi*k*tau/T))-T*(exp(I*Pi*k*tau/T)-exp(-I*Pi*k*tau/T))+(4*I)*Pi*k)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

S3 = -((1/2)*I)*((I*Pi*k*tau-(2*I)*Pi*k)*(exp(I*Pi*k*tau/T)+exp(-I*Pi*k*tau/T))-T*(exp(I*Pi*k*tau/T)-exp(-I*Pi*k*tau/T))+(4*I)*Pi*k)*sin(2*Pi*k*x/T)/(Pi^2*k^2)

(2)

"(->)"true"(->)"true

Despite the the simplifications MAPLE generated above MAPLE does not recognize the expressions as being equivalent.  So set the following for the Fourier coeffs:NULL

Ck := (-I*((2*(I*Pi*k*tau-(2*I)*Pi*k))*cos(Pi*k*tau/T)-(2*I)*T*sin(Pi*k*tau/T)+(4*I)*Pi*k))*(1/(2*Pi^2*k^2))

-((1/2)*I)*(2*(I*Pi*k*tau-(2*I)*Pi*k)*cos(Pi*k*tau/T)-(2*I)*T*sin(Pi*k*tau/T)+(4*I)*Pi*k)/(Pi^2*k^2)

(3)

The Fourier series can now be expressed as a 1 sided series employing both the Sum vs sum vs add commands for comparison:``

S5 := proc (m, x) options operator, arrow; a[0]+sum(Ck*sin(2*Pi*k*x/T), k = 1 .. m) end proc;

proc (m, x) options operator, arrow; a[0]+sum(S3, k = 1 .. m) end proc

(4)

with(RootFinding);

1.231189196+0.5710560398e-1*I

(5)

Q2 := diff(apply(S5, m, x), x):

.5174192336, .4263206748, .1742431404, .8604323288-0.5013693232e-1*I, 1.139355146, 1.331216372, 1.522541961, 1.713598260, 1.904543046, .8604323288+0.5013693232e-1*I

(6)

Y[1];

.8604323288+0.5013693232e-1*I

(7)

sort([Y]);

[1.522541961, 1.139355146, .8604323288-0.5013693232e-1*I, 1.904543046, .5174192336, .4263206748, .1742431404, 1.713598260, 1.331216372, .8604323288+0.5013693232e-1*I]

(8)

evalf[10](sort([RootFinding:-Analytic(chek2, re = -2 .. 2, im = -2 .. 2)]));

[1.522541963, 1.904543072, -1.713598248, -1.139355146, .8604323291-0.5013693235e-1*I, 1.331216372, -1.904543072, -.8604323291+0.5013693235e-1*I, 1.139355146, -1.522541963, .4263206776, .1742431372, .8604323291+0.5013693235e-1*I, -1.331216372, -.1742431372, .5174192326, -.4263206776, -.5174192326, 1.713598248, -.8604323291-0.5013693235e-1*I]

(9)

sort([Y], ascending)

Error, sort: 2nd argument must be a function that always returns true or false

 

sort([Y], is(x > y), ascending);

Error, invalid arguments to sort

 

sort([Y], x > y, proc (x, y) options operator, arrow; evalf(x-y) < 0 end proc)

Error, invalid arguments to sort

 

sort([Y], x > y, proc (x, y) options operator, arrow; abs(x[1]) < abs(y[1]) end proc)

Error, invalid arguments to sort

 

sort([Y], numeric)

Error, invalid arguments to sort

 

sort([Y], `>`)

Error, invalid arguments to sort

 

sort([Y], order = plex(x), ascending)

Error, invalid arguments to sort

 

S7 := S5(10, x); -1; xmax := fsolve(evalf(diff(S7, x)), x = 0 .. 1/5); 1; ymax := evalf(eval(S7, x = xmax)); 1; (ymax-1)*(1/2)

-0.14467123e-2

(10)

forget(evalf); 1; S7 := S5(10000, x); -1; X := evalf[10](sort([RootFinding:-Analytic(diff(S7, x), re = 0 .. 1/1000, im = -0.1e-2 .. 0.1e-2)])); 1; peak := evalf(eval(S7, x = X[1])); 1; (peak-1)*(1/2)

0.893898970e-1

(11)

RootFinding:-Analytic(diff(S7, x), re = 0 .. 1/1000, im = -0.1e-2 .. 0.1e-2)

0.99985001928365e-3, 0.59991001158205e-3, 0.40001999972866e-3, 0.19997000386265e-3, 0.80003999946915e-3

(12)

``


 

Download reconcile_solns.mw

 

1 2 3 4 5 6 7 Last Page 2 of 12