Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Here is a toy example

L:=<<1 | 2 | 3>; <4 | 5 | 6>>; 
(L[1,2], L[2,3]):=(0 $ 2):

As expected, L now equals <<1 | 0 | 3>; <4 | 5 | 0>>

Now I want to make a bulk assigment with the use of seq operator

(seq('L'[q,  q+1] , q=1..2)) := (0 $ 2);

but it fails. Nevertheless

seq('L'[q,  q+1] , q=1..2)

works as needed and returns unevaluated L[1,2], L[2,3]

I would like to simulate the evolution of the so-called B, C, K, W system and SKI combinator calculus in Maple.
The rewrite rules of them are simple: 

S(x)(y)(z)=x(z)(y(z))
K(x)(y)=x, and 
I(x)=x. (Note that since  is protected, I shall use  hereafter.)

However, if I try to evaluate the following example given in the  article, 

Maple will only return an unchanged result: 

restart;
applyrule([cS(x::anything)(y::anything)(z::anything) = x(z)(y(z)), 
   cK(x::anything)(y::anything) = x, cI(x::anything) = x], 
  cS(cK(cS(cI)))(cS(cK(cK))(cI))(x)(y)); # Unable to reduce??? 
 = 
              cS(cK(cS(cI)))(cS(cK(cK))(cI))(x)(y)

I believe that this is not an outlier.
Here are two additional instances: 

> rls := [cS(x::anything)(y::anything)(z::anything) = x(z)(y(z)), cK(x::anything)(y::anything) = x]:
> map2(applyrule, rls, [cS(cS(cS)(cS))(cS)(cS(cS))(cK), cS(cS(cS))(cS)(cS)(cS)(cS(cS)(cK(cK)))]);
                       [cS(cS(cS)(cS))(cS)(cS(cS))(cK), cS(cS(cS))(cS)(cS)(cS)(cS(cS)(cK(cK)))]

>

So why can't `applyrule` apply rules as desired? Meanwhile, how to automatically and thoroughly (like :-eval['recurse'] or MmaTranslator:-Mma:-ReplaceRepeated) apply those transformation rules to 

  1. , and

I have read something like How to apply a recursive rule in an expression? - MaplePrimes, but they are not the same issue.

I have this overloaded function foo(). 

restart;

foo:= overload(  
        [
        proc(A::integer,$)option overload;
            print("first one, _passed = ", _passed," _npassed = ",_npassed);             
        end proc,

        proc(A::integer,B::integer,$)option overload;
            print("second one  _passed = ", _passed," _npassed = ",_npassed);
        end proc
       ]);

Which works OK. so I can now do 

foo(1)
foo(1,2)

But I wanted to indicate that the proc returns say ::integer , and this where I am stuck, I do not know where to add this ::integer

With non-overloaded proc's, this is the syntax

foo:=proc(A::integer,$)::integer;
     ......
end proc;

but I can't do this with the overloaded function. If I type

foo:= overload(  
        [
        proc(A::integer,$)option overload;
            print("first one, _passed = ", _passed," _npassed = ",_npassed);             
        end proc,

        proc(A::integer,B::integer,$)option overload;
            print("second one  _passed = ", _passed," _npassed = ",_npassed);
        end proc
       ])::integer;

Maple simply does not like it. typing foo(1) now it just echos the definition back.

And these give syntax errors

foo:= overload(  
        [
        proc(A::integer,$)::integer option overload;
            print("first one, _passed = ", _passed," _npassed = ",_npassed);    
        end proc,

        proc(A::integer,B::integer,$)::integer option overload;
            print("second one  _passed = ", _passed," _npassed = ",_npassed);
        end proc
       ]);

Tried many other variations and looked at help but see nothing to far.

Can one add ::type to indicate type proc returns with overloaded proc?

Maple 2023.2.1

I tried to solve differential equations with boundary conditions, but I boundary conditions are tends to infinity. How to sol;ve this?N1.mw

I want to execute a function at least one time. So, I use do ... until ...

However, the function sometimes returns FAIL. So, I looked at help FAIL.

FAIL.mw

The while loop works. The until loop returns an error. evalb(testeq(...)=FAIL) seems overly complicated.

Tom Dean

hello maple team,

i'd really like to know more about the differences among the products ticked above in their different license types

thank you very much in advance for your help dear friends and some who are brothers in Christ Jesus

much Love and regards to you all

julio

I am starting a course on differential forms. They have introduced the wedge product by comparing it to the curl product. I can do it by hand. But I would like to do it in Maple. I tried to read the help page of with(difforms) but I cannot see how to do it. And to add to the complication, since my keyboard is in French, I don't know how to insert the circumflex accent right after &. Maybe I should just wait that more theory is done, but just for the principle, I would like to be able to do it. For example, the vectors are:

a=(1, 3,-2)

b=(5, 2, 8)

Thank you in advance for your help.

Mario

Hi Dear

Is it possible to know the algorithm and method behind a specific Maple command? 

Thank you in advance.

The attached integral is plotted quite quickly, but the search for the maximum and for the inverses of function values takes time. Can the search be accelerated or is the integrand simply too complicated?

Int(22.89730452*exp(-3.373250126*10^6*x^2)*sqrt(2)*(erf(1298.701299*sqrt(2)*(sqrt(2.500000000*10^(-7)-x^2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*sqrt(2)*(sqrt(2.500000000*10^(-7)-x^2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3, method = _d01ajc)

Int(22.89730452*exp(-3373250.126*x^2)*2^(1/2)*(erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3, method = _d01ajc)

(1)

plot(Int(22.89730452*exp(-3373250.126*x^2)*2^(1/2)*(erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3, method = _d01ajc), y = 0 .. .25)

 

unapply(int(op(1 .. 2, Int(22.89730452*exp(-3373250.126*x^2)*2^(1/2)*(erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3, method = _d01ajc))), y)

proc (y) options operator, arrow; int(22.89730452*exp(-3373250.126*x^2)*2^(1/2)*(erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*2^(1/2)*((0.2500000000e-6-x^2)^(1/2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3) end proc

(2)

CodeTools:-Usage(Optimization:-Maximize(proc (y) options operator, arrow; int(22.89730452*exp(-3373250.126*(x^2))*(2^(1/2))*(erf(1298.701299*(2^(1/2))*((0.2500000000e-6-x^2)^(1/2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*(2^(1/2))*((0.2500000000e-6-x^2)^(1/2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3) end proc, 0 .. .15))

[HFloat(0.0356073228322897), Vector[column](%id = 36893490875463313756)]

(3)

CodeTools:-Usage(fsolve((proc (y) options operator, arrow; int(22.89730452*exp(-3373250.126*(x^2))*(2^(1/2))*(erf(1298.701299*(2^(1/2))*((0.2500000000e-6-x^2)^(1/2)+(1/40)*y-0.1540000000e-2))+erf(1298.701299*(2^(1/2))*((0.2500000000e-6-x^2)^(1/2)-(1/40)*y+0.1540000000e-2))), x = -0.5000000000e-3 .. 0.5000000000e-3) end proc)-0.5e-2, 0 .. .15, maxsols = 2, method = subdivide))

0.2456248637e-1, 0.9863751363e-1

(4)

Download slow_maximize_and_fsolve.mw

I am trying to solve three nonlinear equation for A, B and P. f solve is not working for them.

File ling: SOlve.mw

Dear all

I would like to plot a rectangular cylinder,, but the code does not generates a cylinder 

rectangular_cylinder.mw

Thank you in advance for your help 

Consider the following simple procedure:
 

restart;
p:=proc(x::{realcons,{set,list}(realcons)} ) x end proc;
p(8);
p({8,9});
p([7,8]);

I would like to be able to do something like this instead:

q:=proc(x::{ID,set,list}(realcons) ) x end proc;
## ID(realcons) should just be realcons.
q(8); ## Obviously we get an error.
q({8,9}); #OK
q([7,8]); #OK

In Q below ID is simply s->s, but that won't work in q.
Q works because the type check evaluates its arguments first.
 

Q:=proc(x) 
    if type(x,{s->s,list,set}(realcons)) then 
      x 
    else 
      error "%1 expects its first argument to be of type %2", procname,{s->s,list,set}(realcons)
    end if
end proc;
Q(8);
Q({8,9});
Q([7,8]);

I believe that Carl Love had a solution on MaplePrimes some years ago, but I can't find it.

Hi,

I am looking to integrate this LaTeX code into Maple...Any ideas? Thanks

\begin{tikzpicture} \tkzTabInit{$x$ / 1 , $f(x)$ / 2}{$-\infty$, $-5$, $-3$, 0, $+\infty$} \tkzTabVar{-/ $-\infty$, +CD-/ $0$/ $2$, +D+/ $0$ /$0$, -V-/ $-2$ / $3$, +/ $+\infty$} \end{tikzpicture}

The Maple 2023 System Requirements    shows the fact , that only older MATLAB versions (2021b, 2021a, 2020b) are supported. Does it mean that the latest versions of MATLAB (2022ab, 2023ab) are not supported anymore? 

Good day everyone,

I am writing a numerical code using dsolve which works fine but I have a challenge in inputting the previous answers in the subsequent ones. For example, how can I substitute the solutions in S1 into equ11, equ22, equ33, and equ44 in the link below? 

Thank you very much as I will be expecting responses from you soon.

New.mw

First 25 26 27 28 29 30 31 Last Page 27 of 2097