acer

31438 Reputation

29 Badges

19 years, 135 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

restart;
L:=[3,4,x,x^2,x^3,sin(x)]:

map(proc(X) local la;`if`(patmatch(X,x^'n'::nonunit(anything),'la'),
                          eval('n',la),NULL);end,L);

             [2, 3]

# Or, with a small edit to your original,

map(X->[unassign('n'),`if`(patmatch(X,x^n::nonunit(anything),'la'),
                           [assign(la), n][],NULL)][],L);
Warning, (in anonymous procedure) `la` is implicitly declared local

             [2, 3]

In your approach you had put each successful result in [assign(la), n], which created those inner lists.

I don't see how one might easily get solve to show you only all the steps, ie. without getting a lot of internal procedure's details (infolevel, printlevel, the debugger, etc).

Solving for s can be done using just one of the equations, using a command from the Student:-Basics package.

nb. you might also observe the similar form of rhs and lhs of that equation, and the common position of s and j. (ie. you might solve it mentally, without even needing solve/identity etc.)

It's unclear what you're trying for h2, since it seems that you might have made a typo in the name to which you assigned the other expression. Also if you use the "correct" name then -- since the rhs=lhs for that other equation -- you're just going to get h2=h2, ie. anything works.

I use Maple 2019, in which your attachment was last saved.

restart

k1 := -y*(A-C+R-h1-h2)/(2*(-R0*y^2+g1*y^2+Cm))

-y*(A-C+R-h1-h2)/(-2*R0*y^2+2*g1*y^2+2*Cm)

k2 := (C+h2-s)/(2*y*g2)

(1/2)*(C+h2-s)/(y*g2)

`τ1opt` := -y*(A-C+R-h1-h2)/(2*(-R0*y^2+g1*y^2+Cm))

-y*(A-C+R-h1-h2)/(-2*R0*y^2+2*g1*y^2+2*Cm)

`δopt` := (C-j+h2)/(2*y*g2)

(1/2)*(C-j+h2)/(y*g2)

These are the the same!.

k1-`τ1opt`

0

Why do you use tau1opt here? Did you intend `τ1opt` instead?

eliminate({k1 = tau1opt, k2 = `δopt`}, {s})

tau1opt

-y*(A-C+R-h1-h2)/(-2*R0*y^2+2*g1*y^2+2*Cm)

[{s = j}, {-2*R0*tau1opt*y^2+2*g1*tau1opt*y^2+A*y-C*y+2*Cm*tau1opt+R*y-h1*y-h2*y}]

k2 = `δopt`

(1/2)*(C+h2-s)/(y*g2) = (1/2)*(C-j+h2)/(y*g2)

Student:-Basics:-LinearSolveSteps(k2 = `δopt`, s)

_m139739756118016

Download Q_3_ac.mw

The muddy part of the (otherwise red) ball is due to having an semi-transparent greenish-yellow portion of surface between it and the viewer, no? Is that ameliorated enough by making the surface more transparent, or altering the color/shading choice?

The jagged shadows seem to be artefacts visualizing a farther portion of surface through the transparent closer portion, combined with how the GUI's surface renderer deals with the (discrete data) plotting structure.
1) The jagged shadowing might be lessened by decreasing the cylindrical data granularity (ie. increasing the grid resolution, at least for cylindrical theta), eg. using grid=[351,51] or such for the sphereplot. After doing so there still some oddness with dropped color from the front portion at some angles, but at least it's not jagged.
2) You might be more satisfied with a single color for the sphereplot.

ps. plottools:-transform and plottools:-rotate lose several parts of axis information. Some such aspects are not always sensibly translatable, but it's heavy handed in dropping it all. I've gotten in the habit of putting that kind of "global" stuff in any final plots:-display, instead of having it "local" to any one particular feature that I'm combining with others. Not ideal, but I often do it now from habit.

What you've shown is a consequence of applying a list of equations to an argument. Each side of each equation is applied to the argument. Note also what happens when you apply a single equation to an argument.

eq := f=g;

f = g

eq(1);

f(1) = g(1)

L := [(x->x+2)=b, a(t)=sin];

[(proc (x) options operator, arrow; x+2 end proc) = b, a(t) = sin]

L(1);

[3 = b(1), (a(t))(1) = sin(1)]

 

In short, it's doing what's been asked of it.

Note also that a(t) is a mere function call, and not a procedure or operator; It's instance of t has nothing to do with the 1 used as an argument.

When you use output=listprocedure then only the rhs's of the equations in the returned list are procedures/operators. The lhs's are just unevaluated function calls. Applying those unevaluated function calls to some argument doesn't do anything special; each makes an unevaluated function call of an unevaluated function call. If you apply H(q) to argument p then (with H unassigned) all you get back is H(q)(p) .

If you don't want to deal with that then don't use output=listprocedure. There are other choices of output form.

Alternatively, you could in fact accomodate that behaviour. You could apply only the rhs of some of the equations, etc.

Or, you could pick off the resulting applied rhs's using a variant like,
   foo := dsol(1);
   eval(x(t)(1), foo);

etc. Here is just one way to do that in your sheet. There are other variants, naturally. (ie. your claim about a substitution not being possible is not true; it just needs doing differently),
dsolve_numeric_output_with_extra_brackets_ac.mw

nb. It wouldn't make sense if the various output choices for dsolve,numeric all acted just the same. You might use which one suits your followup tasks best for you.

edit: Readers of this Question thread might also be interested in this related, earlier Question.

In addition to the mentioned listprocedure (and the default procedurelist), there is also the choice of output=operator. So for this example, subsequent substitutions into an existing expression eq0 (in terms of x(t),y(t),etc) might also be done as,

dsol := dsolve({daes, ics}, numeric, output = operator):
# and then,
eval[recurse](eq0, [t=1,dsol(1)[]]);
# or,
eval(eval(eq0,t=1),dsol(1));

dsolve_numeric_output_with_extra_brackets_ac2.mw

The various choices (listprocedure,procedurelist,operator) for dsolve's output option can all be made to work here, often each in several ways. But depending on the particular use-case some choices might be more straightforward to utilize. And some may be more efficient; again it depends on the example goal. No size best fits all.

You might be able to utilize the size option to get a specific number of pixels.

That option is accepted by, say, the plot and plots:-display commands (and others). Eg,
   plot(..., size=[504,208])

You can also set it just once at the start of a worksheet, as a kind of default for the session. Eg, for 2D plots, eg.
   plots:-setoptions(size=[672,384]):

The conversion of that to inches will depend on the resolution of your device (which I cannot know). Your monitor might be at 72 ppi or 96 ppi (pixels per inch), etc. Or you may have hi-res. Or you may be exporting/printing the worksheet at 300 ppi, etc. Whichever it is, you might do the arithmetic to get the pixel values needed.

ps. I'm not sure whether you are trying to export/print the worksheet as a whole (to paper or to PDF file, say), or exporting plots individually to file using plotsetup, etc.

In the worksheet attached below, those coefficients are stored in a Matrix.

The main point here is that the coefficients you wanted have been extracted and stored separately, so that you can re-use them programmatically (and separately).

If you wanted you could form equations with all the entries of the Matrix equated to zero, or do so with the numerators, etc. Use the entries of M the Matrix as you wish.

The extraction happens in the short double-loop in red 1D code. The remaining portion of the worksheet merely demonstrates that the coefficients are as desired, and also provides a visual.

restart

ode := b[5]*V(xi)^4/b[6]+b[3]*V(xi)^3/b[6]+b[4]*V(xi)^3/b[6]+b[2]*V(xi)^2/b[6]+V(xi)*(diff(diff(V(xi), xi), xi))*a*l/(2*m*b[6])+2*V(xi)*(diff(diff(V(xi), xi), xi))*a/b[6]+(diff(V(xi), xi))^2*a*l^2/(4*m^2*b[6])+3*(diff(V(xi), xi))^2*a*l/(2*m*b[6])+2*(diff(V(xi), xi))^2*a/b[6]+b[1]*V(xi)/b[6]+diff(diff(V(xi), xi), xi)-l*lambda/b[6] = 0

S := alpha[0]+alpha[1]*(diff(G(xi), xi))/G(xi)+beta[0]/G(xi)

WW := diff(G(xi), `$`(xi, 2)) = -lambda*G(xi)+mu

NULL

D1 := diff(S, xi)

D11 := subs(WW, D1)

D2 := diff(D11, xi)

D22 := subs(WW, D2)

K := V(xi) = S

K1 := diff(V(xi), xi) = D11

K2 := diff(diff(V(xi), xi), xi) = D22

P := eval(ode, {K, K1, K2})

PQ := expand(collect(P, {1/G(xi), diff(G(xi), xi)}))

QW := ((diff(G(xi), xi))/G(xi))^2 = (lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)/G(xi)^2+2*mu/G(xi)-lambda

QW1 := ((diff(G(xi), xi))/G(xi))^3 = ((lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)/G(xi)^2+2*mu/G(xi)-lambda)*(diff(G(xi), xi))/G(xi)

QW2 := ((diff(G(xi), xi))/G(xi))^4 = ((lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)/G(xi)^2+2*mu/G(xi)-lambda)^2

QW3 := ((diff(G(xi), xi))/G(xi))^5 = ((lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)/G(xi)^2+2*mu/G(xi)-lambda)^2*(diff(G(xi), xi))/G(xi)

E := eval(PQ, isolate(QW, (diff(G(xi), xi))^2))

E1 := eval(E, isolate(QW1, (diff(G(xi), xi))^3))

E2 := eval(E1, isolate(QW2, (diff(G(xi), xi))^4))

E3 := eval(E2, isolate(QW3, (diff(G(xi), xi))^5))

TT := expand(simplify((lhs-rhs)(E3), {(diff(G(xi), xi))/G(xi) = FOO}))

(mm,nn) := 1+degree(denom(TT),G(xi)),1+degree(TT,FOO):


The coefficients are stored in Matrix M

MM := Matrix(mm,nn):
for jj from 1 to nn do
  this := expand(coeff(TT,FOO,jj-1));
  for ii from 1 to mm do
    MM[ii,jj] := simplify(coeff(this, G(xi), -ii+1));
  end do;
end do:


Check against TT, by adding up the terms

resFOO := add(add(G(xi)^(-ii+1)*FOO^(jj-1)*MM[ii,jj],jj=1..nn),ii=1..mm):


It's equal to the TT

simplify(resFOO-TT);

0


Check against (lhs-rhs)(E3), by adding up the terms

res := add(add(G(xi)^(-ii+1)*(diff(G(xi),xi)/G(xi))^(jj-1)*MM[ii,jj],jj=1..nn),ii=1..mm):


It's equal to (lhs-rhs)(E3)

simplify(expand(res-(lhs - rhs)(E3)));

0


For visual effect only:

seq(seq(print(G(xi)%^(-ii+1)
              %* Typesetting:-mfenced(Typesetting:-Typeset(diff(G(xi),xi)/G(xi)))%^(jj-1)
              %* MM[ii,jj]),
        jj=1..nn),ii=1..mm);

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), 0), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 0)), (alpha[0]^4*b[5]+(b[3]+b[4])*alpha[0]^3+(-6*lambda*alpha[1]^2*b[5]+b[2])*alpha[0]^2+(-3*alpha[1]^2*(b[3]+b[4])*lambda+b[1])*alpha[0]-lambda*(-lambda*alpha[1]^4*b[5]+alpha[1]^2*b[2]+l))/b[6])

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), 0), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 1)), -(-4*b[5]*alpha[0]^3+(-3*b[3]-3*b[4])*alpha[0]^2+(4*lambda*alpha[1]^2*b[5]-2*b[2])*alpha[0]+alpha[1]^2*(b[3]+b[4])*lambda-b[1])*alpha[1]/b[6])

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -1), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 0)), (1/2)*(((-24*(b[5]*alpha[0]+(1/4)*b[3]+(1/4)*b[4])*lambda*alpha[1]^2+8*b[5]*alpha[0]^3+(6*b[3]+6*b[4])*alpha[0]^2+(-4*a*lambda+4*b[2])*alpha[0]-2*b[6]*lambda+2*b[1])*beta[0]-4*alpha[1]^2*mu*(2*lambda*alpha[1]^2*b[5]-6*b[5]*alpha[0]^2+(-3*b[3]-3*b[4])*alpha[0]+a*lambda-b[2]))*m-a*l*lambda*(mu*alpha[1]^2+alpha[0]*beta[0]))/(m*b[6]))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -1), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 1)), -(1/2)*(((-24*b[5]*alpha[0]^2+(-12*b[3]-12*b[4])*alpha[0]+8*lambda*alpha[1]^2*b[5]+4*a*lambda-4*b[2])*beta[0]-4*mu*((4*alpha[1]^2*b[5]+a)*alpha[0]+(b[3]+b[4])*alpha[1]^2+(1/2)*b[6]))*m+a*l*(lambda*beta[0]-mu*alpha[0]))*alpha[1]/(m*b[6]))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -2), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 0)), (1/4)*(4*(-4*((1/2)*alpha[1]^2*b[5]+a)*(B[1]+B[2])*(B[1]-B[2])*alpha[1]^2*lambda^3+((6*(B[1]^2-B[2]^2)*b[5]*alpha[0]^2+3*(B[1]-B[2])*(B[1]+B[2])*(b[3]+b[4])*alpha[0]-6*b[5]*beta[0]^2+B[1]^2*b[2]-B[2]^2*b[2])*alpha[1]^2-4*a*beta[0]^2)*lambda^2+2*(3*b[5]*alpha[1]^4*mu^2+5*mu*((12/5)*alpha[0]*b[5]*beta[0]+(3/5)*(b[3]+b[4])*beta[0]+a*mu)*alpha[1]^2+3*(alpha[0]^2*b[5]*beta[0]+((1/2)*(b[3]+b[4])*beta[0]+a*mu)*alpha[0]+(1/2)*mu*b[6]+(1/6)*b[2]*beta[0])*beta[0])*lambda-3*mu^2*(2*b[5]*alpha[0]^2+(b[3]+b[4])*alpha[0]+(1/3)*b[2])*alpha[1]^2)*m^2-8*((1/2)*alpha[1]^2*(B[1]^2-B[2]^2)*lambda^2+beta[0]^2*lambda-(7/4)*alpha[1]^2*mu^2-(3/4)*beta[0]*alpha[0]*mu)*a*lambda*l*m-a*l^2*lambda*(-mu^2*alpha[1]^2+lambda*beta[0]^2))/(b[6]*lambda*m^2))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -2), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 1)), (1/2)*alpha[1]*(8*((B[1]+B[2])*((b[5]*alpha[0]+(1/4)*b[3]+(1/4)*b[4])*alpha[1]^2+a*alpha[0]+(1/2)*b[6])*(B[1]-B[2])*lambda^2+3*beta[0]*((2/3)*b[5]*alpha[1]^2*mu+alpha[0]*b[5]*beta[0]+a*mu+(1/4)*(b[3]+b[4])*beta[0])*lambda-mu^2*((b[5]*alpha[0]+(1/4)*b[3]+(1/4)*b[4])*alpha[1]^2+a*alpha[0]+(1/2)*b[6]))*m^2+10*a*l*((1/5)*alpha[0]*(B[1]^2-B[2]^2)*lambda^2+mu*beta[0]*lambda-(1/5)*alpha[0]*mu^2)*m+a*l^2*mu*beta[0]*lambda)/(b[6]*lambda*m^2))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -3), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 0)), (1/2)*((8*(B[1]+B[2])*(((3*b[5]*alpha[0]+(3/4)*b[3]+(3/4)*b[4])*alpha[1]^2+a*alpha[0]+(1/2)*b[6])*beta[0]+(7/2)*alpha[1]^2*mu*((2/7)*alpha[1]^2*b[5]+a))*(B[1]-B[2])*lambda^2+20*beta[0]^2*(((2/5)*b[5]*alpha[0]+(1/10)*b[3]+(1/10)*b[4])*beta[0]+mu*((6/5)*alpha[1]^2*b[5]+a))*lambda-8*mu^2*(((3*b[5]*alpha[0]+(3/4)*b[3]+(3/4)*b[4])*alpha[1]^2+a*alpha[0]+(1/2)*b[6])*beta[0]+(7/2)*alpha[1]^2*mu*((2/7)*alpha[1]^2*b[5]+a)))*m^2+9*a*((2/9)*((11/2)*mu*alpha[1]^2+alpha[0]*beta[0])*(B[1]+B[2])*(B[1]-B[2])*lambda^2+lambda*mu*beta[0]^2-(11/9)*mu^3*alpha[1]^2-(2/9)*beta[0]*alpha[0]*mu^2)*l*m+mu*a*l^2*(alpha[1]^2*(B[1]^2-B[2]^2)*lambda^2+beta[0]^2*lambda-alpha[1]^2*mu^2))/(b[6]*lambda*m^2))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -3), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 1)), -(1/2)*alpha[1]*((-24*((1/3)*alpha[1]^2*b[5]+a)*(B[1]+B[2])*(B[1]-B[2])*lambda^2-8*beta[0]^2*lambda*b[5]+24*mu^2*((1/3)*alpha[1]^2*b[5]+a))*m^2+10*((-B[1]^2+B[2]^2)*lambda^2+mu^2)*a*l*m+((-B[1]^2+B[2]^2)*lambda^2+mu^2)*a*l^2)*beta[0]/(b[6]*lambda*m^2))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -4), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 0)), (1/4)*((4*(alpha[1]^2*b[5]+6*a)*m^2+10*a*l*m+a*l^2)*(B[1]+B[2])^2*(B[1]-B[2])^2*alpha[1]^2*lambda^4+(24*(alpha[1]^2*b[5]+a)*m^2+10*a*l*m+a*l^2)*(B[1]+B[2])*(B[1]-B[2])*beta[0]^2*lambda^3+2*(2*(-2*b[5]*mu^2*(B[1]-B[2])*(B[1]+B[2])*alpha[1]^4-12*a*mu^2*(B[1]-B[2])*(B[1]+B[2])*alpha[1]^2+b[5]*beta[0]^4)*m^2-10*a*alpha[1]^2*l*mu^2*(B[1]-B[2])*(B[1]+B[2])*m-a*alpha[1]^2*l^2*mu^2*(B[1]-B[2])*(B[1]+B[2]))*lambda^2-mu^2*(24*(alpha[1]^2*b[5]+a)*m^2+10*a*l*m+a*l^2)*beta[0]^2*lambda+mu^4*(4*(alpha[1]^2*b[5]+6*a)*m^2+10*a*l*m+a*l^2)*alpha[1]^2)/(lambda^2*m^2*b[6]))

Parse:-ConvertTo1D, "invalid input %1", `%*`(`%*`(`%^`(G(xi), -4), `%^`(Typesetting:-mfenced(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mo("ⅆ"), Typesetting:-mrow(Typesetting:-mo("ⅆ"), Typesetting:-mi("ξ"))), Typesetting:-mspace(width = "0.4em"), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ")))), Typesetting:-mrow(Typesetting:-mi("G"), Typesetting:-mo("⁡"), Typesetting:-mfenced(Typesetting:-mi("ξ"))))), 1)), 0)

Download collect_sb_ac.mw

Your calls like,

   evalf(sum(f(h*i+a)*h, i = 1 .. n))

are prematurely calling the passed f procedure before index variable i gets any actual integer value. In other words, it is evaluating f(h*i+a) with i being just a symbolic name.

Instead, try those like,

   evalf(add(f(h*i+a)*h, i = 1 .. n))

The add command has special evaluation rules, which here can prevent the call f(h*i+a) from being evaluated until the index i gets actual integer values from the 1..n range.

forum_ac.mw

You might also need to examine your algorithms for correctness; I haven't.

See also the third note on the Basic Information section of the Help page for sum.

Another choice is,

   plot(t->eval(r,dsol1(t)), 0..10)

which seems pretty natural to me. As you can see the operator can be more directly constructed, more tersely and without the longer and more complicated use of unapply and uneval-quotes.

Using eval (or subs) for the substitution is pretty natural Maple here, as you have given an r formula up front, and want to substitute into it.

You may wish to compare approaches, for efficiency. Your followup approach with double uneval-quotes is slower.

In the attached worksheet I also try to force a similar number of points for all approaches, for sake of comparison.

computation_with_dsolve_exports_ac.mw

Some other approaches in which the x(t) and y(t) instance are computed separately (for each numeric t value) may also be slower than pumping each numeric t value just once into the returned dsolve thing and then extracting -- though that might also depend on how they get utilize. I won't bother to give such. Note that odeplot is optimized to utilize the computed components efficiently in this respect.

ps. I won't mention the output=listprocedure (or operator) choices since you might find those too complicated for your liking.

[update] I see that Kitonum has since added another answer. You'll see that his suggestion,
   r:=s->eval(sqrt(x(t)^2+y(t)^2), dsol1(s)):
   plot(r, 0..3);

is functionally nearly identical to mine. (I used the assignment you already had to `r`.)
   r:=sqrt(x(t)^2+y(t)^2);
   plot(t->eval(r,dsol1(t)), 0..10);

Given your own r formula up front,
   r:=sqrt(x(t)^2+y(t)^2);
then you can of course assign the operator to a name, and then re-use it in plotting, rootfinding, optimizing, etc.
   fr := t->eval(r,dsol1(t));
   plot(fr, 0..10);
...
and so on.

Note also that with the syntax I gave you can reassign name `r` with another new formula in x(t),y(t) and that same operator can then be re-utilized and access the updated formula. (Kitonum's answer hard-coded your original formula in the operator; though it's just a step to recreate a new operator.) 

Is this something like what you're trying to accomplish, checking whether any of the solutions can be verified by odetest, for each set of parameters?

restart

with(PDEtools)

with(LinearAlgebra)

with(Physics)

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

NULL

Fode := (-delta*eta^2+alpha*eta)*(diff(diff(U(xi), xi), xi))-U(xi)*(2*eta*gamma*theta*(delta*eta-alpha)*U(xi)^2+eta^2*delta*k^2+(-alpha*k^2-2*delta*k)*eta+2*k*alpha+delta) = 0

(-delta*eta^2+alpha*eta)*(diff(diff(U(xi), xi), xi))-U(xi)*(2*gamma*eta*theta*(delta*eta-alpha)*U(xi)^2+eta^2*delta*k^2+(-alpha*k^2-2*delta*k)*eta+2*k*alpha+delta) = 0

NULL

F := sum(a[i]*G(xi)^i, i = 0 .. 1)

a[0]+a[1]*G(xi)

D1 := diff(F, xi)

a[1]*(diff(G(xi), xi))

NULL

S := (diff(G(xi), xi))^2 = G(xi)^4+A[2]*G(xi)^2+A[1]

(diff(G(xi), xi))^2 = G(xi)^4+A[2]*G(xi)^2+A[1]

S1 := diff(G(xi), xi) = sqrt(G(xi)^4+A[2]*G(xi)^2+A[1])

diff(G(xi), xi) = (G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)

E1 := eval(D1, S1)

a[1]*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)

D2 := diff(E1, xi)

(1/2)*a[1]*(4*G(xi)^3*(diff(G(xi), xi))+2*A[2]*G(xi)*(diff(G(xi), xi)))/(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)

E2 := eval(D2, S1)

(1/2)*a[1]*(4*G(xi)^3*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)+2*A[2]*G(xi)*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2))/(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)

K := U(xi) = F

U(xi) = a[0]+a[1]*G(xi)

K1 := diff(U(xi), xi) = E1

diff(U(xi), xi) = a[1]*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)

K2 := diff(U(xi), xi, xi) = E2

diff(diff(U(xi), xi), xi) = (1/2)*a[1]*(4*G(xi)^3*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)+2*A[2]*G(xi)*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2))/(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)

L := eval(Fode, {K, K1, K2})

(1/2)*(-delta*eta^2+alpha*eta)*a[1]*(4*G(xi)^3*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)+2*A[2]*G(xi)*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2))/(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)-(a[0]+a[1]*G(xi))*(2*gamma*eta*theta*(delta*eta-alpha)*(a[0]+a[1]*G(xi))^2+eta^2*delta*k^2+(-alpha*k^2-2*delta*k)*eta+2*k*alpha+delta) = 0

L1 := normal((1/2)*(-delta*eta^2+alpha*eta)*a[1]*(4*G(xi)^3*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)+2*A[2]*G(xi)*(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2))/(G(xi)^4+A[2]*G(xi)^2+A[1])^(1/2)-(a[0]+a[1]*G(xi))*(2*gamma*eta*theta*(delta*eta-alpha)*(a[0]+a[1]*G(xi))^2+eta^2*delta*k^2+(-alpha*k^2-2*delta*k)*eta+2*k*alpha+delta) = 0)

-2*G(xi)^3*gamma*delta*eta^2*theta*a[1]^3+2*G(xi)^3*gamma*alpha*eta*theta*a[1]^3-6*G(xi)^2*gamma*delta*eta^2*theta*a[0]*a[1]^2+6*G(xi)^2*gamma*alpha*eta*theta*a[0]*a[1]^2-6*G(xi)*gamma*delta*eta^2*theta*a[0]^2*a[1]+6*G(xi)*gamma*alpha*eta*theta*a[0]^2*a[1]-2*gamma*delta*eta^2*theta*a[0]^3-2*G(xi)^3*delta*eta^2*a[1]-G(xi)*delta*eta^2*k^2*a[1]+2*gamma*alpha*eta*theta*a[0]^3+2*G(xi)^3*alpha*eta*a[1]+G(xi)*alpha*eta*k^2*a[1]-G(xi)*delta*eta^2*A[2]*a[1]-delta*eta^2*k^2*a[0]+G(xi)*alpha*eta*A[2]*a[1]+2*G(xi)*delta*eta*k*a[1]+alpha*eta*k^2*a[0]-2*G(xi)*alpha*k*a[1]+2*delta*eta*k*a[0]-G(xi)*delta*a[1]-2*alpha*k*a[0]-delta*a[0] = 0

collect(L1, {G(xi)})

(-2*delta*eta^2*gamma*theta*a[1]^3+2*alpha*eta*gamma*theta*a[1]^3-2*delta*eta^2*a[1]+2*alpha*eta*a[1])*G(xi)^3+(-6*delta*eta^2*gamma*theta*a[0]*a[1]^2+6*alpha*eta*gamma*theta*a[0]*a[1]^2)*G(xi)^2+(-6*delta*eta^2*gamma*theta*a[0]^2*a[1]+6*alpha*eta*gamma*theta*a[0]^2*a[1]-delta*eta^2*k^2*a[1]+alpha*eta*k^2*a[1]-delta*eta^2*A[2]*a[1]+alpha*eta*A[2]*a[1]+2*delta*eta*k*a[1]-2*alpha*k*a[1]-delta*a[1])*G(xi)-2*gamma*delta*eta^2*theta*a[0]^3+2*gamma*alpha*eta*theta*a[0]^3-delta*eta^2*k^2*a[0]+alpha*eta*k^2*a[0]+2*delta*eta*k*a[0]-2*alpha*k*a[0]-delta*a[0] = 0

eq0 := -2*delta*eta^2*gamma*theta*a[0]^3+2*alpha*eta*gamma*theta*a[0]^3-delta*eta^2*k^2*a[0]+alpha*eta*k^2*a[0]+2*delta*eta*k*a[0]-2*alpha*k*a[0]-delta*a[0] = 0

eq1 := -6*delta*eta^2*gamma*theta*a[0]^2*a[1]+6*alpha*eta*gamma*theta*a[0]^2*a[1]-delta*eta^2*k^2*a[1]+alpha*eta*k^2*a[1]-delta*eta^2*A[2]*a[1]+alpha*eta*A[2]*a[1]+2*delta*eta*k*a[1]-2*alpha*k*a[1]-delta*a[1] = 0

eq2 := -6*delta*eta^2*gamma*theta*a[0]*a[1]^2+6*alpha*eta*gamma*theta*a[0]*a[1]^2 = 0

eq3 := -2*delta*eta^2*gamma*theta*a[1]^3+2*alpha*eta*gamma*theta*a[1]^3-2*delta*eta^2*a[1]+2*alpha*eta*a[1] = 0

COEFFS := solve({eq0, eq1, eq2, eq3}, {alpha, eta, a[0], a[1]}, explicit)

{alpha = -(1/2)*delta/k, eta = 0, a[0] = a[0], a[1] = a[1]}, {alpha = alpha, eta = eta, a[0] = 0, a[1] = 0}, {alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), eta = eta, a[0] = 0, a[1] = -1/(-gamma*theta)^(1/2)}, {alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), eta = eta, a[0] = 0, a[1] = 1/(-gamma*theta)^(1/2)}, {alpha = delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k), eta = eta, a[0] = a[0], a[1] = 0}

COEFFS := map[2](remove, evalb, [COEFFS])

[{alpha = -(1/2)*delta/k, eta = 0}, {a[0] = 0, a[1] = 0}, {alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = -1/(-gamma*theta)^(1/2)}, {alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = 1/(-gamma*theta)^(1/2)}, {alpha = delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k), a[1] = 0}]

verifiedsols := table([seq(COEFFS[i]={},i=1..nops(COEFFS))]):
for thisCF in COEFFS do
  thisFode := simplify(eval(Fode, thisCF));
  if thisFode = (0=0) then
    verifiedsols[thisCF] := {U(xi)=U(xi)};
  else
    S2 := dsolve(S, G(xi));
    for thisS2 in S2 do
      thisCFS2 := simplify(eval(eval(K, thisCF), thisS2));
      if odetest(thisCFS2, thisFode)=0 then
        verifiedsols[thisCF] := verifiedsols[thisCF] union {thisCFS2};
      end if;
    end do;
  end if;
end do:

map(u->print(u=verifiedsols[u]), [indices(verifiedsols,'nolist')]):

{a[0] = 0, a[1] = 0} = {U(xi) = 0}

{alpha = delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k), a[1] = 0} = {U(xi) = a[0]}

{alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = -1/(-gamma*theta)^(1/2)} = {U(xi) = -JacobiSN((1/2)*(2*(A[2]^2-4*A[1])^(1/2)-2*A[2])^(1/2)*xi+c__1, 2^(1/2)*(-A[1]*A[2]*(A[2]^2-4*A[1])^(1/2)+A[1]*A[2]^2-2*A[1]^2)^(1/2)/(A[2]*(A[2]^2-4*A[1])^(1/2)-A[2]^2+2*A[1]))*A[1]*2^(1/2)/(gamma^(1/2)*(-theta)^(1/2)*(A[1]*(-A[2]+(A[2]^2-4*A[1])^(1/2)))^(1/2))}

{alpha = -(1/2)*delta/k, eta = 0} = {U(xi) = U(xi)}

{alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = 1/(-gamma*theta)^(1/2)} = {U(xi) = JacobiSN((1/2)*(2*(A[2]^2-4*A[1])^(1/2)-2*A[2])^(1/2)*xi+c__1, 2^(1/2)*(-A[1]*A[2]*(A[2]^2-4*A[1])^(1/2)+A[1]*A[2]^2-2*A[1]^2)^(1/2)/(A[2]*(A[2]^2-4*A[1])^(1/2)-A[2]^2+2*A[1]))*A[1]*2^(1/2)/(gamma^(1/2)*(-theta)^(1/2)*(A[1]*(-A[2]+(A[2]^2-4*A[1])^(1/2)))^(1/2))}

GG := [indices(verifiedsols,'nolist')];

[{a[0] = 0, a[1] = 0}, {alpha = delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k), a[1] = 0}, {alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = -1/(-gamma*theta)^(1/2)}, {alpha = -(1/2)*delta/k, eta = 0}, {alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = 1/(-gamma*theta)^(1/2)}]

GG[1], verifiedsols[GG[1]];
eval(Fode,GG[1]);
if % <> (0=0) then
  odetest(verifiedsols[GG[1]], eval(Fode,GG[1]));
end if;

{a[0] = 0, a[1] = 0}, {U(xi) = 0}

(-delta*eta^2+alpha*eta)*(diff(diff(U(xi), xi), xi))-U(xi)*(2*gamma*eta*theta*(delta*eta-alpha)*U(xi)^2+eta^2*delta*k^2+(-alpha*k^2-2*delta*k)*eta+2*k*alpha+delta) = 0

0

GG[2], verifiedsols[GG[2]];
eval(Fode,GG[2]);
if % <> (0=0) then
  odetest(verifiedsols[GG[2]], eval(Fode,GG[2]));
end if;

{alpha = delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k), a[1] = 0}, {U(xi) = a[0]}

(-eta^2*delta+delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)*eta/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k))*(diff(diff(U(xi), xi), xi))-U(xi)*(2*gamma*eta*theta*(delta*eta-delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k))*U(xi)^2+eta^2*delta*k^2+(-k^2*delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k)-2*k*delta)*eta+2*k*delta*(2*eta^2*gamma*theta*a[0]^2+eta^2*k^2-2*eta*k+1)/(2*eta*gamma*theta*a[0]^2+eta*k^2-2*k)+delta) = 0

0

GG[3], verifiedsols[GG[3]];
eval(Fode,GG[3]);
if % <> (0=0) then
  odetest(verifiedsols[GG[3]], eval(Fode,GG[3]));
end if;

{alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = -1/(-gamma*theta)^(1/2)}, {U(xi) = -JacobiSN((1/2)*(2*(A[2]^2-4*A[1])^(1/2)-2*A[2])^(1/2)*xi+c__1, 2^(1/2)*(-A[1]*A[2]*(A[2]^2-4*A[1])^(1/2)+A[1]*A[2]^2-2*A[1]^2)^(1/2)/(A[2]*(A[2]^2-4*A[1])^(1/2)-A[2]^2+2*A[1]))*A[1]*2^(1/2)/(gamma^(1/2)*(-theta)^(1/2)*(A[1]*(-A[2]+(A[2]^2-4*A[1])^(1/2)))^(1/2))}

(-eta^2*delta+delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)*eta/(eta*k^2+eta*A[2]-2*k))*(diff(diff(U(xi), xi), xi))-U(xi)*(2*gamma*eta*theta*(delta*eta-delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k))*U(xi)^2+eta^2*delta*k^2+(-k^2*delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k)-2*k*delta)*eta+2*k*delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k)+delta) = 0

0

GG[4], verifiedsols[GG[4]];
eval(Fode,GG[4]);
if % <> (0=0) then
  odetest(verifiedsols[GG[4]], eval(Fode,GG[4]));
end if;

{alpha = -(1/2)*delta/k, eta = 0}, {U(xi) = U(xi)}

0 = 0

GG[5], verifiedsols[GG[5]];
eval(Fode,GG[5]);
if % <> (0=0) then
  odetest(verifiedsols[GG[5]], eval(Fode,GG[5]));
end if;

{alpha = delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k), a[0] = 0, a[1] = 1/(-gamma*theta)^(1/2)}, {U(xi) = JacobiSN((1/2)*(2*(A[2]^2-4*A[1])^(1/2)-2*A[2])^(1/2)*xi+c__1, 2^(1/2)*(-A[1]*A[2]*(A[2]^2-4*A[1])^(1/2)+A[1]*A[2]^2-2*A[1]^2)^(1/2)/(A[2]*(A[2]^2-4*A[1])^(1/2)-A[2]^2+2*A[1]))*A[1]*2^(1/2)/(gamma^(1/2)*(-theta)^(1/2)*(A[1]*(-A[2]+(A[2]^2-4*A[1])^(1/2)))^(1/2))}

(-eta^2*delta+delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)*eta/(eta*k^2+eta*A[2]-2*k))*(diff(diff(U(xi), xi), xi))-U(xi)*(2*gamma*eta*theta*(delta*eta-delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k))*U(xi)^2+eta^2*delta*k^2+(-k^2*delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k)-2*k*delta)*eta+2*k*delta*(eta^2*k^2+eta^2*A[2]-2*eta*k+1)/(eta*k^2+eta*A[2]-2*k)+delta) = 0

0

 

 

Download odetest_ac.mw

Are you trying to ask how you could import an example written in Mathematica/Wolfram?

str:="-1/3*r^2*((1-beta)/gamma)^n*Hypergeometric2F1[n,n/(a-beta),(-1-n-beta)/(-1+beta),(-r^((3-3*beta)/n))*chi^2/gamma]":

 

MmaTranslator:-FromMma(str);

-(1/3)*r^2*((1-beta)/gamma)^n*hypergeom([n, n/(a-beta)], [(-1-n-beta)/(-1+beta)], -r^((3-3*beta)/n)*chi^2/gamma)

Download mma_imp_ex.mw

This is a known problem with the PDF export of so-called "scrollable rtables", and affects that export of Vectors and Matrices in Maple 2024.1.

The bug has been reported previously to Maplesoft.

In the meantime, it appears that the following workaround (disabling that new feature) allows the PDF export to work OK in Maple 2024.1 .

That edit to one's GUI preferences file has apparently worked successfully (possibly accompanied by increasing rtablesize) for several other people who've reported the same problem here. [1, 2, 3]

Here is one way, taking your semi-regularly spaced data as a text file data.txt

The point is that once you have the data in another format (below, an Array, but there are also listlist possibilities) then you can pass it straight to the plots:-surfdata command.

restart;

Read in that 4 column data.
(Adjust this column indexing if you only store the three x-, y-, and z-columns.

M := ImportMatrix("data.txt", source=csv)[..,2..4]:

Now turn that 28x3 Matrix into a 7x4x3 Array.

R := Array(ArrayTools:-Reshape(M,[7,4,3]),datatype=float[8]):

Now we can pass that Array directly to the surfdata command.

plots:-surfdata(R);

Download some_data_plot_2.mw

You can pass additional options to the surfdata command, for color, style, labels, etc.

That Array's third dimension has size 3. It's first layer R[..,..,1] are the x-values, the second layer R[..,..,2] are the y-values, and the third layer R[..,..,3] are the z-values.

I took your data in the format just as your presented it to us, because I suppose that you have some process that produces it like that. That kind of form/pattern comes up quite often, eg. from nested loops or seq calls, so having a programmatic way to rearrange to the target form it can be useful.

The artefacts of joining of adjacent parts, because they lie together in the same rtable/listlist contained in the plotting structure, can be avoided.

You can split the construction into multiple plot3d calls, by angle, so that the data is in separate rtable/listlist containers even after plots:-display is used to render them together.

It runs faster, because it doesn't need that higher grid setting, no function call is needed at each point, and because it's being more efficient by simply not doing the blank portions.

Your procedures f and rmod are not necessary here. And no function (complicated or otherwise) is called on every input data point.

restart;

p1:=seq(seq(ifelse((i+j)::odd,
                   plot3d(1,t=(i-1)*Pi/4..i*Pi/4,p=(j-1)*Pi/4..j*Pi/4,
                          coords=spherical,scaling=constrained,
                          color="black",grid=[40,40],style=surface),NULL),
            j=1..4),
        i=1..8):

p2:=plots:-sphereplot(0.99,theta=0..2*Pi,phi=0..Pi,color=white,style=surface):

plots:-display(p1,p2);


Download Chessboard_sphere_ac.mw

You have made a mistake, by attempting to pass on to the simplify command a bare sequence of three elements returned by the solve command.

The error message you see arises due to that. If you wrap the sequence result from solve in a list then that error does not occur.

Simplification of very large expressions can take a while. The results coming out of your solve call are very large (you have complicated symbolic coefficients with several parameters).

The following doesn't take a huge amount of time (about 50sec, all told), but does cut down the size quite a bit, relatively speaking.

I've used Maple 2019, which you seem to have.

restart

kernelopts(version)

`Maple 2019.2, X86 64 LINUX, Nov 26 2019, Build ID 1435526`

`&pi;er` := proc (w, delta) options operator, arrow; w*delta*tau2*d+Cepr*tau2*d+l*(1-delta)*tau2*d+Cex*tau01*d-Clr*tau2^2-Aer*tau2*d-Rer*tau2*d+R0er*tau2^2*d^2 end proc

proc (w, delta) options operator, arrow; w*delta*tau2*d+Cepr*tau2*d+l*(1-delta)*tau2*d+Cex*tau01*d-Clr*tau2^2-Aer*tau2*d-Rer*tau2*d+R0er*tau2^2*d^2 end proc

D4er := simplify(subs([tau2 = -(-Cv*delta-delta*s2+delta*w+Cepr-s1)/(2*d*g2*delta^2), tau1 = -d*(Am-Cv+Rm-s1-s2)/(2*(-R0m*d^2+d^2*g1+Clm))], `&pi;er`(w, delta)))

(1/4)*(4*d^2*g2*(d*tau01*g2*Cex+(1/2)*(w-Cv-s2)*(-w+l))*delta^4+2*d^2*((l-2*w+Cv+s2)*Cepr+(Rer-l+s1+Aer)*w+(-Rer+l-Aer)*Cv-l*s1-s2*(Rer-l+Aer))*g2*delta^3+((2*(Cepr-s1)*(-Cepr+Rer-l+Aer)*g2+R0er*(w-Cv-s2)^2)*d^2-Clr*(w-Cv-s2)^2)*delta^2+2*(w-Cv-s2)*(Cepr-s1)*(R0er*d^2-Clr)*delta+(Cepr-s1)^2*(R0er*d^2-Clr))/(d^2*g2^2*delta^4)

D5er := diff(D4er, w) = 0

(1/4)*(4*d^2*g2*((1/2)*l-w+(1/2)*Cv+(1/2)*s2)*delta^4+2*d^2*(-2*Cepr+Rer-l+s1+Aer)*g2*delta^3+(2*R0er*(w-Cv-s2)*d^2-2*Clr*(w-Cv-s2))*delta^2+2*(Cepr-s1)*(R0er*d^2-Clr)*delta)/(d^2*g2^2*delta^4) = 0

simplify(solve(D5er, w))

(-d^2*g2*(l+Cv+s2)*delta^3+2*d^2*g2*(Cepr+(1/2)*l-(1/2)*s1-(1/2)*Aer-(1/2)*Rer)*delta^2+(Cv+s2)*(R0er*d^2-Clr)*delta-(Cepr-s1)*(R0er*d^2-Clr))/(delta*(-2*d^2*delta^2*g2+R0er*d^2-Clr))

D6er := diff(D4er, delta) = 0

(1/4)*(16*d^2*g2*(d*tau01*g2*Cex+(1/2)*(w-Cv-s2)*(-w+l))*delta^3+6*d^2*((l-2*w+Cv+s2)*Cepr+(Rer-l+s1+Aer)*w+(-Rer+l-Aer)*Cv-l*s1-s2*(Rer-l+Aer))*g2*delta^2+2*((2*(Cepr-s1)*(-Cepr+Rer-l+Aer)*g2+R0er*(w-Cv-s2)^2)*d^2-Clr*(w-Cv-s2)^2)*delta+2*(w-Cv-s2)*(Cepr-s1)*(R0er*d^2-Clr))/(d^2*g2^2*delta^4)-(4*d^2*g2*(d*tau01*g2*Cex+(1/2)*(w-Cv-s2)*(-w+l))*delta^4+2*d^2*((l-2*w+Cv+s2)*Cepr+(Rer-l+s1+Aer)*w+(-Rer+l-Aer)*Cv-l*s1-s2*(Rer-l+Aer))*g2*delta^3+((2*(Cepr-s1)*(-Cepr+Rer-l+Aer)*g2+R0er*(w-Cv-s2)^2)*d^2-Clr*(w-Cv-s2)^2)*delta^2+2*(w-Cv-s2)*(Cepr-s1)*(R0er*d^2-Clr)*delta+(Cepr-s1)^2*(R0er*d^2-Clr))/(d^2*g2^2*delta^5) = 0

sols := CodeTools:-Usage([solve(D6er, delta)])

memory used=0.92MiB, alloc change=0 bytes, cpu time=10.00ms, real time=10.00ms, gc time=0ns

`~`[length](sols)

[3598983, 7197328, 7197328]

new := CodeTools:-Usage(`~`[simplify](sols, size))

memory used=282.99MiB, alloc change=48.00MiB, cpu time=3.24s, real time=2.98s, gc time=532.00ms

`~`[length](new)

[93584, 158428, 158428]

new2 := CodeTools:-Usage(map(proc (u) options operator, arrow; simplify(numer(u))/simplify(denom(u)) end proc, new))

memory used=5.34GiB, alloc change=166.32MiB, cpu time=42.85s, real time=36.73s, gc time=9.55s

`~`[length](new2)

[11552, 9879, 9879]

 

``

Download Q_simplify_solv_ac.mw

One reasonable way to do that in your old Maple 2021 is to use the applyrule command.

That is somewhat like a pattern-matching approach. It has the benefits that:
1) You don't have to supply or mention the variable name `x`, yourself. It will figure that out, and also apply the rule to additional candidates like sin(y+z)/cos(y+z) that might appear in the same expression.
2) It doesn't force conversion to tan of other less appropriate trig calls.

restart

kernelopts(version)

`Maple 2021.2, X86 64 LINUX, Nov 23 2021, Build ID 1576349`

M := sin(x)/cos(x)

sin(x)/cos(x)

applyrule(sin(a::anything)/cos(a::anything) = tan(a), M)

tan(x)

K := 1/sinh(x)

1/sinh(x)

applyrule(1/sinh(a::anything) = csch(a), K)

csch(x)

Q := sqrt(beta[0]/(B[1]*cosh(xi*sqrt(-lambda))))

(beta[0]/(B[1]*cosh(xi*(-lambda)^(1/2))))^(1/2)

applyrule(1/cosh(a::anything) = sech(a), Q)

(beta[0]*sech(xi*(-lambda)^(1/2))/B[1])^(1/2)

 

 

Download identity_change_applyrule.mw

Note that in Maple 2024 you can get those results just using the simplify command.

restart

kernelopts(version)

`Maple 2024.1, X86 64 LINUX, Jun 25 2024, Build ID 1835466`

M := sin(x)/cos(x)

sin(x)/cos(x)

simplify(M)

tan(x)

K := 1/sinh(x)

1/sinh(x)

simplify(K)

csch(x)

Q := sqrt(beta[0]/(B[1]*cosh(xi*sqrt(-lambda))))

(beta[0]/(B[1]*cosh(xi*(-lambda)^(1/2))))^(1/2)

simplify(Q)

(beta[0]*sech(xi*(-lambda)^(1/2))/B[1])^(1/2)

Download identity_change_M2024.mw

ps. I marked your Question as being for Maple 2021, since all your Questions's attachments are last saved by you using that version. As you can see, it matters. Please mark your furture Questions with the specific version yourself.

pps. Here's a bad way to get those same effects:

restart

M := sin(x)/cos(x)

sin(x)/cos(x)

convert(M, tan)

tan(x)

K := 1/sinh(x)

1/sinh(x)

convert(K, csch)

csch(x)

Q := sqrt(beta[0]/(B[1]*cosh(xi*sqrt(-lambda))))

(beta[0]/(B[1]*cosh(xi*(-lambda)^(1/2))))^(1/2)

convert(Q, sech)

(beta[0]*sech(xi*(-lambda)^(1/2))/B[1])^(1/2)


Note that all those ways are pretty useless, because:
1) You have to supply the target function yourself
2) They also affect other trig calls in the expression, which
can actually make them far less simple.

For example,

convert(M+sin(x), tan)

tan(x)+2*tan((1/2)*x)/(1+tan((1/2)*x)^2)

convert(K+cos(x), csch)

csch(x)-I/csch(I*(x+(1/2)*Pi))

convert(Q+tan(x), sech)

(beta[0]*sech(xi*(-lambda)^(1/2))/B[1])^(1/2)-sech(I*x)/sech(I*(x+(1/2)*Pi))

Download identity_change_care.mw

4 5 6 7 8 9 10 Last Page 6 of 327