Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

For example when I run a worksheet, if there is an error, maple simply prints the error and moves on to the next step. Is there a way to do that with loops.
The try and catch statements are a bit cumbersome and sometimes you have to predict the kind of error statements you may face.

Dear all

I  have a PDE, I would like to substitute the funciton T by another funciton 

How transform the old PDE to a new PDE

transfirm_equation_using_change_variable.mw

thank you

I will have excel sheet with minium 500 coulmns and 1000 rows say

For sample to explain my question I attach a demo excel

All my columns have headers

I am looking to find all 2 way multiplication and add them as columns to my excel sheet and return it as a new excel sheet say

The column names for the new 2 way column should be like the

header name of column you are multiply * the name of the other columsn

Now in sample file if i multiple column with name A with column with name B I get a new column with header A*B the header name should be inserted and

Below that all the elements of that A column multiplied  with that of B should come

I am looking to form columns for all possible2  way multiplication for the excel I will give.

As you can see the demo file

Excel_to_explain.xlsx

Kind help please


This code enables building Centered Divided Difference (CDD) approximations of derivatives of a univariate function.
Depending on the stencil we choose we can get arbitrary high order approximations.

The extension to bivariate functions is based upon what is often named tensorization in numerical analysis: for instance diff(f(x, y), [x, y] is obtained this way (the description here is purely notional)

  1. Let CDD_x the CDD approximation of diff( f(x), x) ) .
    CDD_x is a linear combination of shifted replicates of f(x)
  2. Let s one of this shifted replicates
    Let CDD_y(s) the CDD approximation of diff( s(y), y) ) .
  3. Replace in CDD_x all shifted replicates by their corresponding expression CDD_y(s)


REMARKS:

  • When I write for instance "approximation of diff(f(x), x)", this must be intended as a short for "approximation of diff(f(x), x) at point x=a"
  • I agree that a notation like, for instance, diff(f(a), a) is not rigourous and that something like a Liebnitz notation would be better. Unfortunately I don't know how to get it when I use mtaylor.
     

restart:


CDDF stands for Cendered Divided Difference Formula

CDDF := proc(f, A, H, n, stencil)
  description "f = target function,\nA = point where the derivatives are approximated,\nH = step,\nn = order of the derivative,\nstencil = list of points for the divided differenceCDDF\n";
  local tay, p, T, sol, unknown, Unknown, expr:

  tay := (s, m) -> convert(
                     eval(
                       convert(
                         taylor(op(0, f)(op(1, f)), op(1, f)=A, m),
                         Diff
                       ),
                       op(1, f)=A+s*H),
                     polynom
                   ):

  p   := numelems(stencil):
  T   := add(alpha[i]*tay(i, p+1), i in stencil):
  T   := convert(%, diff):

  if p > n+1 then
    sol := solve([seq(coeff(T, h, i)=0, i in subsop(n+1=NULL, [$0..p]))], [seq(alpha[i], i in stencil)])[];
  else
    sol := solve([seq(coeff(T, H, i)=0, i in subsop(n+1=NULL, [$0..n]))], [seq(alpha[i], i in stencil)])[];
  end if:

  if `and`(is~(rhs~(sol)=~0)[]) then
    WARNING("no solution found"):
    return
  else
    unknown := `union`(indets~(rhs~(sol))[])[];
    Unknown := simplify(solve(eval(T, sol) = Diff(op(0, f)(A), A$n), unknown));
    sol     := lhs~(sol) =~ eval(rhs~(sol), unknown=Unknown);
    expr    := normal(eval(add(alpha[i]*op(0, f)(A+i*H), i in stencil), sol));
  end if:

  return expr
end proc:

Describe(CDDF)


# f = target function,
# A = point where the derivatives are approximated,
# H =
# step,
# n = order of the derivative,
# stencil = list of points for the divided
# differenceCDDF
#
CDDF( f, A, H, n, stencil )
 

 

# 2-point approximation of diff(f(x), x) | x=a

CDDF(f(x), a, h, 1, [-1, 1]);
convert(simplify(mtaylor(%, h=0, 4)), Diff);

-(1/2)*(f(a-h)-f(a+h))/h

 

Diff(f(a), a)+(1/6)*(Diff(Diff(Diff(f(a), a), a), a))*h^2

(1)

# 3-point approximation of diff(f(x), x$2) | x=a

CDDF(f(x), a, h, 2, [-1, 0, 1]);
convert(simplify(mtaylor(%, h=0)), Diff);

-(-f(a-h)+2*f(a)-f(a+h))/h^2

 

Diff(Diff(f(a), a), a)+(1/12)*(Diff(Diff(Diff(Diff(f(a), a), a), a), a))*h^2

(2)

# 5-point pproximation of diff(f(x), x$2) | x=a

CDDF(f(x), a, h, 2, [$-2..2]);
convert(simplify(mtaylor(%, h=0, 8)), Diff);

-(1/12)*(f(a-2*h)-16*f(a-h)+30*f(a)-16*f(a+h)+f(a+2*h))/h^2

 

Diff(Diff(f(a), a), a)-(1/90)*(Diff(Diff(Diff(Diff(Diff(Diff(f(a), a), a), a), a), a), a))*h^4

(3)

# 7-point approximation of diff(f(x), x$2) | x=a

CDDF(f(x), a, h, 2, [$-3..3]);
# simplify(taylor(%, h=0, 10));
convert(simplify(mtaylor(%, h=0, 10)), Diff);

-(1/180)*(-2*f(a-3*h)+27*f(a-2*h)-270*f(a-h)+490*f(a)-270*f(a+h)+27*f(a+2*h)-2*f(a+3*h))/h^2

 

Diff(Diff(f(a), a), a)+(1/560)*(Diff(Diff(Diff(Diff(Diff(Diff(Diff(Diff(f(a), a), a), a), a), a), a), a), a))*h^6

(4)

# 4-point staggered approximation of diff(f(x), x$3) | x=a

CDDF(f(x), a, h, 3, [seq(-3/2..3/2, 1)]);
convert(simplify(mtaylor(%, h=0, 6)), Diff);

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

 

Diff(Diff(Diff(f(a), a), a), a)+(1/8)*(Diff(Diff(Diff(Diff(Diff(f(a), a), a), a), a), a))*h^2

(5)

# 6-point staggered approximation of diff(f(x), x$3) | x=a

CDDF(f(x), a, h, 3, [seq(-5/2..5/2, 1)]);
# simplify(taylor(%, h=0, 8));
convert(simplify(mtaylor(%, h=0, 8)), Diff);

(1/8)*(f(a-(5/2)*h)-13*f(a-(3/2)*h)+34*f(a-(1/2)*h)-34*f(a+(1/2)*h)+13*f(a+(3/2)*h)-f(a+(5/2)*h))/h^3

 

Diff(Diff(Diff(f(a), a), a), a)-(37/1920)*(Diff(Diff(Diff(Diff(Diff(Diff(Diff(f(a), a), a), a), a), a), a), a))*h^4

(6)

# 5-point approximation of diff(f(x), x$4) | x=a

CDDF(f(x), a, h, 4, [$-2..2]);
convert(simplify(mtaylor(%, h=0, 8)), Diff);

(f(a-2*h)-4*f(a-h)+6*f(a)-4*f(a+h)+f(a+2*h))/h^4

 

Diff(Diff(Diff(Diff(f(a), a), a), a), a)+(1/6)*(Diff(Diff(Diff(Diff(Diff(Diff(f(a), a), a), a), a), a), a))*h^2

(7)

# 7-point approximation of diff(f(x), x$4) | x=a

CDDF(f(x), a, h, 4, [$-3..3]);
convert(simplify(mtaylor(%, h=0, 10)), Diff);

(1/6)*(-f(a-3*h)+12*f(a-2*h)-39*f(a-h)+56*f(a)-39*f(a+h)+12*f(a+2*h)-f(a+3*h))/h^4

 

Diff(Diff(Diff(Diff(f(a), a), a), a), a)-(7/240)*(Diff(Diff(Diff(Diff(Diff(Diff(Diff(Diff(f(a), a), a), a), a), a), a), a), a))*h^4

(8)


A FEW 2D EXTENSIONS

# diff(f(x, y), [x, y]) approximation over a (2 by 2)-point stencil

stencil := [-1, 1]:

# step 1: approximate diff(f(x, y), x) over stencil < stencil >

fx  := CDDF(f(x), a, h, 1, stencil):
fx  := eval(% , f=(u -> f[u](y))):
ix  := [indets(fx, function)[]]:

# step 2: approximate diff(g(y), y) over stencil < stencil > where
#         g represents any function in fx.

fxy := add(map(u -> CDDF(u, b, k, 1, stencil)*coeff(fx, u), ix)):

# step 3: rewrite fxy in a more convenient form

[seq(u=op([0, 0], u)(op([0, 1], u), op(1, u)), u in indets(fxy, function))]:
fxy := simplify( eval(fxy, %) );

convert(mtaylor(fxy, [h=0, k=0]), Diff)

(1/4)*(f(a-h, b-k)-f(a-h, b+k)-f(a+h, b-k)+f(a+h, b+k))/(k*h)

 

Diff(Diff(f(a, b), a), b)+(1/6)*(Diff(Diff(Diff(Diff(f(a, b), a), a), a), b))*h^2+(1/6)*(Diff(Diff(Diff(Diff(f(a, b), a), b), b), b))*k^2

(9)

# Approximation of diff(f(x, y), [x, x, y, y] a (3 by 3)-point stencil


stencil := [-1, 0, 1]:

# step 1: approximate diff(f(x, y), x) over stencil < stencil >

fx  := CDDF(f(x), a, h, 2, stencil):
fx  := eval(% , f=(u -> f[u](y))):
ix  := [indets(fx, function)[]]:

# step 2: approximate diff(g(y), y) over stencil < stencil > where
#         g represents any function in fx.

fxy := add(map(u -> CDDF(u, b, k, 2, stencil)*coeff(fx, u), ix)):

# step 3: rewrite fxy in a more convenient form

[seq(u=op([0, 0], u)(op([0, 1], u), op(1, u)), u in indets(fxy, function))]:
fxy := simplify( eval(fxy, %) );

convert(mtaylor(fxy, [h=0, k=0], 8), Diff)

-(2*f(a, b-k)-4*f(a, b)+2*f(a, b+k)-f(a-h, b-k)+2*f(a-h, b)-f(a-h, b+k)-f(a+h, b-k)+2*f(a+h, b)-f(a+h, b+k))/(h^2*k^2)

 

Diff(Diff(Diff(Diff(f(a, b), a), a), b), b)+(1/12)*(Diff(Diff(Diff(Diff(Diff(Diff(f(a, b), a), a), a), a), b), b))*h^2+(1/12)*(Diff(Diff(Diff(Diff(Diff(Diff(f(a, b), a), a), b), b), b), b))*k^2

(10)

# Approximation of diff(f(x, y), [x, x, y] a (3 by 2)-point stencil

stencil_x := [-1, 0, 1]:
stencil_y := [-1, 1]:

# step 1: approximate diff(f(x, y), x) over stencil < stencil >

fx  := CDDF(f(x), a, h, 2, stencil_x):
fx  := eval(% , f=(u -> f[u](y))):
ix  := [indets(fx, function)[]]:

# step 2: approximate diff(g(y), y) over stencil < stencil > where
#         g represents any function in fx.

fxy := add(map(u -> CDDF(u, b, k, 1, stencil_y)*coeff(fx, u), ix)):

# step 3: rewrite fxy in a more convenient form

[seq(u=op([0, 0], u)(op([0, 1], u), op(1, u)), u in indets(fxy, function))]:
fxy := simplify( eval(fxy, %) );

convert(mtaylor(fxy, [h=0, k=0], 6), Diff)

(1/2)*(2*f(a, b-k)-2*f(a, b+k)-f(a-h, b-k)+f(a-h, b+k)-f(a+h, b-k)+f(a+h, b+k))/(h^2*k)

 

Diff(Diff(Diff(f(a, b), a), a), b)+(1/12)*(Diff(Diff(Diff(Diff(Diff(f(a, b), a), a), a), a), b))*h^2+(1/6)*(Diff(Diff(Diff(Diff(Diff(f(a, b), a), a), b), b), b))*k^2

(11)

# Approximation of the laplacian of f(x, y)

stencil := [-1, 0, 1]:

# step 1: approximate diff(f(x, y), x) over stencil < stencil >

fx  := CDDF(f(x), a, h, 2, stencil):
fy  := CDDF(f(y), b, k, 2, stencil):

fxy := simplify( eval(fx, f=(u -> f(u, b))) + eval(fy, f=(u -> f(a, u))) );

convert(mtaylor(fxy, [h=0, k=0], 6), Diff)

(f(a-h, b)-2*f(a, b)+f(a+h, b))/h^2+(f(a, b-k)-2*f(a, b)+f(a, b+k))/k^2

 

Diff(Diff(f(a, b), a), a)+Diff(Diff(f(a, b), b), b)+(1/12)*(Diff(Diff(Diff(Diff(f(a, b), a), a), a), a))*h^2+(1/12)*(Diff(Diff(Diff(Diff(f(a, b), b), b), b), b))*k^2

(12)

 


 

Download CDD.mw

Hello!

I have changed the the global character size from 12 to 14 but it is not stable. Suddenly size 12 is coming up when a try to copy a row to a another row in the same worksheet.

It is very annoying!!

Any tips????

Regards

Kjell

Recently Mapleprimes user @vs140580  asked here about finding the shortest returning walk in a graph (explained more below). I provided an answer using the labelled adjacency matrix. @Carl Love pointed out that the storage requirements are significant. They can be reduced by storing only the vertices in the walks and not the walks themselves. This can be done surprisingly easily by redefining how matrix multiplication is done using Maple's LinearAlgebra:-Generic package.

(The result is independent of the chosen vertex.)

restart

with(GraphTheory)

Consider the following graph. We want to find, for a given vertex v, the shortest walk that visits all vertices and returns to v. A walk traverses the graph along the edges, and repeating an edge is allowed (as distinct from a path, in which an edge can be used only once).

G := AddVertex(PathGraph(5), [6, 7]); AddEdge(G, {{3, 7}, {4, 6}, {6, 7}}); DrawGraph(G, layout = circle, size = [250, 250])

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7], Array(1..7, {(1) = {2}, (2) = {1, 3}, (3) = {2, 4}, (4) = {3, 5}, (5) = {4}, (6) = {}, (7) = {}}), `GRAPHLN/table/2`, 0)

n := NumberOfVertices(G)

7

A := AdjacencyMatrix(G)

As is well known, the (i, j) entry of A^k gives the number of walks of length k between vertices i and j. The labelled adjacency matrix shows the actual walks.

Alab := `~`[`*`](A, Matrix(n, n, symbol = omega))

Matrix(%id = 36893490455680637396)

For example, the (3,3) entry of Alab^2 has 3 terms, one for each walk of length 2 that starts and ends at vertex 3. The `&omega;__i,j` factors in a term give the edges visited.

So the algorithm to find the shortest walk is to raise Alab to successively higher powers until one of the terms in the diagonal entry for the vertex of interest has indices for all the vertices.

Alab^2

Matrix(%id = 36893490455709504684)

The expressions for higher powers get very large quickly, so an algorithm that only retains the sets of vertices in each term as a set of sets will use less storage space. So we can consider the following modified labelled adjacency matrix.

B := Matrix(n, n, proc (i, j) options operator, arrow; if A[i, j] = 1 then {{i, j}} else {} end if end proc)

Matrix(%id = 36893490455703852204)

Now we need to modify how we do matrix multiplication, but Maple has the LinearAlgebra:-Generic package to do this. We can redefine addition and multiplication to operate correctly on the sets of sets.

Consider two sets of sets of vertices for walks.

a := {{7}, {1, 3}, {2, 6, 7}}; b := {{1, 2}, {2, 3, 8}}

{{7}, {1, 3}, {2, 6, 7}}

{{1, 2}, {2, 3, 8}}

Addition is just combining the possibilities, and set union will do this. And addition of "zero" should add no possibilities, so we take {} as zero.

`union`(a, b); `union`(a, {})

{{7}, {1, 2}, {1, 3}, {2, 3, 8}, {2, 6, 7}}

{{7}, {1, 3}, {2, 6, 7}}

Multiplication is just combining all pairs by union. Notice here that {7} union {1,3,5} and {1,5} union {3,7} give the same result, but that we do not get duplicates in the set.

{seq(seq(`union`(i, j), `in`(i, a)), `in`(j, b))}

{{1, 2, 3}, {1, 2, 7}, {1, 2, 3, 8}, {1, 2, 6, 7}, {2, 3, 7, 8}, {2, 3, 6, 7, 8}}

The unit for multiplication should leave the set of sets unchanged, so {{}} can be used

{seq(seq(`union`(i, j), `in`(i, a)), `in`(j, {{}}))}

{{7}, {1, 3}, {2, 6, 7}}

And we should check that zero multiplied by a is zero

{seq(seq(`union`(i, j), `in`(i, a)), `in`(j, {}))}

{}

Define these operations for the LinearAlgebraGeneric package:

F[`=`] := `=`; F[`/`] := `/`; F[`0`] := {}; F[`1`] := {{}}; F[`+`] := `union`; F[`*`] := proc (x, y) options operator, arrow; {seq(seq(`union`(i, j), `in`(i, x)), `in`(j, y))} end proc

Warning, (in F[*]) `j` is implicitly declared local

Warning, (in F[*]) `i` is implicitly declared local

Compare B^2 with Alab^2. We have lost information about the details of the walks except for the vertices visited.

LinearAlgebra:-Generic:-MatrixMatrixMultiply[F](B, B)

Matrix(%id = 36893490455680647164)

So here is a procedure for finding the length of the shortest walk starting and ending at vertex v.

WalkLength:=proc(G::Graph,v)
  uses GraphTheory;
  local x,y,i,j,vv,A,B,F,n,vertset;
  if IsDirected(G) then error "graph must be undirected" end if;
  if not member(v,Vertices(G),'vv') then error "vertex not in graph" end if;
  if not IsConnected(G) then return infinity end if;
  F[`=`]:=`=`:F[`/`]:=`/`: # not required but have to be specified
  F[`0`]:={}:
  F[`1`]:={{}}:
  F[`+`]:=`union`;
  F[`*`]:=(x,y)->{seq(seq(i union j, i in x), j in y)};
  n:=NumberOfVertices(G);
  vertset:={$(1..n)};
  A:=Matrix(n,n, (i, j)-> if AdjacencyMatrix(G)[i, j] = 1 then {{i, j}} else {} end if);
  B:=copy(A);
  for i from 2 do
    B:=LinearAlgebra:-Generic:-MatrixMatrixMultiply[F](B,A);
  until vertset in B[vv,vv];
  i;
end proc:

WalkLength(G, 1)

10

NULL

Download WalksGenericSetOfSets.mw

Here is an apparent instance: 

interface(version);

maximize((1+20230321)*x*y-(x^2+y^2)*(1/2))``

`Standard Worksheet Interface, Maple 2023.0, Windows 10, March 6 2023 Build ID 1689885`

 

0

(1)

NULL

Download incorrectAgain.mw

Why???
Quite evidently, its supremum cannot be 0. (There are, of course, other approaches to compute it symbolically, yet I just wonder about the cause of this bug.)

Dear all

I have an equation obtained from partial derivable of some functions, I would like to compute the limit when my variable named Pe goes to infinity. 

I hope to get a more appreciate presentation of my code to obtain the limit (  Pe -> + infty)

limit_infinity.mw

All derivative are well compute, but How can I add the limit as Pe goes to infinity

Thank you 

Why doesn't Maple simplify sin(x) / cos (y) as tan

restart

with(plottools)

with(plots)

with(CurveFitting)

Digits := 10

with(GaussInt)

w := GInearest(0+I)

I

(1)

NULL

"f(t):=7.0*(e)^((-(t-13180)^(2))/(2000000))+4.7*(e)^((-(t-16000)^(2))/(3200000)):"

p1 := plot(f(t), t = 0 .. 20000, color = green); plots[display]({p1})

 

NULL

D1 := 15

epsilon := 200000

L := 6500

v := .7

.7

(2)

t := 10000

10000

(3)

i = sqrt(-1)

i = I

(4)

"k(n) := evalf((2 *Pi*n)/(L))"

proc (n) options operator, arrow, function_assign; evalf(2*Pi*n/L) end proc

(5)

f(n) = (int(f(t)*exp(-w*k(n)*x), x = 0 .. L))/L

NULL

"C(x, t) :=  (&sum;) exp(-v* t*k(n)- D1 *t*(k(n)^())^(2)- epsilon *t*(k(n))^(4)) *f(n)* exp(w*k(n)* x)"

proc (x, t) options operator, arrow, function_assign; sum(exp(-v*t*k(n)-D1*t*k(n)^2-varepsilon*t*k(n)^4)*f(n)*exp(w*k(n)*x), n = 1 .. 10) end proc

(6)

uu10000 := [seq(evalf(C(L-j, t)), j = 0 .. 6500, 100)]

[0.8582270020e-37+0.7071768085e-46*I, 0.8542115620e-37-0.8289193755e-38*I, 0.8422030662e-37-0.1650065052e-37*I, 0.8223146210e-37-0.2455737186e-37*I, 0.7947335229e-37-0.3238382907e-37*I, 0.7597194496e-37-0.3990668010e-37*I, 0.7176019535e-37-0.4705546418e-37*I, 0.6687772885e-37-0.5376326775e-37*I, 0.6137045955e-37-0.5996735584e-37*I, 0.5529014934e-37-0.6560976155e-37*I, 0.4869391210e-37-0.7063782859e-37*I, 0.4164366719e-37-0.7500470239e-37*I, 0.3420554942e-37-0.7866976371e-37*I, 0.2644927960e-37-0.8159900244e-37*I, 0.1844750367e-37-0.8376532722e-37*I, 0.1027510610e-37-0.8514880864e-37*I, 0.2008503850e-38-0.8573685436e-37*I, -0.6275071112e-38-0.8552431450e-37*I, -0.1449829443e-37-0.8451351706e-37*I, -0.2258447115e-37-0.8271423331e-37*I, -0.3045824843e-37-0.8014357420e-37*I, -0.3804631338e-37-0.7682581907e-37*I, -0.4527807059e-37-0.7279217843e-37*I, -0.5208629116e-37-0.6808049422e-37*I, -0.5840773014e-37-0.6273487939e-37*I, -0.6418370476e-37-0.5680530177e-37*I, -0.6936062957e-37-0.5034711554e-37*I, -0.7389050434e-37-0.4342054446e-37*I, -0.7773134955e-37-0.3609012248e-37*I, -0.8084758661e-37-0.2842409660e-37*I, -0.8321035975e-37-0.2049379645e-37*I, -0.8479779638e-37-0.1237297776e-37*I, -0.8559520434e-37-0.4137144557e-38*I, -0.8559520435e-37+0.4137144402e-38*I, -0.8479779639e-37+0.1237297769e-37*I, -0.8321035979e-37+0.2049379630e-37*I, -0.8084758664e-37+0.2842409653e-37*I, -0.7773134957e-37+0.3609012242e-37*I, -0.7389050442e-37+0.4342054433e-37*I, -0.6936062961e-37+0.5034711548e-37*I, -0.6418370481e-37+0.5680530171e-37*I, -0.5840773026e-37+0.6273487928e-37*I, -0.5208629121e-37+0.6808049418e-37*I, -0.4527807065e-37+0.7279217840e-37*I, -0.3804631352e-37+0.7682581900e-37*I, -0.3045824850e-37+0.8014357418e-37*I, -0.2258447130e-37+0.8271423327e-37*I, -0.1449829450e-37+0.8451351705e-37*I, -0.6275071183e-38+0.8552431450e-37*I, 0.2008503694e-38+0.8573685437e-37*I, 0.1027510603e-37+0.8514880865e-37*I, 0.1844750360e-37+0.8376532724e-37*I, 0.2644927944e-37+0.8159900249e-37*I, 0.3420554936e-37+0.7866976374e-37*I, 0.4164366713e-37+0.7500470242e-37*I, 0.4869391201e-37+0.7063782866e-37*I, 0.5529014927e-37+0.6560976160e-37*I, 0.6137045944e-37+0.5996735595e-37*I, 0.6687772877e-37+0.5376326784e-37*I, 0.7176019529e-37+0.4705546426e-37*I, 0.7597194490e-37+0.3990668022e-37*I, 0.7947335225e-37+0.3238382916e-37*I, 0.8223146207e-37+0.2455737195e-37*I, 0.8422030659e-37+0.1650065065e-37*I, 0.8542115619e-37+0.8289193856e-38*I, 0.8582270020e-37]

(7)
 

``

Download 0_one.mw

Could someone explain to me why the Maple online help pages (see here) are still apparently matching the Maple 2021 release for the past few years? Does this mean that all the information on the Maple online help pages is out of date, or just this one specific page is terribly out of date?

Hello,

I am trying to discretize high order derivatives (typicaly of order 3-4) and I would like to use maple to avoid errors. Using this thread of discussion I got the following minimum example that illustrates the problem I am facing:

NULL

# central discretisation u_xx, i=1,..,n-1
dxc:=add([1,-2,1] *~ [u[i+k,j] $k=-1..1])/(h^2);

(u[i-1, j]-2*u[i, j]+u[i+1, j])/h^2

(1)

NULL

# we need to compute gradient(laplacian) on faces i+1/2,j and i-1/2,j.

#First diff(u_xx,x)|i+1/2,j
d1:=add([1,-1] *~ [dxc[i+p,j] $p=0..1])/(h);
#which should give
d1:=add([1,3,-3,1] *~ [u[i+k,j] $k=-1..2])/(h^3);

(((u[i-1, j]-2*u[i, j]+u[i+1, j])/h^2)[i, j]-((u[i-1, j]-2*u[i, j]+u[i+1, j])/h^2)[i+1, j])/h

 

(u[i-1, j]+3*u[i, j]-3*u[i+1, j]+u[i+2, j])/h^3

(3)

NULL

I would like maple to evaluate the first expression for d1 and give the second expression that I wrote manually.

Is there a way to do this ? (using simplify() does't produce anything)

Cheers,

Download high_order_derivatives.mw

Kind help to implement the attached flowchart

 

Finding_Detour_using_alorigthm.pdf

Just experienced a strange response from Maple when I changed the Font anti-aliasing to enabled.

With Font anti-aliasing disabled I ran evalf(Pi,100) and Maple returned 100 digits - no problem.  I then did some other errands in other programs leaving Maple idle, when I came back I thought I would change anti-aliasing to enabled and see if maybe that's the reason why some users are experiencing icons disappearing etc..

Well I re entered and evalueated evalf(Pi,100) and Maple only output 10 digits.  Huh??? What!? Why?  changed font anti-aliasing back but no joy.  So I closed Maple and I got a pop up

Maybe it was hiding behind Maple I don't know but I don't think it was there until I closed Maple.  It seems this OpenJDK platform I believe is causing a lot of Maple issues.

Whoa!  That's really odd.  My restart was with Maple Font anti-aliasing enabled I performed a evalf(Pi,100) and no problem.  I changed to Font anti-aliasing disabled and evalf(Pi,100) presented me with 10 digits!

What the heck is going on.  This font anti-aliasing enabled caused my Maple to slow down as the screen filled up (as I recorded in a earlier post months ago) and now toggling anti-aliasing causes the outputs to not work as expected.  It's gotta be an open JDK issue. (FYI closing Maple did not produce the same pop-up as earlier - I expect idling maple for a while might)

In the following example, the information in which range fsolve should search for a solution and the range in which a function is defined is somehow redundant. (This example has been adopted from here where fsolve without assumptions does not throw an error but evaluates forever.)

Why can’t fsolve not always assume that the range equals the domain of interest? This would make life easier and provide more solutions to inexperienced users who have not yet learned the need for assumptions.

If there are good reasons (and there probably are) that such an implicit assumption (i.e. range equals domain) would be too restrictive: can’t fsolve give a hint or provide an new option to use ranges as assumptions?

Example with incomplete elliptic integral of the first kind

f := proc (x__0) options operator, arrow; int(1/(sqrt(x__0-x)*sqrt(-x^2+1)), x = 0 .. x__0) end proc

proc (x__0) options operator, arrow; int(1/(sqrt(x__0-x)*sqrt(-x^2+1)), x = 0 .. x__0) end proc

(1)

Range := 0 .. 1; plot(f(x__0), x__0 = Range, labels = [x__0, 'f(x__0)'])

 

f(.5) = 1.524886838NULL

Defining the inverse of f

g := proc (y) options operator, arrow; fsolve(`assuming`([f(x__0) = y, x__0 = Range], [lhs(Range) <= x__0 and x__0 <= rhs(Range)])) end proc

proc (y) options operator, arrow; fsolve(`assuming`([f(x__0) = y, x__0 = Range], [lhs(Range) <= x__0 and x__0 <= rhs(Range)])) end proc

(2)

x__0 = g(f(.5)) → x__0 = .5000000000NULL

Now without assumptions

h := proc (y) options operator, arrow; fsolve(f(x__0) = y, x__0 = Range) end proc

proc (y) options operator, arrow; fsolve(f(x__0) = y, x__0 = Range) end proc

(3)

h(f(.5))

Error, (in fsolve) cannot determine if this expression is true or false: abs(Re(x))+abs(Im(x)) <= 0.

 

``

Download ranges_as_assumptions.mw

First 219 220 221 222 223 224 225 Last Page 221 of 2218