acer

32303 Reputation

29 Badges

19 years, 308 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The following factored form is simpler than that obtained by
applying just evalf, or evalf and simplify, or expand and evalf, etc.

sol := dsolve({diff(f(x), x) = 0.768e-1*f(x)^(2/3)-0.102e-1*f(x), f(1) = 59}, f(x))

NULL

T := factor(subsindets(sol, specfunc(exp), proc (u) options operator, arrow; (exp(17/5000-(17/5000)*x))^simplify(op(u)/(17/5000-(17/5000)*x)) end proc)); new := evalf(simplify(evalf[20](T)))

f(x) = -48.08619869*(exp(0.34e-2-0.34e-2*x)-2.070558790)^3

NULL

Download worksheet_ac.mw

@Khair Muhammad Saraz 

Is this anything like the kind of static 3d plot you're after, for your followup example?

I can only guess, since you haven't explicitly described what you're actually after.

dq_code_1_acc.mw

Does it help to use an assumption on n?

Using Maple 2022.2, and guessing at your intention,

restart;

c:=1;

1

A := rsolve({a(0)=1/n,a(i)=((n-i+1)/(n-i)+1/(c*(n-i)))*a(i-1)},a)
  assuming n::posint;

(n+1)/((-n+i)*(-n+i-1))

total1 := simplify(combine(expand(sum(eval(A,i=k),k=0..n-1))),size)
  assuming n::posint;

n

evalf(eval(total1, n = 6));

6.

restart;

c:=2;

2

A := rsolve({a(0)=1/n,a(i)=((n-i+1)/(n-i)+1/(c*(n-i)))*a(i-1)},a)
  assuming n::posint;

-(-1)^(n+i)*GAMMA(3/2+n)*GAMMA(-n+i-1/2)*GAMMA(n-i)/(Pi*GAMMA(1+n))

total1 := simplify(combine(expand(sum(eval(A,i=k),k=0..n-1))),size)
  assuming n::posint;

-2+4*GAMMA(3/2+n)/(Pi^(1/2)*GAMMA(1+n))

evalf(eval(total1, n = 6));

3.865234375

restart;

A := rsolve({a(0)=1/n,a(i)=((n-i+1)/(n-i)+1/(c*(n-i)))*a(i-1)},a)
  assuming n::posint;

(-1)^i*GAMMA((c*i-c*n-1)/c)*GAMMA(n-i)/(GAMMA(n+1)*GAMMA(-(c*n+1)/c))

total1 := simplify(sum(eval(A,i=k),k=0..n-1))
  assuming n::posint;

-c+c*(-1)^n*GAMMA(-1/c)/(GAMMA(n+1)*GAMMA((-c*n-1)/c))

evalf(eval(limit(total1,c=1),n=6));

6.

evalf(eval(total1,[c=2,n=6]));

3.865234375

simplify(limit(total1,c=1)) assuming n::posint;

n

simplify(limit(total1,c=2)) assuming n::posint;

-2+4*GAMMA(3/2+n)/(Pi^(1/2)*GAMMA(n+1))

 

 

Download rsolve_ex_simp.mw

If you put assumptions on only x, then coulditbe(y=1) evaluates to true. There's nothing preventing y from being equal to one, there.

You're also seeing behaviour of coulditbe and RETURN. The int procedure never actually gets invoked here. The arguments to the call are evaluated up front. The int procedure never gets the opportunity to make any inference that y is between 0 and the assumed x, or make that assumption internally.

restart;

trace(int):

int(RETURN(coulditbe(y = 1)), y = 0 .. x) assuming 0 < x, x < 1;

true

Download return_ex2.mw

But the bit about evaluation of arguments is more key here than RETURN quirks. The first argunment to int is evaluated before int does work. Even if you had f(coulditbe(y=1)) instead then that too would be evaluated before int got to do any computation (except automatic simplification), including making any inference or further assumption on the variable of integration.

The main thing happening here is that the int procedure gets the standard evaluation rules for procedure calls. Its arguments are evaluated up front. So the coulditbe is evaluated before any connection between y and assumed x can be made by int.

restart;

 

Below, the call f(...) and its own arguments are evaluated
up front, before int does any work or makes any relation or
new assumption about the variable of integration.

 

That is according to Maple's standard evaluation rules for

procedure calls.

 

int(f(coulditbe(y = 1)), y = 0 .. x) assuming 0 < x, x < 1;

f(true)*x

restart;
int(f(x,about(y),about(x)), y = 0 .. x) assuming 0 < x, x < 1;

y:
  nothing known about this object

Originally x, renamed x~:
  is assumed to be: RealRange(Open(0),Open(1))
 

f(x)*x

 

If we delay the evaluation of the integrand (first argument to int)
then int does get a chance to utilize the passed range info and
place a further assumption upon the variable of integration.

 

restart;
int('f(x,about(y),about(x))', y = 0 .. x) assuming 0 < x, x < 1;

Originally y, renamed y~:
  Involved in the following expressions with properties
    x-y assumed RealRange(Open(0),infinity)
  is assumed to be: RealRange(Open(0),infinity)
  also used in the following assumed objects
  [x-y] assumed RealRange(Open(0),infinity)

Originally x, renamed x~~:
  Involved in the following expressions with properties
    x-y assumed RealRange(Open(0),infinity)
  is assumed to be: RealRange(Open(0),Open(1))
  also used in the following assumed objects
  [x-y] assumed RealRange(Open(0),infinity)
 

x*f(x)

Download eval_rules_int_assuming.mw

And so delaying evaluation of the integrand would get the original example as the OP expected, because the int procedure would then get to examine the passed range and place further assumptions upon the variable of integration before the integrand got evaluated.

restart;

int('RETURN(coulditbe(y = 1))', y = 0 .. x) assuming 0 < x, x < 1;

false

int(RETURN(coulditbe(y = 1)), y = 0 .. x) assuming 0 < x, x < 1;

true

Download eval_rules_int_2.mw

It's not easy to give a Library command special evaluation rules, (eg. using type uneval for a procedure parameter) so that some of its arguments are not evaluated up front. Doing so would allow int to place assumptions on the variable of integration before its first argument the integrand were evaluated. It's very hard to make that work properly, in all corner-cases, for a complicated Library procedure. (In contrast, the add command is a kernel built-in, and the kernel can get it just right...)

The behaviour exhibited in the Question is not related to the "depth" that assuming can penetrate. The assuming mechanism would/should not utilize a range found in some general function call's arguments, to make a further assumptions. That would be misplaced as a general rule, though it might be reasonable as an int-specific action. [edit: Something like this might actually be going on, because assuming does have delayed evaluation.]

If you mean an object in Maple's own technical use of the term, then yes.

The object module can have its own ModulePrint command. (Unfortunately there's only one example on the ModulePrint Help page, and it's not a very interesting example.)

Here are a couple of examples from the GroupTheory package.

restart;

with(GroupTheory):

G := CyclicGroup( 14 );

_m139906040448192

showstat(G:-ModulePrint);


ModulePrint := proc(self)
local C;
   1   if IsWorksheetInterface("Standard") then
   2       Typesetting:-msub(Typesetting:-mi("C"),Typesetting:-mn(convert(self
             :-n,'string')))
       else
   3       C := `tools/gensym`("C");
   4       C[self:-n]
       end if
end proc
 

g1 := Group({[[1,2]], [[1,2,3],[4,5]]});

_m139905929780160

showstat(g1:-ModulePrint);


ModulePrint := proc(self, $)
local gen, cyc;
   1   if self:-generator_list = undefined then
   2       nprintf("Ca permutation group on %d letter%sD",self:-n,ifelse(
             self:-n = 1,"","s"))
       elif GroupTheory:-PermutationGroupImplementation:-`small?`(`+`(op(
         map(function:-perm_supplen,self:-generator_list)))) then
   3       if IsWorksheetInterface("Standard") then
   4           Typesetting:-mfenced(op(map(proc( gen )
                   local cyc;
                   if gen = [] or gen = Perm([]) then
                       NULL;
                   elif type(gen,'Perm') then
                       gen;
                   else
                       Typesetting:-mrow(seq(Typesetting:-mfenced(op(map(
                         Typesetting:-mn@convert,cyc,':-string'))),cyc = gen))
                         ;
                   end if;
               end proc,self:-generator_list)),':-open' = "&lang;",':-close' =
               "&rang;")
           else
   5           `tools/gensym`("<,>")(op(map(g -> `if`(type(g,'Perm'),:-
                 print_preprocess(g),:-`.`(op(map(``@op,g)))),self:-
                 generator_list)))
           end if
       else
   6       nprintf(
             "Ca permutation group on %d letter%s with %d generator%sD",
             self:-n,ifelse(self:-n = 1,"","s"),:-numelems(self:-
             generator_list),ifelse(:-numelems(self:-generator_list) = 1,"",
             "s"))
       end if
end proc
 

 

 

Download ModulePrint_ex1.mw

The lack of automatic combining/simplification of units in the resulting Vector seems related to using elementwise +~ . If I instead use good ol' map then it automatically combines. I'll submit a report about that aspect.

I'd have expected to see a result where the Res2 entries were in terms of Unit(s) the default unit for dimension length in the default SI system.

If I set the default unit for dimension length to minutes (instead of seconds in the default SI system) then the top-level arithmetic automatically gets to Unit(min) here.

QuestionMP_ac.mw

I don't know how that'd pan out for more involved examples that you might have.

The following attachment contains as much as I was able to recover.

Fysik_1_F24_-_Opgaveregning_ac3.mw

Your original was last saved with Maple 2023. I suggest you upgrade to Maple 2024, if possible, as it seems to have less instances of this kind of problem.

Up until Maple 2022.2 simplify would apply the custom routine separately to any non-numeric side of an equation. It has never worked on an equation as a whole; only on both sides separately.

Hence, even when the extension mechanism was previously working, your example's (rhs-lhs) is misplaced since the custom procedure doesn't receive a whole equation.

Here I use M2022.2,

restart;

eq := (a*x + b)/(c*x + d) = 1:

`simplify/nodenom`:= x -> (numer@(lhs - rhs) = 0)(x):
trace(`simplify/nodenom`):

simplify(eq, nodenom);

{--> enter \`simplify/nodenom\`, args = (a*x+b)/(c*x+d)

<-- ERROR in \`simplify/nodenom\` (now in \`simplify/do\`) = invalid input: %1 received %2, which is not valid for its %-3 argument, %4, lhs, (a*x+b)/(c*x+d), 1, expr}

Error, (in evalapply) invalid input: lhs received (a*x+b)/(c*x+d), which is not valid for its 1st argument, expr


Download simp_ext_1.mw

restart;
`simplify/F` := u->G(u):

eq := (a*x + b)/(c*x + d) = 11/3:
simplify(eq, F);

G((a*x+b)/(c*x+d)) = 11/3

eq := (a*x + b)/(c*x + d) = sqrt(2):
simplify(eq, F);

G((a*x+b)/(c*x+d)) = G(2^(1/2))

eq := (a*x + b)/(c*x + d) = y:
simplify(eq, F);

G((a*x+b)/(c*x+d)) = G(y)


Download simp_ext_3.mw

So even where that classic extension mechanism for simplify was functioning it seems like not what you're after, because of this mapping to both sides of equations rather than treating them whole.

In Maple 2023.2 and 2024.0 those examples are not invoking the custom routine at all. (I haven't tracked down the precise reason, perhaps in `simplify/do`. It does check that `simplify/denom` is the name of a procedure, rather than throw an error about an unexpected argument to simplify. I will submit a bug report against that regression, but as explained a fix for that wouldn't help your example.)

The mechanism (when previously not busted) does operate on unevaluated function calls to nodenomsimp_ext_4.mw But that just makes more acute the following query, which could be asked regardless: What would be the benefit to you of calling simplify(eq, nodenom) when you could just as easily name the custom proc something shorter and apply it directly?

Are these the kinds of things you're trying to accomplish?

restart;

f := -4*sin(x) + 2*exp(y^2) + 5 - 5*cos(x^3)*sin(y^2) + 5*sinh(x^2);

-4*sin(x)+2*exp(y^2)+5-5*cos(x^3)*sin(y^2)+5*sinh(x^2)

p := proc(e)
  indets(f,And(`*`,satisfies(u->member(e,[op(u)]))))[];
end proc:

 

p(sin(x));

-4*sin(x)

p(sin(y^2));

-5*cos(x^3)*sin(y^2)

p(exp(y^2));

2*exp(y^2)

p(sinh(x^3)); # NULL

 

q := proc(e)
  indets(f,And(`*`,satisfies(u->membertype(specfunc(e),[op(u)]))));
end proc:

q(sin);

{-5*cos(x^3)*sin(y^2), -4*sin(x)}

q({sin,cos,sinh,exp});

{-5*cos(x^3)*sin(y^2), 2*exp(y^2), -4*sin(x), 5*sinh(x^2)}

map(q,[sin,cos,sinh,exp]);

[{-5*cos(x^3)*sin(y^2), -4*sin(x)}, {-5*cos(x^3)*sin(y^2)}, {5*sinh(x^2)}, {2*exp(y^2)}]


Download indets_ex.mw

If your Matrix M is datatype=float[8] then you could accelerate using either evalhf or Compile.

I use one of dharr's quicker procedures for the evalhf variant, but now faster.

The Compiled version is about 30 times faster than the "original"; it varies by run, and version.

I keep the original non-hardware-datatype constructions only for comparison.

restart;

kernelopts(version);

`Maple 2015.2, X86 64 LINUX, Dec 20 2015, Build ID 1097895`

N := 10^5:
L := 5:
M := LinearAlgebra:-RandomMatrix(N, L, generator=0..1):

P := [1,0,1]:
nC := numelems(P):

C:=[2,4,5];

[2, 4, 5]

Original

pattern := proc(n) local k;
  `if`(evalb(`and`(seq(M[n, C[k]]=P[k], k=1..nC))), 1, 0);
end proc:
t0 := time[real]():
add(pattern(n), n=1..N);
time[real]()-t0

12585

.256

Suppose we had instead constructed the data this way.

M8:=Matrix(M,datatype=float[8]):
C8:=Vector(C,datatype=float[8]):
P8:=Vector(P,datatype=float[8]):

pattern:=proc(n,nC,M,C,P)
  local k;
  for k to nC do
    if M[n,C[k]]<>P[k] then return 0 end if;
  end do;
  1
end proc:
t0 := time[real]():

trunc(evalhf(add(pattern(n,nC,M8,C8,P8), n=1..N)));
time[real]()-t0

12585

0.49e-1

Suppose we had instead construced the data in this way

M8:=Matrix(M,datatype=float[8]):
C4:=Vector(C,datatype=integer[4]):
P4:=Vector(P,datatype=integer[4]):

pattern:=proc(N::integer,nC::integer,M::Matrix(datatype=float[8]),
                                     C::Vector(datatype=integer[4]),
                                     P::Vector(datatype=integer[4]))
  local n::integer, k::integer, S::integer, ok::integer;
  S := 0;
  for n from 1 to N do
    ok := 1;
    for k to nC do
      if M[n,C[k]]<>P[k] then k := nC; ok := 0; end if;
    end do;
    if ok=1 then S := S + 1; end if;
  end do;
  S;
end proc:

cpattern:=Compiler:-Compile(pattern, 'inmem'=false):
t0 := time[real]():
cpattern(N,nC,M8,C4,P4);
time[real]()-t0

12585

0.9e-2


Download tests_ac1.mw

These are just toy examples, deliberately intended for illustration and comparison rather than some "best" way to do the computation. (Please don't respond with a better way to do it. That's not my point.)

One possibility is to split out your purely floating-point and evalhf'able computations into their own dedicated procedure(s), and then do any non-evalhf'able or symbolic operations separately. I don't bother showing that for the following example, because it's trivial.

But sometimes such splitting involves complicated rewriting of one's existing procedures (which already mix those two aspects in more involved ways). Sometimes one of the following simpler code revisions is possible instead of such inconvenience.


No special acceleration.

restart;
f0 := proc()
  local x,res,y;
  res := add( sin(1.0*x), x=1..10^5);
  res + fsolve(y^3-1);
end proc:
CodeTools:-Usage( f0() );

memory used=0.62GiB, alloc change=33.00MiB, cpu time=4.38s, real time=4.39s, gc time=337.42ms

2.847777198


A procedure can "escape" evalhf mode temporarily, even for
non-evalhf'able computation (which returns a float result or NULL,
yet which might internally use some symbolic names), by using eval.

restart;
f1 := proc()
  local x,res,y;
  res := add( sin(1.0*x), x=1..10^5);
  res + eval(fsolve(y^3-1));
end proc:
CodeTools:-Usage( evalhf(f1()) );

memory used=2.86MiB, alloc change=0 bytes, cpu time=35.00ms, real time=36.00ms, gc time=0ns

2.84777710363033965


By having option hfloat on the procedure, its float computations
get done using HFloat's, which can be fast because quite a lot of
arithmetic, and elementary functions can deal with those quickly.

It's not as fast as operating in evalhf mode, but often can be faster
for some basic floating-point computations than when done with no
special acceleration.

restart;
f2 := proc()
  option hfloat;
  local x,res,y;
  res := add( sin(1.0*x), x=1..10^5);
  res + fsolve(y^3-1);
end proc:
CodeTools:-Usage( f2() );

memory used=12.28MiB, alloc change=2.00MiB, cpu time=114.00ms, real time=114.00ms, gc time=8.30ms

HFloat(2.847777103630354)

 

Download hfloat_evalhf_none.mw

restart;

TSelided := proc(ee, L:=infinity) local foo, oldom, u;
   oldom := kernelopts(':-opaquemodules'=false);
   try foo := SubexpressionMenu:-truncateTypeMK(ee, L);
   catch: finally kernelopts(':-opaquemodules'=oldom); end try;
   eval(parse(nprintf("%s",(String(foo)[3..-2]))),
     [seq(u=Typesetting[u],
          u=[':-mfenced',':-mfrac',':-mi',':-mio',':-mn',':-mo',':-mover',':-mroot',':-mrow',
             ':-ms',':-mscripts',':-mspace',':-msqrt',':-mstyle',':-msub',':-msubsup',
             ':-msup',':-mtable',':-mtd',':-mtext',':-mtr',':-munder',':-munderover'])]);
end proc:

QQFProj := proc(q12::algebraic, q23::algebraic,
                q34::algebraic, q14::algebraic,
                prnt::boolean:=true, #{columns:=[QQFproj,Q13proj,Q24proj]}
                L::posint:=32)
  description "Projective quadruple quad formula and intermediate 13 and 24 quads.
               Useful for cyclic quadrilaterals";
  local qqf,q13,q24, sub1,sub2,sub3, R,values,DF,lens;
  uses DocumentTools;
  sub1:= (q12 + q23 + q34 + q14)^2 - 2*(q12^2 + q23^2 + q34^2 + q14^2) ;
  sub2:=-4*(q12*q23*q34+q12*q23*q14+q12*q34*q14+q23*q34*q14)+8*q12*q23*q34*q14;
  sub3:=64*q12*q23*q34*q14*(1-q12)*(1-q23)*(1-q34)*(1-q14);
  qqf:=((sub1+sub2)^2=sub3);
  q13:=((q12-q23)^2-(q34-q14)^2)/(2*(q12+q23-q34-q14-2*q12*q23+2*q34*q14));#check this
  q24:=((q23-q34)^2-(q12-q14)^2)/(2*(q23+q34-q12-q14-2*q23*q34+2*q12*q14));#check this
  if prnt then
   values:=<qqf,q13,q24>;
   DF:=DataFrame(TSelided~(<values>,L), columns=[`"Values Equations"`],
                 rows=[`#1  QQF`,`#2  Q13`,`#3  Q24`]);
   lens := [4 +8* max(op(length~(RowLabels(DF)))),
            min(ceil(500*sqrt(L)/max(op(length~(RowLabels(DF))))),1000)];
   Tabulate(DF,width=add(lens),widthmode = pixels,weights = lens);
  end if;
  return qqf,q13,q24
end proc:

 

q12:=1/2:q23:=9/10:q34:=25/26:q41:=9/130: #Cyclic quadrilateral
q12:=sqrt(17+a)/2:q23:=expand(r^2+t^2)^2/10:q34:=expand((a+b+c)^4/26):q41:=sqrt(17+b)/130:

 

Q := [QQFProj(q12,q23,q34,q41,true)];

 

QQFProj(q12,q23,q34,q41,true,80);

QQFProj(q12,q23,q34,q41,true,12);

Q[1];

(((1/2)*(17+a)^(1/2)+(1/10)*(r^2+t^2)^2+(1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4+(1/130)*(17+b)^(1/2))^2-35921/4225-(1/2)*a-(1/50)*(r^2+t^2)^4-2*((1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4)^2-(1/8450)*b-(1/5)*(17+a)^(1/2)*(r^2+t^2)^2*((1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4)-(1/650)*(17+a)^(1/2)*(r^2+t^2)^2*(17+b)^(1/2)-(1/65)*(17+a)^(1/2)*((1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4)*(17+b)^(1/2)-(1/325)*(r^2+t^2)^2*((1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4)*(17+b)^(1/2)+(1/325)*(17+a)^(1/2)*(r^2+t^2)^2*((1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4)*(17+b)^(1/2))^2 = (8/325)*(17+a)^(1/2)*(r^2+t^2)^2*((1/26)*a^4+(2/13)*a^3*b+(2/13)*a^3*c+(3/13)*a^2*b^2+(6/13)*a^2*b*c+(3/13)*a^2*c^2+(2/13)*a*b^3+(6/13)*a*b^2*c+(6/13)*a*b*c^2+(2/13)*a*c^3+(1/26)*b^4+(2/13)*b^3*c+(3/13)*b^2*c^2+(2/13)*b*c^3+(1/26)*c^4)*(17+b)^(1/2)*(1-(1/2)*(17+a)^(1/2))*(1-(1/10)*(r^2+t^2)^2)*(1-(1/26)*a^4-(2/13)*a^3*b-(2/13)*a^3*c-(3/13)*a^2*b^2-(6/13)*a^2*b*c-(3/13)*a^2*c^2-(2/13)*a*b^3-(6/13)*a*b^2*c-(6/13)*a*b*c^2-(2/13)*a*c^3-(1/26)*b^4-(2/13)*b^3*c-(3/13)*b^2*c^2-(2/13)*b*c^3-(1/26)*c^4)*(1-(1/130)*(17+b)^(1/2))

TSelided(Q[1], 32);

(((1/2)*sqrt(17+a)+(1/10)*(r^2+t^2)^2+(1/26)*a^4+2*a^3*`&hellip;`*(1/13)+`&hellip;`)^2-`&hellip;`)^2 = `&hellip;`

 

 

2024-05-14_Q_Data_Table_Limit_Equation_lentgh_ac.mw

 

You asked, "What is the problem?"

The problem is that the answer depends on the variables. The answer changes according to the signs of both a and b, even if all of a,b,h are taken as real.

restart;

r := a + (b - a)*z/h:

x1 := sqrt(r^2 - y^2):


The result depends on whether a and b are positive or negative.

simplify( int(int(int(1, x = -x1 .. x1), y = -r .. r), z = 0 .. h) )
   assuming h::real, a>0, b>0;

(1/3)*(a^2+a*b+b^2)*Pi*h

simplify( int(int(int(1, x = -x1 .. x1), y = -r .. r), z = 0 .. h) )
   assuming h::real, a<0, b>0;

-Pi*(a^3+b^3)*h/(-3*b+3*a)

simplify( int(int(int(1, x = -x1 .. x1), y = -r .. r), z = 0 .. h) )
   assuming h::real, a<0, b<0;

-(1/3)*(a^2+a*b+b^2)*Pi*h


Download trip_int_ex.mw

Your call InitState(5,5) calls Coherent(1,Pi/2,5) and that returns a 1-Vector.

Your call Coherent(5) returns a 5-Vector.

You've set up both InitState and Coherent with keyword parameters. You haven't set it up with optional ordered parameters.

When your InitState calls Coherent(1,Pi/2,5) then that "1" becomes the value of n_max (the first required positional parameter). The other two arguments, Pi/2 and 5, are thrown away. In particular, that's not the way to pass them along for the zeta and phi keyword parameters of your Coherent.

Perhaps you instead intended something like this?

InitState := proc({zeta:=1,phi:=Pi/2,L:=1,sigma:=0.01,beta:=0.02,k0:=-5*Pi},d1,d2) 
  local z1, Z0;
  z1 := Coherent(d1,':-zeta'=zeta,':-phi'=phi);
end proc:

That would utilize the value of d1 for the required parameter of Coherent. It would also pass along the values of zeta and phi to Coherent.

See next attachment for more detail.

test3_2_ac.mw

If you wanted to use optional ordered parameters instead of keyword options then you'd also have to shift the required positional parameters to the front. See next attachment. Notice the absence of {...} braces around the declarations.

test3_2_acc.mw

See also here.

Your previous Question was marked as Maple 2023, so I'm guessing that's the version you're using now.

In Maple 2024.0 the plot3d command supports the colorbar option (introduced for 2D plots in M2023).

But in fact one can attach a COLBAR plotting substructure into a PLOT3D plotting structure, even in M2023.

In the following example the image of the plot is from a single file that I manually exported using right-click. That single image file contains both surface and colorbar.

Here I used the 2D contourplot command as a quick way to construct the colorbar. But it sound as if you've already constructed your own 2D color-bar (for use in your Tabulate). Just wrap that 2D color-bar plot in a call to COLBAR, display that to the desired smaller size, and add that as a last argument to the PLOT3D structure.

restart;

kernelopts(version);

`Maple 2023.2, X86 64 LINUX, Nov 24 2023, Build ID 1762575`

ars := sin(x*y), x=-3..3, y=-3..3, colorscheme=["Red","Green","Blue"]:
PLOT3D(op(plot3d(ars,size=[400,400])),
       subsindets(indets(plots:-contourplot(ars),specfunc(COLBAR))[1],
                  specfunc(PLOT),P->plots:-display(P,size=[200,200])));

 

Download colrbar3d.mw

First 21 22 23 24 25 26 27 Last Page 23 of 336