acer

8 years, 350 days


These are answers submitted by acer

fsolve

16 hours ago acer 10181
1 2

I see the same results in 64bit Maple 18.01, as well as 32bit/64bit Maple 16.02 and Maple 11.02, all for Windows.

I suppose that you may have already figured out that for a univariate polynomial p with real coefficients fsolve(p,x) will invoke RootFinding:-Isolate (with the method being RS by default).

If you execute fsolve(p,x,complex) then at default working precision this gets done successfully by the modified Laguerre method via the NAG c02agc function. And the root near 1.018 is in the returned sequence of roots. It doesn't resort to `fsolve/polyill`.

Offhand I don't know why Isolate's RS method goes wrong on your particular example.

I wonder whether fsolve should try both of Isolate's methods in such a case. (Well, it should certainly try something else, for an odd degree univariate polynomial with real coefficients if Isolate's method=RS returns null, since there must be one real root, as you say!).

For what it may be worth, you can reduce the typing a little, as I believe that the behaviour is the same for

-65658-18554*x-186255*x^2-97616*x^3-238885*x^4+582426*x^5

acer

attempt

17 hours ago acer 10181
2 3

Here is an attempt. This is an interesting topic, and a generalized methodology (that accomodates the limitations of how ISOSURFACE 3D plot structures work) would be useful.

(Sorry that this site renders the inlined plots poorly. They look a bit better in the GUI, and manually rotating them reveals more detail.)

 

restart:

opts := x=-5..5,y=-5..5,z=-5..5, grid=[20,20,20]:

lts:=[x^2+x*(y+2*z)-1, y^2+y*(x+2*z)-3];
eqs:=y*z*(x+y+2*z)^3-8;

[x^2+x*(y+2*z)-1, y^2+y*(x+2*z)-3]

y*z*(x+y+2*z)^3-8

cover:=plots:-implicitplot3d(max(lts[]), opts,
                             style=surface, transparency=0.7, color=blue):

# The purpose of `coverB` is that when displayed alongside `cover` they
# indicate which is the inner, feasible region of space with boundary `cover`.

coverB:=plots:-implicitplot3d(max(lts[])+2,opts,
                              style=patch, transparency=0.5, color=green):
# The following illustrates that the region between (inside) the blue
# surfaces is the feasible region defined by the constraints.
#
# The same could be done for each of the inequalities, separately, for
# further illustration.

plots:-display(cover, coverB, lightmodel=none);

targ:=plots:-implicitplot3d(eqs, opts,
                            style=patch, transparency=0.0, color=gold):

# The answer should be the portion of the gold surface which lies in
# the feasible region between the two blue surfaces.

plots:-display(cover, targ, lightmodel=none);

# I suspect that this technique is related to how 3D implicit plots are
# rendered by the GUI. The ISOSURFACE plot structure does not explicitly
# contain a set of points at which the implicit function's evaluations
# are zero (the surface), or even close to zero. Rather, the ISOSURFACE
# is a full 3D grid of x,y,z points and function values, and the interface
# itself interpolates and renders.
# This is likely related to why it handles cusp discontinuously smooth
# surfaces badly (producing no surface), because it is looking for zero-
# crossings.
# On account of these posited behaviors, it seems to work best to produce
# implicit functions which cross zero carefully, and which also behave
# well near only the constraints.
#
# If Maple's 3D implicit plotting were adaptive and capable of handling
# jump dicontinuity, etc, then we could approach such problems by simply
# constructing a procedure which returned some arbitrarily chosen
# positive constant value whenever the input point was not feasible. But
# with the current mechanism that does not work in general, and often
# produces either a surface warped away from the correct surface, or spurious
# (infeasible) surface portions, or an empty result.
#
# The following seems to work, producing the red surface for y*z*(x+y+2*z)^3-8
# inside the feasible region defined by x^2+x*(y+2*z)-1<0 and y^2+y*(x+2*z)-3<0.
 
hola:=plots:-implicitplot3d(min(eqs,-max(lts)),opts, grid=[40,40,40],
                            style=patch, color=red):

plots:-display(cover, hola, lightmodel=none);

 


Download ineq3dz.mw

acer

why all at once?

20 hours ago acer 10181
0 0

Why do you have to compute all the permutations before you classify them?

Why do you keep spamming this site with duplicates of the same question?

acer

yes

September 12 2014 acer 10181
0 1

Yes, it is possible.

acer

time[real]()

September 04 2014 acer 10181
0 0

Issue the command time[real]() at the start, and assign the result to a name. Then issue it again when the student clicks, and subtract.

acer

n(SPH)

September 04 2014 acer 10181
3 1

solve does not like solve for unevaluated function calls such as your n(SPF) and n(SPH).

So change those to just name like say nSPF and nSPH (or n*SPF and n*SPH if that's what you intended). Both succeed for me in M18.01.

For example,

ineq:=-s*(-n(SPF)*tau+n(SPH))/(tau-1) <= n(SPH):
soln := solve(subs([n(SPF)=nSPF,n(SPH)=nSPH],ineq),nSPH) assuming (tau<1,s>0,s<1,tau>0):
subs([nSPF=n(SPF),nSPH=n(SPH)],soln);

acer

exact

September 02 2014 acer 10181
2 7

Do not introduce `k` and `x` with floats. Use exact quantities instead. That should get around the discrepancy in Maple 9.5.

restart;
k:=99/100:
m:=1:
x:=(Pi*csc(Pi*(k-m)))/(693/1000*GAMMA(k)*GAMMA(m)):
m1:=MeijerG([[-m],[1-m]],[[0,-m,-m],[k-m]],(-m*k)/snr):
m2:=MeijerG([[-k],[1-k]],[[0,-k,-k],[m-k]],(-m*k)/snr):
c:=x*((((m*k)/snr)^m)*m1-(((m*k)/snr)^k)*m2):
plot([Re(c),Im(c)], snr=-5..10, color=[red,blue]);

In particular, when using those floats in the definitions of `k` and `x` as you had it originally, Maple 9.5 will produce this,

restart;
k:=.99:
m:=1:
x:=(Pi*csc(Pi*(k-m)))/(.693*GAMMA(k)*GAMMA(m)):
m2:=MeijerG([[-k],[1-k]],[[0,-k,-k],[m-k]],(-m*k)/snr):

evalf(eval(m2,snr=5));

                  259.8556695 + 5.313756679 I

exactm2:=convert(m2,rational,exact):
evalf(eval(exactm2,snr=5));

                  6.225950422 - 2.656878345 I

The above may not just be a roundoff issue -- ie. increasing precision might not fix it. You might have to use exact rationals in the arguments to MeijerG.

An alternative workaround for Maple 9.5 could be to convert your `c` (or perhaps just `m2`) expression to exact rational prior to plotting, manipulating expression `c`, or querying `c` at float values of `snr`.

acer

PlotComponent

September 02 2014 acer 10181
4 12

You can do this by first creating a PlotComponent (say, with identity/name of "Plot0") and then pushing a revised plot to it with each new value computed.

In ths attached example I include a `Sleep` call merely to mimic a computation that takes some time.

ticker.mw

acer

multiplication intended?

September 01 2014 acer 10181
4 2

If you intend that expression as a multiplication (and not as a compound function application) then insert an explicit multiplication sign (ie. the * on you keyboard) between the two bracketed terms.

(x-4)*(x-4);

                                   2
                            (x - 4) 


(x-4)(x-4);

                          x(x - 4) - 4

Otherwise your input would can get parsed as the function application x(x-a) - a(x-a). That is, the compound operator (x-a) applied to the argument x-a.

Note that 4 applied to x-4 (or pretty much anything) produces a result of 4.

There are some situations, including your example, where an extra blank space between the two bracketed terms would also get interpreted implicitly as a multiplication, if you used 2D Math input mode. In 1D Notation that would produce a parsing error. It can get more confusing still. I suggest getting in the habit of always using an explicit multiplication symbol, to avoid ambiguous situations with implicit multiplication.

acer

cat

September 01 2014 acer 10181
2 2

One way is to make your absolutely qualified filenames be a concatenation of a base location and some relative paths.

# Uncomment the line you want, and comment out the line you don't want.
#base:="C:/officeplace/location 1/":
#base:="C:/homecomputer/location 2/":

datafileA:=cat(base,"fileA.txt");
datafileB:=cat(base,"../../folderQ/fileB.txt");

readdata(..., datafileA, ...);
...
readdata(..., datafileB, ...);
...

Another way could be to use the currentdir command to set the current working directory.

acer

14.01 or 14.00?

August 28 2014 acer 10181
1 1

I see white grid line artefacts using f=1 for that densityplot in Maple 14.00, but they do not appear for me in Maple 14.01.

I am using 64bit Linux.

You might have to contact Maplesoft Tech Support in order to get the point-release update to 14.01, as it's no longer available here I believe.

[edited] You might be able to get the 14.01 update from here.

acer

block diagonal

August 27 2014 acer 10181
2 1

If I understand what you want then here are two ways to form the block diagonal Matrix result, using repeats of the Matrix Q as the blocks.

restart:                 
Q:=Matrix([[1,2],[3,4]]):
N:=3:                    

LinearAlgebra:-DiagonalMatrix([Q$N]);

                         [1    2    0    0    0    0]
                         [                          ]
                         [3    4    0    0    0    0]
                         [                          ]
                         [0    0    1    2    0    0]
                         [                          ]
                         [0    0    3    4    0    0]
                         [                          ]
                         [0    0    0    0    1    2]
                         [                          ]
                         [0    0    0    0    3    4]

Matrix([Q$N],scan=diagonal);

                         [1    2    0    0    0    0]
                         [                          ]
                         [3    4    0    0    0    0]
                         [                          ]
                         [0    0    1    2    0    0]
                         [                          ]
                         [0    0    3    4    0    0]
                         [                          ]
                         [0    0    0    0    1    2]
                         [                          ]
                         [0    0    0    0    3    4]

acer

format for printf/sprintf

August 26 2014 acer 10181
2 0

There are formatting options for sprintf (and friends) which support this directly. It is fast and lean on memory use. The code below also works in Maple 12.

> M:=Matrix(3,[[1,2,3],[4,5,6],[7,8,9]]);           

                                   [1    2    3]
                                   [           ]
                              M := [4    5    6]
                                   [           ]
                                   [7    8    9]

> parse(sprintf("%{ns}ld\n",M));                     

                                   123456789

See the help-page on topic rtable_printf for details. Within the {} brackets the qualifier `n` suppresses new lines between rows, and the qualifier `s` suppresses any space between entries.

acer

Matrix

August 22 2014 acer 10181
2 2

You were close, with your third attempt. Another level of square bracketing specify that things are stacking vertically.

A:=< <1|2|3>,<4|5|6>,<7|8|9>>;

                                    [1  2  3]
                                    [       ]
                               A := [4  5  6]
                                    [       ]
                                    [7  8  9]

Matrix([ [A[1..2,..]], [Vector[row]([91,92,92])], [A[3,..]] ]);

                                [ 1   2   3]
                                [          ]
                                [ 4   5   6]
                                [          ]
                                [91  92  92]
                                [          ]
                                [ 7   8   9]

Note that you forgot square brackets around entries in your Vector call.

acer

Palette?

August 21 2014 acer 10181
2 2

You could use a color palette. Eg,

c:=ColorTools:-GetPalette("Niagara"):
plots:-display(seq(plots[odeplot](sol[i],t=0..10,color=c[i]),i=1..nops([sol])));

See also the pre-made palettes listed by the ColorTools[PaletteNames] command.

One thing I like about a color palette such as `c` is that its membership widens on demand. When you reference c[i] for higher value of `i` then a new shade is generated which matches the tonal "feel" of the previous colors while trying to stay well spaced w.r.t. the previous colors. (The color computation sometimes gets sluggish, but values are remembered.) You can also create your own palette, and install one for automatic use by `plot`, etc.

acer

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