Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I'm trying to construct an iterative procedure al1(f,x0) where f is a function, x0 is an initial estimate.

Now for example by defining f:= x-> 4*x^4-4*x^2 and inputting x0=0.75 and N=10 i should be able to check that my procedure calculates 1 correctly.

f := x -> 4*x^4 - 4*x^2;
f1 := D(f);
f2 := D(f1);
x0 := 0.75;
Digits := 100;
tol := 10.^(-15);

al1:= proc(f,x0)
local y, z, s, i, fs, a, de;
s := x0:
a[0]:=x0;
for i from 1 to 10
while abs(fs)>tol and de>tol do
y := evalf(s- f(s)/f1(s)):
s:=evalf(y-f(y)/f1(y)):
fs:=evalf(f(s)):
a[i]:=s:
de:=abs(evalf(a[i]-a[i-1])):
end do:
return n, s, fs, de;
end proc;

> n, s, fs, de := al1(f, 0.75);
Error, (in al1) cannot determine if this expression is true or false: 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < abs(fs) and 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < de

 

The code i've written so far is incorrect but i'm not sure where i'm going wrong. Would you be able to give me some pointers?

 

Hi !

Sorry but there is a bug in the "combine" command when combining double summations.
 Maple 2017,2018 and 2020 all give me a wrong answer. I have an old version of Maple which gives the correct answer.
I have put an example in the attached file.

bugcombine.mw

Best regards
Réjean 

Hello. looking for the numerical or analytical solution of the attached file and at the needed expression or value of lambda for different values of the involved parameter?

Help_numerically_solution.mw

 

I need the non-dimensional form of PDE with given non-dimensional variables. I have attached a worksheet please check it. 

Thank you nondimensional.mw

Maple Worksheet - Error

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

Download nondimensional.mw

Maple Worksheet - Error

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

Download nondimensional.mw

 

 

Hi MaplePrimes team,

 

Does Maple have a step detection command for a given step function f(x)?

The command has to return a list of jump detections in a given range [xmin... xmax].

For example, can Maple find the following jump detections:

 

Figure 1 (trivial case): f(x) = floor(x)

where it is easy to guess the list of step detections: [x1 = 1, x2 = 2, x3 = 3, …, xn = n]

 

Figure 2: g(x) = 2 + floor(x + 5*sin x)

a little more difficult.

 

Thank you in advance.

 

Guy.

Maple 2021.1/Windows 10.

When entering 2d expressions into the bottom line of a worksheet, i.e. at the bottom of the window, I can't see the underscores used to indicate bracketing.

A workaround is to use ^J to get another input prompt at the bottom of the window.

Is there some way to get a bigger margin at the bottom of the window?

Cheers,

Steve.

Hi,

 

In Maple 2020, the following line works fine:

Statistics:-HeatMap(Matrix(128,(i,j)->modp(binomial(i,j),2)),color=["White","Black"]);

 

 

 

 

With Maple 2021, I get

 

Interestingly, the exported PNG is better with Maple 2021 (not blurry as in Maple 2020). However, there is an alignment problem with the axes. And it appears in Maple, before exporting. Bug?

(Maple 2020/2021 on Windows 10)

Hi, Is it possible to convert a code written in Mathematica into maple correctly?

I need to check if an expression is polynomial in but with coefficients that are either symbolic, or do not include the complex numebr I.

The problem is that maple considers integers and reals complex also.   

type(1,complex) gives true. so I can't use

restart;
type(1+2*x,polynom(Not(complex),x))

Since this gives false. 

I could instead list all the types to be accepted using Or, like this

restart;
type(1+2*x,polynom(Or(float,realcons,rational,integer),x))

But I might overlook something if I have to enumerate every type accepted. It is easier to just exclude complex numbers. 

What is the correct way to tell Maple to check if expression is polynomial in where coefficients do not have the complex I in them? It it ok if the coefficient are any other numeric value, or a known Maple constant, or a parameter (symbol). I just want to exclude complex numbers.

I know I could do this

restart;
the_poly:=1+2*x;
if not has(the_poly,I) then
   type(the_poly,polynom(anything,x))
else
   print("not allowed");
fi;

But I wanted to learn how to make a type which excludes complex numbers.

Maple 2021.1

In this simple example, we are going to learn how to Plot Isocline & Trajectory to examine stability of a dynamical system with Lyapunov Stability Theorem in Maple.

iso.mw

Download iso.mw

You should be familiar with Dynamical Systems and Linear Control.

This content would be more useful for students who are studying

>> Linear Control &

>> ODE's Theory

I have a linear ctrl course this semester & I was trying to solve such problems. Finally I did.

Hope to enjoy

Hi, Can one have look at my attached picture of the problem then solve in maple to get the required results mentioned in the picture.

help.mw

Given an expressions such as 

expr:=sin(x)+cos(x)*exp(x)+x*tan(x)*f(x)+x+y;

I want to use indets to find only the mathematical functions in it, and also symbol but only x symbol in this above. I can do the following to find the mathematical functions and symbols, but I do not know how to tell it to find type symbol which happend to be x. Since x is not a type.

expr:=sin(x)+cos(x)*exp(x)+x*tan(x)*f(x)+x+y;
type_1:={function,typefunc(mathfunc)};
type_2:=symbol;
lis:=indets(expr,  Or( And(type_1),  type_2 ))

Which gives

But I really wanted this output

I know I can post process the outout using has or remove, to remove symbol y. But is it possible to do that using indets? something similar to specfunc but specsymbol ? I looked at the help page for Definition of a Structured Type in Maple but do not see anything there so far.

I tried

expr:=sin(x)+cos(x)*exp(x)+x*tan(x)*f(x)+x+y;
type_1:={function,typefunc(mathfunc)};
type_2:={symbol,identical(x)};
lis:=indets(expr,  Or( And(type_1),  And(type_2) ))

but it gives same output.

 

 

I need to calculate dozens of piecewise-defined  (but elementary) definite integrals of the following kind. Maple returns them unevaluated. Is there a trick to force evaluation? 

restart;
u := piecewise(0 <= x and 0 <= y and y <= x, x-1, 0 <= x and 0 <= y and x <= y, x, 0);
v := piecewise(0 <= x and 0 <= y and y <= x, x-1, y <= 0 and 0 <= x and -x <= y, x-1, 0);
plot3d(u*v, x=-1..1, y=-1..1);
# integrating over (0,1)x(0,1) works
int(u*v, x=0..1, y=0..1);
# but integrating over (-1,1)x(-1,1) returns unevaluated.
# How to force evaluation on (-1,1)x(-1,1)?
int(u*v, x=-1..1, y=-1..1);

integration-problem.mw

 

Hi, I have a table-based package P I am working with and I would like to do the following:

Use a submodule (call it A) of the package. A uses another submodule (call it B) within the package to run a calculation. I'd like to replace B with my own subpackage C (independent of P) as another verification step. Is this possible? I would like to avoid making changes to A as much as possible.

 

Thanks,

 

Mark

given one equation where both sides are polynomials in one variable x, like this

eq:=c1*(x^2+x)+c2*(2+2*x)+c3=-4*x^2+2*x+6;

And we want to solve for the coefficients on the LHS, which are c1,c2,c3.  By hand, this is solved by expanding both sides, and then comparing the coefficient of each power of x. This generates 3 equations (in this example) and then these are solved for c1,c2,c3.

Is there a way to automatically do this in Maple without the user having to do the first manual step of generating the equations needed to solve for c1,c2,c3?

eq1:=c1=-4;eq2:=c1+2*c2=2;eq3:=2*c2+c3=6;
PDEtools:-Solve([eq1,eq2,eq3],[c1,c2,c3])

gives

              {c1 = -4, c2 = 3, c3 = 0}

But It will be nice if there is a command in Maple which will do it starting from the first equation. Ofcourse one has to tell Maple what to solve for. PDEtools:-Solve(eq,[c1,c2,c3]); or solve(eq,[c1,c2,c3]) does not work, because Maple does not know it needs to expand and compare coefficients as we do by hand.

It is not hard to write code to generate these equations, but I am asking if there is already a command in Maple which somehow does it automatically. I looked at SolveTools, but did not spot something yet there.

edit

Ok, I think this is easy to do. I found a command

eq:=c1*(x^2+x)+c2*(2+2*x)+c3=-4*x^2+2*x+6;
eqs:=PolynomialTools:-CoefficientList((lhs-rhs)(eq),x);
PDEtools:-Solve(eqs,[c1,c2,c3])

{c1 = -4, c2 = 3, c3 = 0}

 

 

First 6 7 8 9 10 11 12 Last Page 8 of 1838