dharr

Dr. David Harrington

9207 Reputation

22 Badges

21 years, 303 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@Paras31 Your routine gets 0.3752737697 instead of 0.375077. Your s range is different so this is not an exact comparison, but in any case are you saying you are sure MMa is more accurate?

@Paras31 It is hard to say since I haven't followed in detail the two methods. I assume they are both approximations, so do you have some reason to think one is closer to the real solution? Have you benchmarked for a system for which you know the real solution? Can you improve the approximation, e.g., why is one integral from -5..5? is that adjustable?

First of all, I think you need to do an exact comparison (overlaid plots) or accurate comparisons at selcted points. Is there good accuracy for some x/t regimes?

@Paras31 In the first plot, where I think all the numbers are supposed to be 1 you have the worst point at 1.00000025, so the error is actually better that 0.001 (which I assume is worst case). For a plot with numbers of the order of one, I doubt whether you could visually tell 1.001 from 1. To me all the plots look essentially the same, so who could tell? Of course you may want to use epsilon = 1e-3 to speed things up and then use more accuracy in a final publication/presentation/etc.

For other than plots you might want more accuracy if you are going to use the results in further calculations. But even then you can do some faster, less accurate calculations in the preliminary stages and then require more accuracy for the final values of interest.

@wingho This is giving a 404 file not found error. Please try again - use the green up arrow; select the file; choose file upload and then choose insert link.

@acer Yes, for epsilon = 1e-3 it is about a factor of 2 speedup (on the slowest final calculation).

third_try.mw

@Paras31 Your plot was missing adaptive=false. The double seq did 6*10 calculations, each 9 s, for a total expected time of 9 minutes and it took 7 min, so you just had to wait longer.

third_try.mw

@Alfred_F Thanks. Changed to maximize.

@Rouben Rostamian  Yes, my plot (and calculation) are wrong. If I change the plot range to 0..40 rather than 0..x__max, I see the plot doesn't come down to the axis; Maple seemed to add a phantom point  in the 0..x__max case. So I see my mistake, and with a recalculated mu to make the plot to come to the axis I get the same value as you did. I've updated my answer and left the other one there for the record.

Thanks!

@Rouben Rostamian  I look forward to it; see what I got wrong. Edit: I figured it out.

@Paras31 If I look at integrand1, you have i; presumably i in exp(i*k*x) is supposed to be I=sqrt(-1), but in k1 you have I for sqrt(-1) and i interpreted as I. In k2 you have i interpreted as i. You need to use one or the other as sqrt(-1) - if using i, then you need to use interface(imaginaryunit=i).

@janhardo Thanks. I solved just the top part, for which the fence length is 50 m, so total fence length, top and bottom is 100 m. I've edited to clarify.

@Alfred_F Thanks; that's clear. (I was confused about why the buyer wanted to spend more money.)

I'm confused. The cost is Int(x*y(x), x=0..xmax) and the area is Int(y, x=0..xmax) and the fence length is L. So the cost and L are fixed and the area is to be maximized? ("most expansive"), or did you mean the cost is to be maximized for a given L ("most expensive") (as @janhardo seems to have assumed).

@C_R I think your red-circled green one should be yellow, not green - it is the outer integral integration variable.

Download RootOf.mw

@Jean-Michel 

Here is the excerpt from the file:

Do you agree? Because when I asked about this sequence starting with [1,2,7,...] you said no: "No Dharr I refer EXACTLY to the sequence given in the webpage I pasted here."

If I try these commands in Maple 2026, it works exactly as above:

restart

interface(version)

`Standard Worksheet Interface, Maple 2026.0, Windows 11, March 05 2026 Build ID 2001916`

intseq := [1, 2, 7, 23, 85, 314, 1207, 4682, 18493, 73688, 296671, 1202849, 4910689, 20158436, 83169871, 344628527, 1433631973, 5984532728, 25060514887, 105240685511, 443102517025, 1870054761632, 7909539602647, 33521289826778, 142330494633985, 605375433105734, 2578988979186127, 11003364185437517];

[1, 2, 7, 23, 85, 314, 1207, 4682, 18493, 73688, 296671, 1202849, 4910689, 20158436, 83169871, 344628527, 1433631973, 5984532728, 25060514887, 105240685511, 443102517025, 1870054761632, 7909539602647, 33521289826778, 142330494633985, 605375433105734, 2578988979186127, 11003364185437517]

From this sequence, the underlying recurrence can be obtained and solved:

rec := LREtools:-GuessRecurrence(intseq, q(n));

(n+4)*q(n+3)+(-7*n-25)*q(n+2)+(-n+14)*q(n+1)+(55*n+55)*q(n) = 0

NULL

NULL

Download test.mw

If I try the sequences in your original question, they both give FAIL as you found, which I believe is because Maple cannot solve them.

3 4 5 6 7 8 9 Last Page 5 of 104