acer

32373 Reputation

29 Badges

19 years, 333 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@Carl Love Actually, one can assign an operator that way in 2D Math. A disambiguation dialogue window pops up, and the two choices are function definition and remember table assignment.

It can also be set as a preference using Typesetting:-RuleAssistant or Typesetting:-Settings.

However, the choice is not necessarily saved with the worksheet, and someone else running the sheet later on might not know how to choose in order for all subsequent code to proceed as intended. It might be less unhelpful if the user (or the GUI?!) inserted a preliminary call like Typesetting:-Settings(functionassign=true) when that form of operator assignment gets used.

It's confusing if people try and post 2D Math source here as plaintext, because there are some significant syntactic differences.

404 - File or directory not found.

acer

@Sujaan Kunalan The code I posted was for Maple 17. You could make the high and low values to be 0.005 and 1.0 say, in the pop-up dialgue. That should be enough, to change. (It probably won't like the default low value of 0, since it will try and use that as an initial stepsize.)

 

@Gruyere In your first line that attempt to initialize brotSet you use only = instead of := for as assignment. So that line just creates an equation, and didn't assign to the name. It sounds like you typed it in properly when you entered it on another line.

@Mac Dude Yes, I had understood. I had thought that Carl's suggestions would not be enough, alone, because of the remaining premature evaluation of the elementwise multiplication -- even before you confirmed that in your followup. Sorry for not being clear, before.

Try quoting the whole thing inside the list that is the second parameter passed to plots:-animate, ie.

plots:-animate(Statistics:-Histogram,
               ['dR*~WindowN(RP0,Can,CangleWidth+Can),ignore=true,view=[-0.5..0.2,0..10]'],
               Can=-0.1 .. 0.1);

If that doesn't work, try making it a postfix call to elementwise multiply, where that operator (but not the whole function call) is uneval quoted. That would need to be accompanied by either of Carl's earlier suggestions. Ie, (if I type it in right...)

plots:-animate(Statistics:-Histogram,
               ['`~`[`*`]'(dR, ` $`, 'WindowN(RP0, Can, CangleWidth+Can)'),
                ignore=true,view=[-0.5..0.2,0..10]],
               Can=-0.1 .. 0.1);

nb. there's a mix of single left- and single right-quotes in there.

 

@Mac Dude Did you intend for those uneval quotes to delay the elementwise multiplication with Vector dR?

@sunit If your expression read from .m is `eqnl1x` then what does,

   indets(eqnl1x,`local`);

return?

@Babak 

restart:

P0:=plot(x^2,x=0..2,color=red):

P1:=plottools:-reflect(P0,[[0,0],[0,1]]):

P2:=plottools:-transform((a,b)->[-a,b])(P0):

plots:-display(Array([P0,P2,P1]));

plots:-display(P0,P1);

plots:-display(P0,P2);

@nm Mapleprimes had similar functionality, in its first few years.

@Markiyan Hirnyk If one wants to execute the 2D Math Input containing the doubly underscored 4 then it should be an atomic identifier (because otherwise the 2D parser has no uderstanding of it, as syntax). Note that Maple doesn't do so much with this computationally, since it's interpreted just as a name and not as something mathematically related to the number four.

But if the 2D Input is only used as typeset math without execution (eg. inlined as math within some text paragraph) then it is not necessary to convert to atomic identifier, I believe.

@toandhsp I was windering whether Mathematica produces the same kind of result as this which is what my link above (to WolframAlpha) points to. That is, five results similar to,

    8 n!=1 and x = (-2 sqrt(n-4 n^2)+4 n-1)/(8 n-1) and n element Z

Or does it recognize how substitution using these results might simplify to a smaller set of solutions (because of periodicity).

How might this be adjusted or further manipulated (evalc?) so as to get these purely real solutions? I mean, something neater than just crudely plugging in some integers for the two _Z?? in the above solution.

 

   1/2-(1/10)*5^(1/2),  1/2+(1/10)*5^(1/2),  1,  1/2-(1/2)*5^(1/2),  1/2+(1/2)*5^(1/2)

 

@toandhsp Did you use Mathematica? I got just a rather ugly and unsimplified result from www.wolframalpha.com .

@Joe Riel I got all roots found by `asolve` if Digits=30 in Maple 17.02 on 64bit MS-Win. But it took about 5 secs.

One problem with repeatedly calling `fsolve` with its `avoid` option is that fsolve keeps trying various (random) initial points, hoping for convergence. The previously found roots don't help it with trying to find initial points in the basins of attraction of the remaining as-yet-not-found roots. As more and more of the roots are found any randomly chosen initial point will more and more likely converge to a previously found root rather than the desired as-yet-unfound remaining roots. In other words, such an approach can be slow if it does not make a systematic survey of the domain. The problem gets worse with problems with more and more possible solutions. That's one reason why it is slow.

Why fsolve doesn't find the roots between 60 and 100 unless Digits is set higher than default is another question, perhaps (a guess) related to how fsolve does not allow separate control of both working precision and requested accuracy (having both tied to Digits). Of course, having to use higher working precision also slows it down.

@rab285 This site seems to be having problems with attachments at present.

Here is the code from the intended attachment "p3interp.mw" that may be broken in the followup Comment above.

It uses a plaintext comma-separated-value file "y0.csv" (which could be saved from you original, in Excel say). That file should have 383 rows, since I removed the first row which was just a header. This is used to produce `M` a 383-by-3 Matrix.

restart:
M:=ImportMatrix("y0.csv",source=csv,datatype=float[8]):
with(plots):
#
# Smoothing approach (slow. points need't lie right on surface)
#
P1:=Statistics:-ScatterPlot3D(M,lowess=true,bandwidth=0.15,
                              fitorder=2,showpoints=false):
#
# Approach of 1D interpolation to fill in gaps.
#          (may extrapolate poorly, ie. see plot at point (1.1)
#
A:=Matrix(21,21,datatype=float[8]):
s:=1: T:='T': T[1]:=s:
for i from 2 to 21 do
  ini:=M[s,1];
  for j from s+1 to op([1,1],M) do
    if M[j,1] <> M[j-1,1] then
      T[i]:=j;
      s:=j;
      j := op([1,1],M);
      next;
    end if;
  end do;
end do:
T[i]:=op([1,1],M)+1:
for k from 1 to 21 do
  c:=Matrix([Vector(21,(k-1)*0.05),
        Vector(21,i->(i-1)*0.05),
        CurveFitting:-ArrayInterpolation(M[T[k]..T[k+1]-1,2..3],
                                         Vector(21,i->(i-1)*0.05))],
        datatype=float[8]);
  A[k,..]:=c[..,3];
end do:
P2:=surfdata(A,0..1,0..1,gridsize=[42,42]):
#
# This is the uninterpolated surface (with gaps)
#
B:=Matrix(1..21,1..21,Float(undefined),datatype=float[8]):
for i from 1 to op([1,1],M) do
  B[round(M[i,1]/0.05)+1,round(M[i,2]/0.05)+1]:=M[i,3];
end do:
P3:=surfdata(B,0..1,0..1):
#
# Now plot both, with an without the points overlaid
#
Ppoints:=Statistics:-ScatterPlot3D(M,color=red):
display(Array([[ display(Ppoints,P1), P1 ],
               [ display(Ppoints,P2), P2 ],
               [ display(Ppoints,P3), P3 ] ]),
        view=min(M[..,3])..max(M[..,3]),
        orientation=[45,45,0]);

@rab285 Which Maple version are you using?

The following (zipped) .csv data file and worksheet run ok for me in Maple 17.02.

y0.zip

p3interp.mw

I implemented the idea I mentioned about doing 1-D interpolation, repeatedly, to fill in gaps. That probably uses size and dimensions particular to your data set, ie. you'd likely need to make it more careful if attempting to use it on another set of data. I also added another method (surfdata, with gaps) since the data points lie on a regular grid (even if they do not fill it).

I suppose that yet another attempt (which I have not done) might be to rip out the rtable from the surface portion of the result from ScatterPlot3D and replace the given data points (by walking through M, similar to what was done in the 3rd approach in this attached worksheet). Then all the supplied data points would lie directly on the drawn surface, the gaps would be filled, and it might extrapolate in problematic corners better than happens with the 2nd interpolatory approach of this attachment.

First 363 364 365 366 367 368 369 Last Page 365 of 592