acer

32353 Reputation

29 Badges

19 years, 331 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

I haven't figured out what exactly is going on with your attempt yet. But how about changing the vertical computational range, while enforcing a `view`?

Also, the `restricttoranges` option forces the bounds precisely.
 

restart;

a:=0: b:=1:

plots:-densityplot(z, dummy = 0 .. 1, z = b-360/240*(b-a) .. b,
                   view=[0 .. 1, a .. b],
                   grid = [2, 10], size = [90, 100],
                   colorscheme = ["zcoloring",
                                  [z -> -z,
                                   z -> 1, z -> 1],
                                  colorspace = "HSV"],
                   style = surface, axes = frame, labels = ["", ""],
                   axis[1] = [tickmarks = []], title = "Test",
                   titlefont = ["Calibri", "Bold", 16],
                   axesfont = ["Arial", 14],
                   size = [100, 500], restricttoranges);

kernelopts(version);

`Maple 2016.1, X86 64 LINUX, Apr 22 2016, Build ID 1133417`

 


 

Download coolhot.mw

If you want to avoid the use of a custom (user-defined) procedure (ie. to have it use only kernel builtins for efficiency) then you could use the shorter syntax,

map2(`.`,A,LM)

FWIW, the call,

[A,A] .~ LM;

is more like the following,

zip(`.`,[A,A],LM);

I note that `zip` does have a nicer error message when the container types do not agree. (In a sense your original attempt using .~ is a bit more like the next failing example below.)

zip(`.`,A,LM);
Error, (in zip) both arguments being zipped must be of the same type

zip(`*`,[1,2,3,4],A);
Error, (in zip) both arguments being zipped must be of the same type

If you are willing to allow all the computations to be done within a single procedure call (ie. you don't need to quit early if, say, some target value is attained) then you could construct such a procedure and utilize the codegen[optimize] command.

You can try it with and without the option `tryhard` to that command. It can sometimes produce better results, but with a longer runtime to produce it.

Naturally, you'd likely want to automate the steps which generate all the variable names (and the placeholders for the high and low values, etc). You may already ha a mechanism for that.

Download opt.mw

Here are a few ideas. (I used Maple 2016.)

wideoutput.mw

[edited] In at least Maple 2017.0 the first of the four methods in the attachment (interface labelling, etc) also requires interface(typesetting=standard) in order to work.

 

In a paragraph (Document Block) of a Document the left-hend-side of an assignment is not echoed. But it is echoed when done in an Execution Group (whether done in 2-D Math input mode or 1-D Maple Notation input mode).

The simplest way to get (all) Execution Groups for your inputs is to use the main menubar File->New->Worksheet Mode, rather than the normal new-user default File->New->Document Mode. (You can also set that preference for new sheets, under Tools->Options.)

But even in a Document you can still force open an Execution Group using the menubar item Insert->Execution Group.

As I mentioned, inside an Execution Group you have the choice of 2-D or 1-D input modes. The F5 key toggles between them.

In 2-D Math input mode (in the Standard GUI of recent Maple versions) that is available by command-completion on the name eval (or its inert variant Eval).

For example, on MS-Windows, in 2-D Math input mode, type as input the word eval and then hit the Esc (Escape) key. That should bring up a popup dialogue menu, the first item of which is the one you are after.

See also the Help Topic worksheet,expressions,completecommand

For your example the active variant with lowercase eval will compute eval(H1, t=0.45) which evaluates H1 at t=0.45.

The active variant eval and the inert variant Eval differ in how they look in this 2-D Math format: the active eval form has a black vertical bar and the inert Eval form has a gray vertical bar.

If you decrease the grid size by using, say, the option grid=[10,10] then there will be less hatching but also the surface with be less accurate.

So, instead, use the option style=patchnogrid or style=surface which will make maple utilize the same grid size but not show the hatching.

See the help page topic  plot3d,options 

@tsunamiBTP At least one of your attached worksheets seems to have been last saved with Maple 12.02. If that is the version you are using then you could use the zip command.

M := Matrix([[1,2],[3,5]]):

N := Matrix([[3,7],[-1,-2]]):

zip(`*`,M,N);

                                    [ 3     14]
                                    [         ]
                                    [-3    -10]

It bothers me (a little bit) when people use constructions like rhs(TOV[1]) and rhs(TOV[5]) for TOV the result from numeric dsolve with option output=listprocedure. It's awkward, because it forces the user to remember (or check) the order of the items in TOV.

In my opinion it is better to do it like,

  TOVv := eval(v(r),TOV):

than

  TOVv := rhs(TOV[5])):

It is better because it explicitly details that the procedure for v(r) is obtained.

As for your question, you could do it like so,

TOVv := eval(v(r),TOV);
offset := TOVv(608529.7)+.36555;
odeplot(TOV, [r, v(r) - offset ]);

# or even
plot(TOVv-offset, 0.0 .. 600000.0);

How about combining the trig terms, before solving?

restart:
 
eq1 := cos(lambda*ln(r1))*cos(lambda*ln(r2))
       + sin(lambda*ln(r1))*sin(lambda*ln(r2)) - 1 = 0:

combine(eq1);

                  cos(lambda ln(r1) - lambda ln(r2)) - 1 = 0

solve( combine(eq1), lambda, allsolutions );

                                2 Pi _Z1~
                             ---------------
                             ln(r1) - ln(r2)

You could also utilize those assumptions. For example, using them at the combining stage, before solving.


alt := combine(eq1) assuming r1>0, r2>r1;

                                              r1
                        alt := cos(lambda ln(----)) - 1 = 0
                                              r2

solve( alt, lambda, allsolutions );

                                     2 Pi _Z3~
                                     ---------
                                         r1
                                     ln(----)
                                         r2

Or you could use them afterwards, for this particular problem.

solve( combine(eq1), lambda, allsolutions ):

combine(%) assuming r1>0, r2>r1;

                                      2 Pi _Z5~
                                    - ---------
                                          r2
                                      ln(----)
                                          r1

And you could also do it this way,

solve( combine(eq1), lambda, allsolutions ) assuming r1>0, r2>r1;

You could also pick off the (introduced) parameter name programmatically.


 

restart

pde := diff(u(x, t), t) = diff(u(x, t), `$`(x, 2)):

ics := [u(x, 0) = 1, u(0, t) = 0, u(1, t) = 0]:

pds := pdsolve(pde, ics, numeric, time = t, range = 0 .. 1, spacestep = 1/4024, timestep = 1/4024):

sym := pdsolve([pde, u(x, 0) = 1, u(0, t) = 0, u(1, t) = 0])

u(x, t) = Sum(-2*((-1)^_Z1-1)*sin(_Z1*Pi*x)*exp(-Pi^2*_Z1^2*t)/(Pi*_Z1), _Z1 = 1 .. infinity)

p := `minus`(indets(sym, And(name, Non(constant))), {t, x});

{_Z1}

subs(p[1] = n, sym);

u(x, t) = Sum(-2*((-1)^n-1)*sin(n*Pi*x)*exp(-Pi^2*n^2*t)/(Pi*n), n = 1 .. infinity)

 


 

Download pdex1_1.mw

Here is one way. I assigned Expression Label (3) to `targ`, and then "simplified" expression `FD` to that.
 

restart; M := 4; K := 1

g[0] := 0; -1; g[1] := 1; -1; alpha := 1/2; 1; v[1] := 1/2

1/2

1/2

for n while n <= M do g[2*n] := 2*n*2^(-2*n+1)*(sum((-1)^(j+2*n)*j^(2*n-1)*(sum(binomial(2*n, k), k = 0 .. 2*n-j-1)), j = 1 .. 2*n-1)); g[2*n+1] := 0 end do:

NULL

printlevel := 2:

12*c[1, 3]*7^(1/2)*x^2+(4*c[1, 2]*5^(1/2)-18*c[1, 3]*7^(1/2))*x+c[1, 1]*3^(1/2)-3*c[1, 2]*5^(1/2)+6*c[1, 3]*7^(1/2)

NULL

targ := fracdiff(f, x, 1/2, method = series)

-4*(-2*c[1, 2]*5^(1/2)+9*c[1, 3]*7^(1/2))*x^(1/2)/Pi^(1/2)+32*c[1, 3]*7^(1/2)*x^(3/2)/Pi^(1/2)

u := simplify(sum(sum(c[p, q]*sqrt(q+1/2)*2^((1/2)*K)*(sum(sum(2^(K*(q-i-j))*GAMMA(q-i-j+1)*x^(q-i-j-v[1])*(1-2*p)^j*g[i]*binomial(q-i, j)*binomial(q, i)/GAMMA(q-i-v[1]-j+1), j = 0 .. q-i-ceil(v[1])), i = ceil(v[1]) .. q)), q = ceil(v[1]) .. M-1), p = 1 .. 2^(K-1))); -1; FD := simplify(convert(%, StandardFunctions)); -1; FD := expand(%)

256*2^(1/2)*x^(1/2)*c[1, 2]*5^(1/2)/(Pi^(1/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)+1024*2^(1/2)*x^(3/2)*c[1, 3]*7^(1/2)/(Pi^(1/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)+256*x^(1/2)*c[1, 2]*5^(1/2)/(Pi^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)-1536*x^(1/2)*c[1, 3]*7^(1/2)/(Pi^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)-96*c[1, 2]*5^(1/2)/(Pi^(1/2)*x^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)+432*c[1, 3]*7^(1/2)/(Pi^(1/2)*x^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)+1024*x^(3/2)*c[1, 3]*7^(1/2)/(Pi^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)+16*2^(1/2)*c[1, 2]*5^(1/2)/(Pi^(1/2)*x^(3/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)-160*2^(1/2)*c[1, 2]*5^(1/2)/(Pi^(1/2)*x^(1/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)-72*2^(1/2)*c[1, 3]*7^(1/2)/(Pi^(1/2)*x^(3/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)+784*2^(1/2)*c[1, 3]*7^(1/2)/(Pi^(1/2)*x^(1/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)-1792*2^(1/2)*x^(1/2)*c[1, 3]*7^(1/2)/(Pi^(1/2)*(-1/x+2)^(1/2)*(2+2^(1/2)*(-1/x+2)^(1/2))^3)

collect(radnormal(FD),sqrt(x),normal@expand);

-4*(-2*c[1, 2]*5^(1/2)+9*c[1, 3]*7^(1/2))*x^(1/2)/Pi^(1/2)+32*c[1, 3]*7^(1/2)*x^(3/2)/Pi^(1/2)

 


Download Help_ans.mw

This also seems ok:

  collect(radnormal(FD),x,normal@expand);

On some machines Maple's Standard GUI has trouble with the rendering of spacecurves unless the option linestyle=solid is supplied to the command that generates the plot.

If adding that option fixes the problem then could you add the details of your graphics chipset on the problem machine?

One way this can happen is if you are in 2D Input mode, trying to make multiple statements in a single paragraph, and forget the trailing semicolon (or colon) at the end of a line (not the last one).

For example,

restart

n := 5;

5

Parse:-ConvertTo1D, "first argument to _Inert_ASSIGN must be assignable"

Error, illegal use of an object as a name

"13  n:=n+1"

13; 1; n := n+1

13

6

 

Download illegal.mw

But that's just a guess. There are other ways to generate that error message. We cannot diagnose the particular problem unless you upload a worksheet that exhibits it.

Try the commands DocumentTools:-RemoveTask or DocumentTools:-RemovePaletteEntry .

First 201 202 203 204 205 206 207 Last Page 203 of 336