Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I trying to simplify expressions for lines so no higher order terms. factor and op seperate out what I need but how do I select the one with the variables in this case x,y. I cant depent on this always been the last one returned from the op command.

restart

 

vars=[x,y]

vars = [x, y]

(1)

k:=17

17

(2)

expr:=-2*sqrt(118)*(((-4*x + y + 51/32)*sqrt(k) + (k*x)/4 - (51*y)/4 + 153/32)*sqrt(-4012 + 1003*sqrt(k)) + ((x + 4*y)*sqrt(k) - (85*x)/4 - (17*y)/4)*sqrt(4012 + 1003*sqrt(k)))*k^(1/4)/(17051*(-1 + sqrt(k)))

-2*118^(1/2)*(((-4*x+y+51/32)*17^(1/2)+(17/4)*x-(51/4)*y+153/32)*(-4012+1003*17^(1/2))^(1/2)+((x+4*y)*17^(1/2)-(85/4)*x-(17/4)*y)*(4012+1003*17^(1/2))^(1/2))*17^(1/4)/(-17051+17051*17^(1/2))

(3)

indets(expr)

{x, y}

(4)

factor(expr)

(1/64192)*(-4012+1003*17^(1/2))^(1/2)*118^(1/2)*17^(1/4)*(17^(1/2)+5)*(40*x-24*y-3)

(5)

op(factor(expr))

1/64192, (-4012+1003*17^(1/2))^(1/2), 118^(1/2), 17^(1/4), 17^(1/2)+5, 40*x-24*y-3

(6)

select(has,vars, factor(expr))

select(has,vars, op(factor(expr)))

Error, invalid input: has expects 2 arguments, but received 7

 
 

 

Download 2024-09-11_Has_Select_Question.mw

I get my on results but the results are not the same please help me if i did any mistake in my code

 

symmetry_PDESYS_3_time_fraction[1].mw

This code is working for function f1 but not for f2
f2 := (x,y)->9*x^2-24*x*y+16*y^2+10*x-70*y + 175;
Why this code is not working for f2 ?
unprotect(D);
f1:= (x, y) -> 3*x^2 - 3*y*x + 6*y^2 - 6*x + 7*y - 9;
coeffs(f(x, y));
A, B, C, D, E, F := %;
theta := 1/2*arctan(B/(A - C));
solve({-2*A*xc - B*yc = D, -B*xc - 2*C*yc = E});
assign(%);
x := xcan*cos(theta) - ycan*sin(theta) + xc;
y := xcan*sin(theta) + ycan*cos(theta) + yc;
Eq := simplify(expand(f1(x, y)));
xcan^2/simplify(sqrt(-tcoeff(Eq)/coeff(Eq, xcan^2)))^`2` + ycan^2/simplify(sqrt(-tcoeff(Eq)/coeff(Eq, ycan^2)))^`2` = 1;

Thank you

I'm trying to solve a system of coupled differential equations numerically, but I'm getting the following error

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

The error occurs at the dsolve step, despite trying to ensure that all equations and conditions are in the correct form (sets/lists).

Could someone help me identify what I'm missing here?

Thanks in advance!

L := 200; K := 99; kappa := 1; omegaD := 1; beta := 1; delta := 0.5e-1; j := 2; tmax := 3000; h := L/(K+1); nsp := [`$`(-(1/2)*L+h*i, i = 0 .. L/h)]; km := nops(nsp); omegaD2 := h^2*omegaD^2; deltaHat := h*delta; a := 2; var := seq(x[i](t), i = 1 .. km); initialPositions := seq(x = a*sin(j*h*Pi*nsp[i]/L), i = 1 .. km); initialVelocities := seq((D(x[i]))(0) = 0, i = 2 .. km-1)

boundaryConditions := [x[1](t) = 0, x[km](t) = 0]

equations := seq(diff(x[n](t), t, t)-kappa*(x[n+1](t)-2*x[n](t)+x[n-1](t))+deltaHat*(diff(x[n](t), t))-omegaD2^2*(x[n](t)-beta*x[n](t)^3) = 0, n = 2 .. km-1)

sol := dsolve({equations, boundaryConditions, initialPositions, initialVelocities}, var, numeric, method = rkf45, range = 0 .. tmax)

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

 

NULL

Download dsolve_error.mw

Why Maple returns y(x)=0 as solution to this ode when even odetest do not validate the solution? Solution satisfies the ode but not the given BC.

Is this a known bug?

I've updated the worksheet now to include few more examples, all using same ode but with different BC's. In all 4 examples, Maple gives solutions when there should not be solution and in one case gives solution which can not even be used for odetest. These are random BC's generated just for testing.
 

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1804. The version installed in this computer is 1802 created 2024, September 3, 11:35 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

#EXAMPLE 1

ode:=diff(diff(y(x), x), x) + 2*diff(y(x), x)/x - y(x) = 0;
IC:=y(-1)=0,D(y)(-infinity)=-1/exp(1);

diff(diff(y(x), x), x)+2*(diff(y(x), x))/x-y(x) = 0

y(-1) = 0, (D(y))(-infinity) = -1/exp(1)

maple_sol:=dsolve([ode,IC]);

y(x) = 0

odetest(maple_sol,[ode,IC])

[0, 0, -exp(-1)]

restart;

#EXAMPLE 2

ode:=diff(diff(y(x), x), x) + 2*diff(y(x), x)/x - y(x) = 0;
IC:=y(infinity)=0,D(y)(-infinity)=-1/exp(1);

diff(diff(y(x), x), x)+2*(diff(y(x), x))/x-y(x) = 0

y(infinity) = 0, (D(y))(-infinity) = -1/exp(1)

maple_sol:=dsolve([ode,IC]);

y(x) = 0

odetest(maple_sol,[ode,IC])

[0, 0, -exp(-1)]

restart

#EXAMPLE 3

ode:=diff(diff(y(x), x), x) + 2*diff(y(x), x)/x - y(x) = 0;
IC:=y(-infinity)=0,D(y)(-infinity)=-1/exp(1);

diff(diff(y(x), x), x)+2*(diff(y(x), x))/x-y(x) = 0

y(-infinity) = 0, (D(y))(-infinity) = -1/exp(1)

maple_sol:=dsolve([ode,IC]);

y(x) = signum((sinh(x)+cosh(x))/x)*infinity

odetest(maple_sol,[ode,IC])

Error, (in signum) signum is not differentiable at 0

#EXAMPLE  4

restart;

ode:=diff(diff(y(x), x), x) + 2*diff(y(x), x)/x - y(x) = 0;
IC:=y(-infinity)=0,D(y)(infinity)=-1/exp(1);

diff(diff(y(x), x), x)+2*(diff(y(x), x))/x-y(x) = 0

y(-infinity) = 0, (D(y))(infinity) = -1/exp(1)

maple_sol:=dsolve([ode,IC]);

y(x) = 0

odetest(maple_sol,[ode,IC])

[0, 0, -exp(-1)]

 


 

Download wrong_sol_dsolve_sept_10_2024.mw

Update sept 13, 2024

Here is one more example I found. In this ode, the IC given leads to division by zero in the solution. Yet Maple for some reason removes the offending part of the solution with that constant, and returns the rest. 

Is one allowed to do this? odetest also do not validate the solution. There should not be solution returned in this case, since it is not possible to find values for the constants of integration given these initial conditions. Right?

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

restart;

ode:=x^2*diff(y(x),x$2)+x*diff(y(x),x)-9*y(x)=0;
IC:=y(0)=1,D(y)(0)=0;
maple_sol_no_IC:=dsolve(ode);

x^2*(diff(diff(y(x), x), x))+x*(diff(y(x), x))-9*y(x) = 0

y(0) = 1, (D(y))(0) = 0

y(x) = c__1*x^3+c__2/x^3

maple_sol_with_IC:=dsolve([ode,IC]); #maple just removed the c2/x^3 part. Since at x=0 gives problem?

y(x) = c__1*x^3

odetest(maple_sol_with_IC,[ode,IC]); #shows solution does not verify

[0, 1, 0]

 


 

Download another_example_solution_given_when_none_exist.mw

 

 

I wanted to change  eq:= 1/2 * sqrt(-2*lambda)  to 1/2 %* sqrt(-2*lambda)  using a rule.

It works outside of rule ofcourse. But when I put %* in the RHS of the rule, maple hangs. It seems it is going into infinite loop.

I tried the trick of using '%*' but this gives syntax error.

Same problem happens when using %. and not just %*

Is there a workaround?

Attached worksheet. Make sure to save all work before trying it.
 

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1804. The version installed in this computer is 1802 created 2024, September 3, 11:35 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

eq:= 1/2 * sqrt(-2*lambda)

(1/2)*(-2*lambda)^(1/2)

eq:= 1/2 %. sqrt(-2*lambda); #no problem

`%.`(1/2, (-2*lambda)^(1/2))

eq:= 1/2 %* sqrt(-2*lambda); #no problem

`%*`(1/2, (-2*lambda)^(1/2))

restart;

eq:= 1/2 * sqrt(-2*lambda)

(1/2)*(-2*lambda)^(1/2)

applyrule(sqrt(x::anything)/y::anything = 1/y %. sqrt(x),eq); #why this hangs?

 

restart;

eq:= 1/2 * sqrt(-2*lambda)

(1/2)*(-2*lambda)^(1/2)

applyrule(sqrt(x::anything)/y::anything = 1/y %* sqrt(x),eq); #why this hangs?

 


 

Download maples_hangs_applyrule_sept_10_2024.mw

I cannot find anything in the documentation that could explain the below.

NULL

According to ?name  the character ? can be used in a name with the exception of beeing the first character.
Example:

abc?:=2;
abc?

2

 

2

(1)


Reentering the name in 2D

"abc"?""

abc

(2)

In 2D the nane "abc"?"" does not seem to exist.

Trying now as above

"abc"?:=a:"  abc"?""

abc^2

(3)

returns an unexpected output.
Trying

"ab"?c:=b;"  "

ab

(4)

"a"?b:=c""

a

(5)

seems to cut of everything that follows the question mark (including the question mark).
This could explain the output (3) as having been parsed as abc*abc.

``


The variable palette only lists the name entered in 1D.

What could explain the difference between 1D and 2D when "?" is used in a name.

Download Questionmark_in_2D_names.mw

Hello!

I present a simple work-up of rolling a plane curve along a fixed plane curve in 2d space. Maple sources are attached.

Kind regards!

Source.zip

how we can make pretty of changing equation or case in maple to latex but be more readble and be simplify and the scientific referee don't reject the writting for example in this picture when i do convert i get something like that

 

if you watch the result 1 it is better denomenator which is 2 come out will be better and then times multiply by radical so how we do something like that?

latex2.mw

Hello,

Please help me solve this type of equations, I have more of them, but there is only one in the attached file. fsolve does not work. Please help.

Best regards!

tg_Test.mw

The help page of interface('longdelim') states: 

If true, Maple control structures such as if, do, proc, and so on are displayed with the newer-style long ending delimiters such as end if, end do, end proc, and so on. If false, ending delimiters are displayed as fi, od, end, and so on

If I set interface('longdelim' = false):, the Maple Input

try f:=0 catch:end try;

can be converted into 

via , but why is

use f=0 in f+1 end use;

still converted into

 instead of “use f = 0 in f + 1 end”? 

According to the documentation, 

the depends modifier can be used in declaration to indicate that a parameter's type depends on the value of another parameter, the seq modifier declares that multiple arguments of a specific type within a procedure invocation will be assigned to a single parameter, and if the depends modifier is used together with the seq modifier, the declaration must be written: . 

So the code below works as expected: 

f0 := proc(x::Not(2), y::2) [[x], [y]] end:
f0(1, 2);
                           [[1], [2]]

f0(2, 2);
Error, invalid input: f0 expects its 1st argument, x, to be of type Not(2), but received 2

The code below also works as expected: 

f1 := proc(x::depends(Not(y)), y::2) [[x], [y]] end:
f1(1, 2);
                           [[1], [2]]

f1(2, 2);
Error, invalid input: f1 expects its 1st argument, x, to be of type Not(2), but received 2

The code below works as desired as well: 

f2 := proc(x::seq(Not(2)), y::2) [[x], [y]] end:
f2(0, 1, 2);
                         [[0, 1], [2]]

f2(2, 1, 2);
                           [[], [2]]

However, the following code does not work: 

f3 := proc(x::seq(depends(Not(y))), y::2) [[x], [y]] end:
f3(0, 1, 2);
Error, invalid input: NULL uses a 2nd argument, y (of type 2), which is missing
f3(2, 1, 2);
Error, invalid input: NULL uses a 2nd argument, y (of type 2), which is missing

I believe that the output of  and  should be the same as that of  and  respectively. Did I miss something? 

Hi everyone! I meet some code issue when editing a easy sum of geometric sequence as belows, I can write another procedure sum total, it can run. But I wanna also try the sequence (the middle code) but failed, and why nops can not work? Thanks!

NULL

myfac := proc (n::nonnegint) local out, i, a, q; a := [3]; q := 2; out := a[1]; for i from 0 to n do out := out*q^i end do; out end proc; myfac(4)

3072

(1)

sum(myfac[i], i = 0 .. nops(myfac))

myfac[0]+myfac[1]

(2)

sum(myfac[i], i = 0 .. 4)

myfac[0]+myfac[1]+myfac[2]+myfac[3]+myfac[4]

(3)

values := [seq(myfac(i), i = 0 .. nops(myfac))]; sum_values := sum(myfac(i), i = 0 .. nops(myfac)); values; sum_values

[3, 6]

 

Error, invalid input: myfac expects its 1st argument, n, to be of type nonnegint, but received i

 

[3, 6]

 

sum_values

(4)

sum_myfac := proc (n::nonnegint) local i, total; total := 0; for i from 0 to n do total := total+myfac(i) end do; total end proc; sum_myfac(3)

225

(5)

NULL

Download sum_of_geometric_sequence.mw

Hello everyone 

Any one can help to plot a figure as follows 

" A cross section of three colored basins of attraction on an (x, y)

plane at z = 0 and w = 0 for a = 2.48 and b = 0.5. Basins in green, red, and cyan leads to a strange attractor, a limit cycle, and a line equilibrium, 

respectively. The yellow leads to unbounded orbits. " Where the system 

xdot=y 

ydot=z

zdot=w

wdot=-az-bw-y-xy. 

and range of x=[-6,6] and y=[-3,6]. 

With the attached task I would like to learn how Maple handles polynomials and plots. For this I have chosen a task with an interesting history from 1593. Adriaan van Roomen posed it to F. Vieta, who solved it after a short consideration.

My questions are:
1.) How are very long terms entered and displayed in Maple in an appropriate manner?
2.) How are the graphs of several functions displayed in the same coordinate system?
3.) Which graphics settings must be selected for differentiable functions in order to obtain nice, rounded curves rather than angular ones from the numerical result?
4.) Can the apparently random oscillations of the curve at the end of the interval be suppressed?
5.) The curves for p(x) and sinnx(x) are theoretically identical, since p(x) is the trigonometric expansion of sinnx(x). Their graphs must therefore be identical. How can this be displayed?
6.) The polynomial has many real zeros. How can the zeros be clearly presented in a table?

AF_20240909.mw

First 9 10 11 12 13 14 15 Last Page 11 of 2153