acer

33074 Reputation

29 Badges

20 years, 177 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Use the Big Green Arrow icon in the mapleprimes responses editor's menubar, to upload a copy of the corrupted worksheet.

acer

@tomleslie This is not the first post by this member with a mish-mash of incorrect usage (including improper use of MTM:-diff ).

Since the member does not seem capable of grasping that some of the problems start with the line with(MTM) then I don't see why anyone would bother to struggle more to help.

@Christopher2222 If the compiled proc cfix gives you problems you could use the slower evalhf(fix(...)) call instead.

I'm not sure that the success is so remarkable. The uniformly distributed noise is likely to leave quite a bit of local information (when it exists before the noise is added...).

Here is a refinement, where the width of the subarea used for interpolation is a supplied option. Also, if a pixel appears undamaged (value<1.0) at a particular layer then accept that value.

fiximgwidth.mw

With 90% damaged pixels, a slightly blurred reconstruction looks pretty good, using 4 for the width (ie, the 9x9 subarea around each pixel as opposed to width 1 for a 3x3 subarea).

Also, the process may be repeated. Ie, compare,

cfixed4:=Array(1..n,1..m,1..3,datatype=float[8],order=C_order):
CodeTools:-Usage( cfix( damaged2, cfixed4, n, m, 4 ) ):
Embed([img,damaged2,cfixed4]);

with,

cfixed4:=Array(1..n,1..m,1..3,datatype=float[8],order=C_order):
CodeTools:-Usage( cfix( damaged2, cfixed4, n, m, 4 ) ):
CodeTools:-Usage( cfix( copy(cfixed4), cfixed4, n, m, 4 ) ):
Embed([img,damaged2,cfixed4]);

or,

cfixed4:=Array(1..n,1..m,1..3,datatype=float[8],order=C_order):
CodeTools:-Usage( cfix( damaged2, cfixed4, n, m, 2 ) ):
CodeTools:-Usage( cfix( copy(cfixed4), cfixed4, n, m, 2 ) ):
Embed([img,damaged2,cfixed4]);

@Don_Caraota Note that DirectSearch:-SolveEquations can return local minima which are not actual roots (say, in the case that no roots are found). You may have to take care to proprocess and analyze residuals yourself, in order to ensure that you avoid this case.

@Earl If I had two lists N and M representing out-of-order pairs then I'd be tempted to use simple angle-bracket notation to make them into an n-by-2 Matrix, which could still be re-ordered by indexing with [sort(N, output= permutation)] where N is the independent data. The plot command would handle that result.

@Kitonum When y<0 this is not real-valued (by Maple).

@mmcdara Your original question did not mention that the solutions you were interested in had to be purely real.

If you apply the evalf command to sols you will get float approximations which might make the nonreal nature of the computed results more immediately clear to you.

You mentioned spheres. If you complete the square wrt to x, y, and z then you can put the equations into a form where that is more easily recognizable. For example,

cs:=Student:-Precalculus:-CompleteSquare:

eq1 := x^2+y^2+z^2-134*x+800*y-360*z+31489=2:
eq2 := x^2+y^2+z^2-934*x+900*y-370*z+321789=2:
eq3 := x^2+y^2+z^2-614*x+1350*y-1110*z+70048=97:

cs( (lhs-rhs)(eq1) );
                                                 2            2           2
                                        (z - 180)  + (y + 400)  + (x - 67)  - 165402

cs( (lhs-rhs)(eq2) );
                                                2            2            2
                                       (z - 185)  + (y + 450)  + (x - 467)  - 133027

cs( (lhs-rhs)(eq3) );
                                                2            2            2
                                       (z - 555)  + (y + 675)  + (x - 307)  - 787948

Note that the results from eq2 and eq3 agree with the radii you mentioned, but the result from eq1 does not agree with your claim of a radius of 2042. Recall that your original question had commas instead of equal signs. Perhaps the integer values you used to write eq1 were not all written down as you intended. Of course it's possible that there are only nonreal solutions, according to your actual data (but it's hard to comment, without knowing the intended data).

@Lola I don't see any link to an uploaded sheet.

You may need to ensure that the accuracy attained for the numerical integration is at least as fine as the optimality tolerance requested by the NLPSolve call, so that the optimization method can be convinced that the result is converging.

The accuracy of the numerical integration is controlled by Int's `epsilon` option (and sometimes its digits option needs to be adjusted as well). In the trickiest case you may need to raise working precision of the numerical integration while keeping the working precision used by NLPSolve coarser.

This is just a guess as to what may be causing you issues. If you have difficulty with applying vv's suggestion then please upload a full worksheet to reproduce.

acer

@vv That's quite close to what I had in mind. Sorry if I was fuzzy in my description -- I couldn't recall exact details of evaluation in my earlier description.

On my 64bit Maple 2016.1 for Linux I see a speed of 8 sec versus 12.5 sec when I compare it for n=10000 and 100 frames, in the attached worksheet.

The difference seems to get more pronounced as the number of frames increases, for that n. The bytesused shows a large difference in garbage-collected memory.

I forced the Compile, to make sure that step was ok (otherwise I sometimes got an in-memory compilation failure similar to something Carl mentioned last week in a separate Question).

I executed the whole sheet together, using the !!! triple-explcam from the main menubar.

I included a trivial Compile operation after restart, to try and eliminate overhead of initial use of the compiler's runtime.

cup.mw

For 3D plotting there may be an additional wrinkle: I sometimes see the GUI itself slow down as the GUI (not the kernel) leaks a little memory on (large?) 3D (point?) plots. As the java process's resident memory increases the GUI may get slower to render.

 [edited[ I should mention that one likley could not make a a traditional animation with the appliable module (which used the inplace techniques) in the attached worksheet unless calls to it were wrapped in a call to copy. Because otherwise all frames might appear the same.

And to address Carl's question about VIEW -- Explore doesn't do any special to combine or expand the VIEW, but simply displays each frame as is. An expanding VIEW mechanism could be made part of a smart module, though, augmenting the total VIEW by comparing a running local to what each subsequently generated frame demanded.

@Thomas Richard Did you intend something more like this?


restart:

with(InertForm):

A := (cos(sqrt(2)*t)-cos(omega*t))/(omega^2-2):

AA := `%*`(1/denom(A),numer(A)):

Display(AA, inert=false);

(cos(sqrt(2)*t)-cos(omega*t))/(omega^2-2)

Value(AA);

(cos(2^(1/2)*t)-cos(omega*t))/(omega^2-2)

 


Download inertnumerdenom.mw

As usual, vv is correct on all fronts. Thank you, sir.

Have you tried declaring n as a local and assigning it appropriately? Or passing it in, if the dimensions of the rtable will depend upon it? And (long shot) without the option autocompile?

How about the inmem=false option for Compile:-Compile, assuming that you have a MSVC++ that allowed Compiler:-Compile to work on your older Maple versions for your 64bit Windows.

It compiles and works for me on my 64bit Maple 2016.1 on 64bit Windows 7 Pro, using suitable local n assigned to the right value, or picking up a global n assigned the integer value used to build the rtables. It also works for me with or without the inmem=false option.

I could only get it to produce an error if n had no value for it to access. But it was a related error message. I haven't been able to reproduce the error message you show.

acer

@Carl Love For fun. Adjust to taste.

clexplore.mw

First 311 312 313 314 315 316 317 Last Page 313 of 605