Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hi Maplers, 

I'm struggling to write the correct code for this structural problem below. 

The goal is to find the piecewise code for the horizontal deflection of a vertical beam (representing a offshore wind turbine) consisting of 5 segments. Below the EoM for the 5 segments, where segment 1 is in the soil hence the ksoil*u1(z) part. 

sysODE := {
EI2*diff(u2(z), z, z, z, z) + m2*g*diff(u2(z), z, z) = 0,
EI3*diff(u3(z), z, z, z, z) + m3*g*diff(u3(z), z, z) = 0,
EI4*diff(u4(z), z, z, z, z) + m4*g*diff(u4(z), z, z) = 0,
EI5*diff(u5(z), z, z, z, z) + m5*g*diff(u5(z), z, z) = 0,
EI1*diff(u1(z), z, z, z, z) + m1*g*diff(u1(z), z, z) + ksoil*u1(z) = 0} 

To find the general solution the dsolve function is used. This gives 5 eqs describing u1(z).. u5(z), with in total 20 unknown constants depicted as: _C1.._C20. 

Now I have 20 BCs, shown below: 

bcs := {
eval(subs(z = z2, EI2*diff(u2, z, z, z)) + Fwave = subs(z = z2, EI3*diff(u3, z, z, z))),
eval(subs(z = z5, EI5*diff(u5, z, z, z)) + Fwind = 0),
eval(subs(z = 0, EI1*diff(u1, z, z)) = 0),
eval(subs(z = 0, EI1*diff(u1, z, z, z)) = 0),
eval(subs(z = z1, u1) = subs(z = z1, u2)),
eval(subs(z = z1, diff(u1, z)) = subs(z = z2, diff(u2, z))),
eval(subs(z = z1, diff(u1, z, z)) = subs(z = z2, diff(u2, z, z))),
eval(subs(z = z1, diff(u1, z, z, z)) = subs(z = z1, diff(u1, z, z, z))),
eval(subs(z = z2, u2) = subs(z = z3, u3)),
eval(subs(z = z2, diff(u2, z)) = subs(z = z2, diff(u3, z))),
eval(subs(z = z3, u3) = subs(z = z3, u4)),
eval(subs(z = z3, diff(u3, z)) = subs(z = z3, diff(u4, z))),
eval(subs(z = z3, diff(u3, z, z)) = subs(z = z3, diff(u4, z, z))),
eval(subs(z = z3, diff(u3, z, z, z)) = subs(z = z3, diff(u4, z, z, z))),
eval(subs(z = z4, u4) = subs(z = z5, u5)),
eval(subs(z = z4, diff(u4, z)) = subs(z = z4, diff(u5, z))),
eval(subs(z = z4, diff(u4, z, z)) = subs(z = z4, diff(u5, z, z))),
eval(subs(z = z4, diff(u4, z, z, z)) = subs(z = z4, diff(u5, z, z, z))),
eval(subs(z = z5, EI5*diff(u5, z, z)) = 0)};

How do I write the correct Maple-code to find C1..C20. 

Thanks in advance! 

krgs, 

Floris

Hi,

i use an OpenMaple environment for my academic activity. Especially for plotting of results outside of Maple GUI. Until version 2023 everything was nice and working. But in 2023 calling of Maplets kills Maple 2023 and of course my jobs. Example to try:

#include <stdio.h>
#include <stdlib.h>

#include "maplec.h"

 /* callback used for directing result output */
static void M_DECL textCallBack(void *data, int tag, const char *output)
{
   printf("%s\n", output);
}

int main(int argc, char *argv[])
{
   char err[2048];  /* command input and error string buffers */
   MKernelVector kv;  /* Maple kernel handle */
   MCallBackVectorDesc cb ={textCallBack,
      0,   /* errorCallBack not used */
      0,   /* statusCallBack not used */
      0,   /* readLineCallBack not used */
      0,   /* redirectCallBack not used */
      0,   /* streamCallBack not used */
      0,   /* queryInterrupt not used */
      0    /* callBackCallBack not used */
   };
   ALGEB r, l;  /* Maple data-structures */

   /* initialize Maple */
   if((kv=StartMaple(argc, argv, &cb, NULL, NULL, err))==NULL) {
      printf("Fatal error, %s\n", err);
      return(1);
   }
   r=EvalMapleStatement(kv, "with(Maplets[Elements]): SimpleMaplet:=Maplet([Button('Close', Shutdown())]): Maplets[Display](SimpleMaplet):");
   StopMaple(kv);

   return(0);
}

Working in Maple 2020-2022, crashes in 2023

After a long investigation i found that the problem focuses in maple.dll.

It is only for me, or it is a general bug?

The QuantifierElimination package has been added in Maple 2023.
However, in the following example, the old (yet not obsolete) RegularChains:-SemiAlgebraicSetTools:-QuantifierElimination command can solve the problem, but strangely, the new QuantifierElimination:-QuantifierEliminate command simply returns an error. 

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/QE_bug.mw .
 

Download QE_bug.mw

So, is there any bug in Maple's QuantifierElimination package? 

QuantifierElimination[QuantifierEliminate](forall([x, y, t], Implies(And(x^3 + y^2 - x = t, And(t^2 = 4/27, t < 0)), x^2 + y^2 >= rho)));

(By the way, it appears that  doesn't work....)

int((4*h1*lambda*k*BesselK(0, k*Zeta)/Zeta^3)*Zeta*BesselK(1, alpha*Zeta), Zeta = 1 .. infinity)

Can any one help me to find the values of this integral?

Hi, 
I met a an unexpected behaviour of a procedure when the parameter sequence contains the type ':-RandomVariable':  

restart:
with(Statistics):
f1 := proc(A::':-RandomVariable')
  Mean(A)
end proc:

Z := RandomVariable(Normal(mu, sigma)):
hastype(Z, ':-RandomVariable');
f1(Z)
                              true
Error, invalid input: f1 expects its 1st argument, A, to be of type 'RandomVariable', but received _R
# Another attempt
f2 := proc(A)
  if hastype(A, ':-RandomVariable') then Mean(A) end if;
end proc:

f2(Z)
                               mu

Why does f1 generate this error?

Type_RandomVariable.mw

As you can see, if I want to simplify the following expression, I shall have to run the simplify command three times, and if I add some assumptions, the global simplify command will no longer work! 

:-simplify(2*(x^2+1)^(1/2)*(x+y+(x+y)/(x*y-1))^2/(((1/2)*(x+y+(x+y)/(x*y-1))*(2*x+(x+y)/(x*y-1)+y)/(x^2+1)^(1/2)-(1/2)*(2*x+(x+y)/(x*y-1)+y)*(y+(x+y)/(x*y-1))/(x^2+1)^(1/2)+(x+y+(x+y)/(x*y-1))/x)^2*x));


Download collect_and_recurse)_invalid_arguments_to_coeffs_.mws

But here either Physics[Simplify] or evala@Simplify works (with a slightly different result, though). Does anyone know why?

Vertex disjoint paths are paths that only share their first and last vertices.  In Maple, we can compute the maximum number of pairwise vertex disjoint paths from x to y by the function MaxFlow.  

For example:
 

with(GraphTheory):
with(SpecialGraphs):
g:=IcosahedronGraph():
HighlightVertex(g, {1,7},"DodgerBlue"):
DrawGraph(g);
g1:=MakeWeighted(g);
mxf:=MaxFlow(g1,1,7)

5

Matrix(12, 12, [[0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]])

 

So  we know that the maximum number  of vertex-disjoint paths between vertices "1" and "7" is 5. 

But can we obtain more information from MaxFlow, such as finding  five (i.e., the maximum number) vertex-disjoint paths between vertices "1" and "7" ? (These five paths may not be unique.)

 

Here is a set of five vertex-disjoint paths connecting vertices "1" and "7" that I observed manually, each marked with a different color.

 

Hi every one

Let F= [x^2-z^2, x*y+y*z, x*z-y*z, y^2+y*z,w^2] be a special list of monomials and binomials. How to convert F into the following list:

FF=[x^2=z^2, x*y=-y*z, x*z=y*z, y^2=-y*z,w^2=0]. Please note that the left side of each equation of FF is greater than the right side w.r.t. lex ordering plex(x,y,z,w). 

Thank you in advance.

I would like to simplify the following (very simple) expression:

e1:= -(b*(b^2 - 4*a*c)^(1/2) - 4*a*c + b^2)/(2*a*(b^2 - 4*a*c)^(1/2))

whis is exactly equal to

e2: = -(b + (b^2 - 4*a*c)^(1/2))/(2*a)
simplify(e1-e2)
0


But the "simplify" command is not able to produce expression "e2". Is there any general way how to enforce simplifying to get expected result?

Take the following expression:

Why does Maple simplify it to:

instead of the following, like the other math software does it:

While Maple uses , the other software does , which I find easier to read.

It's not a big difference, but I find positive expressions easier to read. Is there a way to change this behaviour or to work around it?

Creating Graph Equation of An Apple in Cartesian Space using single Implicit Function only run by Maple software

Enjoy...

Please click the link below to see full equation on Maple file:

2._Apel_3D_A.mw

 

Creating Graph Equation of A Candle on Cartesian Plane using single Implicit Function only run by Maple software

Enjoy...

Please click the link below to see full equation on Maple file:

(if you run the file it has animation in the Equation, just like movement of A Candle in real life)

5._Animasi_lanjut_2D_part_1.mw

 

My world of trigonometric functions has a very simple structure: sin, cos and tan are what I need.

That's why I very much welcomed the simplification of sin/cos to tan recently introduced with Maple 2023.

What I neither need nor want is the simplification of 1/sin and 1/cos to sec and csc. I'm not used to that (and probably won't get used to it).

Can this simplification to sec and ccs be turned off (and preferably the simplification to tan be kept)?

Another very strange behavior.

res:= x^2 + x + 1 + 1/3*x^3 + 1/12*x^4 + 1/60*x^5 + 1/360*x^6 + 1/2520*x^7;
sort(res);

#and now
res

Without trying it, what do you expect the output of the last line above to be?  The same as the first one, right?  But that is not what Maple gives. Maple now changes res to always be sorted, even though I have not reassigned it.

Does this mean if one calls sort(), then all the variables that contains polynomials will also be sorted automatically?

Unable to upload worksheet. So here is screen shot

 


Download sort_problem.mw

These give errors

limit(y(0),y(0)=1)

limit(y(x),y(x)=1)

Error, (in limit) limit variable previously assigned, 2nd argument evaluates to y(0) = 1
 

One has to write 

limit(y,y=1)

But why? Is this because y(x) is not considered "algebraic" ? 

Mathematica has no problem with either one of these

I found this when I was trying to find the limit at initial conditions, when x=0 and y(0)=1 and wanted to take the limit on both x->0 and y(0)->1 

I can easily code around this, by renaming y(0) to say Y0 and then the limit will work.

It just seems to be unnecessary restriction of the limit() command parsing ability. 

What is the logic behind not allowing one to write limit(y(x),y(x)=1) ? 

My problem is as follows:

With the Statistics package (or whichever other package) I will do a PolynomialFit on some data. This will result in a function, e.g. x^2. How do I assign this output (which appears to be the function only, no other bells attached) to an actual function which I can later refer to (I want to do as follows):

with(Statistics)

f(x):=PolynomialFit(n, DATA, variable)

f(3) = 3^2

See the attached screenshot for what actually happens:

It appears as if it tries to run PolynomialFit but with a different argument when I do this.

Help would be appreciated as to how I can define the output of PolyFit as a function.

1 2 3 4 5 6 7 Last Page 1 of 2004