tomleslie

13876 Reputation

20 Badges

15 years, 175 days

MaplePrimes Activity


These are replies submitted by tomleslie

The Excel formula I originally provided was:

A[i]-A[i-1])*(B[i]+B[i-1])/2, which translates as bin-width multiplied by average bin value

This generates a "bin area": then bin areas should be summed. Why you want to divide this simple sum of areas by 'N' (whatever 'N' is) defeats me - but will, of course, lead to an incorrect answer, if 'N' is anything other than 1.

I have lost all interest in "naming" this method. A couple of texts I have now consulted did not agree with each other, and neither (really?) agreed with the WIkipedia article on Riemann sums.

@Markiyan Hirnyk 

What I suggested is (strictly speaking) a mid-point Riemann Sum.

See https://en.wikipedia.org/wiki/Riemann_sum

Let f : DR be a function defined on a subset, D, of the real line, R. Let I = [a, b] be a closed interval contained in D, and let

be a partition of I, where

A Riemann sum of f over I with partition P is defined as

Notice the use of "a" instead of "the" in the previous sentence. This is due to the fact that the choice of in the interval is arbitrary, so for any given function f defined on an interval I and a fixed partition P, one might produce different Riemann sums depending on which is chosen, as long as holds true.

In the definition of a Riemann Sum there is no requirement that the partition P of the closed interval l should have equal intervals - although this additional condition does make topics such as comparison of left sums, right sums, midpoint sums and error analysis much easier (as the rest of the Wikipedia article makes clear)

Equal spacing is not required.

What I suggested was an implementation of the rectangle method - see https://en.wikipedia.org/wiki/Rectangle_method.

I should not have called it Simpson's method

 

Let's see if I have this straight

  1. Problem is reported by userA on MaplePrimes
  2. Problem is confirmed by userB on MaplePrimes
  3. MaplePrimes userB supplies MaplePrimes userA with workaround
  4. MaplePrimes userB reports problem to Maple Technical Support (UK)
  5. Maple Technical Support (UK) suggests MaplePrimes userB runs a set of diagnostic tests: disable security, rollback drivers, hand-hack Maple's launch.ini etc etc and report all results to Maple Technical Support.
  6. MaplePrimes userB spends a couple of hours reconfiguring system, running requested diagnostic checks and reporting results to Maple Technical Support
  7. Maple Technical Support concludes that there is a problem - because it has been reported on reddit!!!!!!

Relatively easy to produce the values you require. See the attached

ode2.mw

However even in this worksheet I have only managed to get dsolve() to converge with an abserr of 1e-03, by increasing maxmesh to 4096. So although the last execution group will generate 13digit data - I would doubt the accuracy of anything more than the first four digits.

You can try decreasing abserr in powers of 10, and increasing maxmesh in factors of 2 to obtain higher levels of accuracy - but I very much doubt you will see accuracy of 10^-13

I have just "rolled" back my Nvidia drivers to the previously installed version (which in my case happened to be Version 21.21.13.7633, dated 11/12/2016)

Both Maple 2015.2 and Maple 2016.2 are now running again

So problem is definitely an interaction between the Maple javaw.exe and Nvidia's latest driver set

I'll still be calling Maple technical support tomorrow to see if they can produce a fix, which is better than "freezing" the Nvidia driver set!!

I have done the whole uninstall/reinstall cycle on Maple 2016 ( a couple of times) and it makes absoulutely no difference. So don't get "hung-up" on doing thhis!

For me the important point is that my Maple2015 installation is also now broken, and this hasn't been touched in a couple of years. I only keep it around so that I can check for possible discrepancies between Maple 2015 and 2016 when answering questions on this forum. So no Maple  "update" broke my 2015 version!!

Hence my suspicion about the Nvidia driver update

I too had this problem late on Friday and (so far) haven't been able to fix it.

Trying to start Maple 2016.2,, I get a popup saying

           "Java(TM) Platform SE binary has stopped working"

I get the same error message when I try to start Maple 2015.1. So, like you I now have both Maple 2016 and 2015 failing to start. Interestingly(?) my Maple18 installation is still running.

In case it is relevant, my OS is Windows 7, 64-bit, Home Premium - what's yours?

In my case the windows eventLog shows (highlighting mine)

Faulting application name: javaw.exe, version: 8.0.1020.14, time stamp: 0x576af3f4
Faulting module name: nvSCPAPI64.dll, version: 7.17.13.7849, time stamp: 0x588218a5
Exception code: 0xc0000409
Fault offset: 0x0000000000034b2f
Faulting process id: 0x1b1c
Faulting application start time: 0x01d27953c1db3e4a
Faulting application path: C:\Program Files\Maple 2016\jre\bin\javaw.exe
Faulting module path: C:\Program Files (x86)\NVIDIA Corporation\3D Vision\nvSCPAPI64.dll
Report Id: 018fbe60-e547-11e6-a80f-c86000bd29c7

So. pretty much identical to yours - including the fact that the "faulting module" is part of my Nvidia driver package (as is yours). My graphics card is a 2047MB NVIDIA GeForce GTX 680, and at some point in the past few days, I did update the drivers for this card.

According to GEForce Experience, I'm currently running the GEForce GameReady Driver Version 378.49, Release date 24/01/2017). According to my Windows system management tools, I'm currently running driver version 21.21.13.7849 dated 20/01/2017.
Which NVidia driver version are you running and have you updated it recently???

Given that neither Maple 2015 nor 2016 now works on my machine, I was assuming that the source of the problem was more likely to be the Nvidia driver update - or at least the interaction between Maple's javaw.exe, and this particular graphics driver version.

My "plan of action" is to contact Maple's Technical Support on Manday (morning, UK time). I pay for their "Extended Maintenance Plan", so I might as well see if I can get some "maintenance" The fact that my Maple 18 installation still seems perfectly functional) means that this is not a time-critical exercise for me, so depending on the response from Maple technical support, I *might* either continue using Maple 18 or attempt a driver rollback on my graphics card (haven't done one of those in years!)

Any further relevant info you can post on this problem, such as

OS
Graphics Card
Graphics Driver version
Recent graphics driver updates (if any)

would be very helpful in tracking down the problem - because I have the suspicion that this one isn't going to be easy to fix!

If I type

restart;
with(Units[Standard]);
c:=3e8*Unit(m)/Unit(s);
Ec:=1*Unit(J);
Ec*c;

Then Maple returns 3.*10^8*Unit('m'^3*'kg'/'s'^3) - only formatted more prettily. So what exactly is the problem?

Your original post was clear and concise - which is why I was able to provide an answer. I'm prepared to admit that a better answer would have been an analytic solution for your integral, but I could not find one, so I suggested that if a numerical answer was acceptable, then it could be easily determined.

However I had no idea what you were trying to achieve with the worksheet in your second post. I have just re-read it and tried to figure it out again - but I still get absolutely nowhere.

There are two possibilities

  1. I am remarkably stupid
  2. The intent of your worksheet is remarkably unclear

Feel free to pick one of the two options above.

I am reasonably sure that if you could explain what it is that you want, then I can provide it - but if I can't figure out what you want then ......

I have attached my "working version" of your sheet.

integral2.mw

Definition of a "working version"

When posters provide a 'non-functioning' worksheet, I tend to go through it "tidying things up". This is a diagnostic process which helps me figure out what might be wrong and involves many steps, such as

  1. Remove or comment out any bits of code which don't seem to be used for anything
  2. Rewrite any bits of code where the intent is clear but the implementation is "doubtful"
  3. Add comments to remind myself exactly what certain pieces of code actually do (and possibly indicate to myself why they might fail under certain circumstances)

Following this process I am usually left with something which either "sort of " works or which requires further clarification from the poster. But in your case, there are no syntax errors, no obvious logical errors, and OK, a few bits of code which seem to be completely superfluous. So there is nothing "wrong" with this code - it just doesn't seem to do anything vaguely "useful"

Since I have absoultely no idea what you are trying to achieve, I can't fix anything!!

Is there any syntax to simplify withhout doing it 111 times? thanks

I see no way to simplify this sum/add operation. Each term in the summand depends on a different, numeric value from the Array 'qtopi', so there is no way that an individual term in the summand can be related to any other term in the summand - unless the values in the Array 'qtopi' are related in some way, which I assume they are not!

I wouldn't get hung up on the fact that you have a sum/add with 111 terms. Maple calculates these really quickly, so why worry - so long as you remember to terminate the sum/add command with a colon (ie ':') rather than a semicolon (ie ';') so that you don't get a lot of output you don't want to see clogging up your display!

#############################################################################

vlist := convert(`union`*map*(indets, constr, 'name')[], list)

I did not supply this code! The code in the worksheet I supplied, was (ignoring the indentation in my original)

 vlist:=convert( `union`( map( indets, constr, 'name' )[] ),list );

Notice that your version has asterisks (ie '*') before and after the 'map' keyword, and is missing an opening parenthesis (ie `('  prior to the 'map' keyword. It is also missing the balancing closing parenthesis after the '[]' characters.

I'm going to make a total guess about why your syntax does not agree with my original which is -  you are using Maple's 2-D input mode. My original was written in Maple's 1-D input mode. So maybe you copied my 1-D input code to a position where it was "automatically converted" to 2-D input code, and something went wrong in the conversion process :-(

I have no interest in getting into an argument about the relative merits of using 1-D input or 2-D input modes. I personally  will always use 1-D input mode, simply because the extra step of parsing from from 2-D input, to 1-D input, and then executing the result introduces an extra (sometimes error-prone) step which I don't need/want. You are free to choose whichever input mode you want - but you should always be very, very careful about converting between the two! The conversion shuld be bulletproof - but it isn't

If you want to understand how the code I originally provided for this operation actually works then read carefully the comments in the following whihc break it down in a step-by-step basis

explanation.mw

 

You have the function;

fungsikerugian := add((1-(1-(psi1*exp(-((x+1)/m1)^(m1/sigma1))+psi2*(1-exp(-((x+1)/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x+1-m3)/sigma3)))/(psi1*exp(-(x/m1)^(m1/sigma1))+psi2*(1-exp(-(x/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((x-m3)/sigma3))))/a(x))^2, x = 0 .. 111):

Consider just the first term in this summation - ie x=0. Maple substitutes x=0 in the summand, so

  1. all the 'x'-values in all of the exponentials will be replaced with 0:
  2. a(x) becomes a(0) and Maple evaluates this to the first entry in the 'qtopi' Array, ie 0.005860000,

and so the zeroth term in the summation becomes

(1-(1-(psi1*exp(-(1/m1)^(m1/sigma1))+psi2*(1-exp(-(1/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((1-m3)/sigma3)))/(psi1+psi3))/0.005860000)^2

In a similar way, the next term in the summation will substitute x=1 in the summand and produce

(1-(1-(psi1*exp(-(2/m1)^(m1/sigma1))+psi2*(1-exp(-(2/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((2-m3)/sigma3)))/(psi1*exp(-(1/m1)^(m1/sigma1))+psi2*(1-exp(-(1/m2)^(-m2/sigma2)))+psi3*exp(exp(-m3/sigma3)-exp((1-m3)/sigma3))))/0.000674750)^2

If this isn't what you want, then you are going to have to provide a much better explanation of exactly what you do want!!! Only you know what your problem is and I can only work with what you supply: I can't guess what your problem is!!

 i've been looking for directsearch package in maple application but i can't find it. is there any key word or link that i can use?

This is an "add-on" for Maple, available from the MapleSoft Appication centre. It is about the third entry down on the page

http://www.maplesoft.com/applications/Category.aspx?cid=1600

You will have to download it, install it and (if memory serves) convert its "help" pages to make it accessible/usable from within Maple

###################################################################

i want to ask you something. In the final result you've sent to me, i find out  that x has a value. Actually i'm not looking for it and i thought it should give me different result than i expected if x has a value. I just use the x as the index of the sigma and the range value of x is 0..111. Perhaps you can help me more here

'x' occurs twice in your problem.

The first time, it is a simple summation index used to access numeric values in the 'qtopi' array. Thus the final expression of the summation (which you call 'fungsikerugian') will not contain the variable 'x'

However 'x' occurs again in every one of your constraints. Since Optimization is a strictly numerical process, all variables (ie m1, m2, m3, psi1, psi2, psi3, sigma1, sigma2, sigma3, x) have to be assigned numeric values. The chosen optimization command will then vary all of these quantities in order to find the minimum for the objective function 'fungsikerugian'

######################################################################

 i want to understand more about the syntax that you use. sorry i ask to much while you already help me a lot.

 

soln:=DirectSearch:-Search( fungsikerugian,
                              convert(constr, list),          --------> what is this about?
                              variables = vlist,                --------> what is this about?
                              assume=positive,              --------> what is this about?
                              evaluationlimit = 1000000 --------> what is this about?

 

i want to really understand this not just to finish my work so please enlighten me. I appreciate it so much

The syntax of the DirectSearch:-Search() command is very similar to that of the Optimization:-NLPSolve command. They are doing the same thing, and accept many of the same option. Sice the DirectSearch:-Search() command "works" and the Optimization:-NLPSolve() command does not we have to assume that the former has "better" underlying algorthims.

In the worksheet which I provided, the DirectSearch:-Search command is

DirectSearch:-Search( fungsikerugian,
                                     convert(constr, list),
                                     variables = vlist,
                                     assume=positive,
                                     evaluationlimit = 1000000
                                   )

In this command

fungsikerugian: this is the objective function, ie the function to be minimised
convert(constr, list): this is a list of the constraints for the optimization. You originally had these as separate inequalities, assigned to separate names a:=.., b:=..c:=.. etc. I found it easier/neater to create a set which contains all of the constraints, and which I assigned to the name 'constr'. The NLPSolve command accepts constraints as either a set or a list, but the Search() command insists that the constraints be specified as a list (not a set). So convert(constr, list) just converts the set of constraints to a list of constraints.
variables = vlist: this is a list of the variables over which the optimization is to be carried out. Earlier in my worksheet I produced the list of variables by using Maple's indets() command. It os often not necessary to use this option because the variable names can be inferred from the objective function. However, since this problem conytains an optimisation variable which only occurs in the constraints, I decided it would be safer to include this
assume=positive: You used the option "assume = nonnegative" in your original post. This tells the solver that variables are all >=0. The DirectSearch command has a similiar option: all this does is tell the solver that all variables are >0
evaluationlimit = 1000000 :  Optimisation problems can run for a very long time, so they usually have an upper limit on the number of times the objective function will be evaluated. The default for the DirectSearch solver is 10000, so (by default), if a solution has not been found after 10000 evaluations the solver "gives up". One can set this limit higher than the default, for "difficult" problems. As you can see from the answer in the worksheet I supplied, DirectSearch took 18105 evaluations to produce the solution - so greater than its default limit, which is why I increased it to 100000
 

 

If you insert a missing parenthesis in the second term, your original code works as well.

restart;
ODE5:= y(x)*diff(y(x),x,x) + (diff(y(x),x))^2=0;
dsolve({ODE5,y(0)=4,D(y)(0)=7},y(x));

I have just noticed that your function 'fungsikerugian'  depends on nine variables

indets(fungsikerugian, 'name');
 {m1, m2, m3, psi1, psi2, psi3, sigma1, sigma2, sigma3}

but not on the variable 'x' - it is merely a summation index, on the other hand your constraints depend on the nine variables above as well as the variable 'x'.

`union`(map(indets, {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o}, 'name')[]);
  
{m1, m2, m3, psi1, psi2, psi3, sigma1, sigma2, sigma3, x}

Any constraint involving 'x' cannot be evaluated - because 'x' is an unknown - your objective function does not use it!! How do you expect to use such constraints???

 

First 129 130 131 132 133 134 135 Last Page 131 of 207