Where is wrong in this code?...

I am trying to find the integer numbers a, b, c, d, t so that the equation sqrt(a x^2 + b x + c) = d x + t have two integer solutions. My code

First I solve

solve(a*x^2 + b*x + c = (d*x + t)^2, x);

I get

(2*d*t - b + sqrt(4*a*t^2 - 4*b*d*t + 4*c*d^2 - 4*a*c + b^2))/(2*(-d^2 + a)), -(-2*d*t + sqrt(4*a*t^2 - 4*b*d*t + 4*c*d^2 - 4*a*c + b^2) + b)/(2*(-d^2 + a))

And then, I solve
restart;
n := 0;
for a to 10 do
for b to 10 do
for c to 10 do
for d to 10 do
for t to 10 do
mydelta := 4*a*t^2 - 4*b*d*t + 4*c*d^2 - 4*a*c + b^2;
if 0 < mydelta and type(mydelta, integer) then
x1 := (2*d*t - b + sqrt(4*a*t^2 - 4*b*d*t + 4*c*d^2 - 4*a*c + b^2))/(2*(-d^2 + a));
x2 := -(-2*d*t + sqrt(4*a*t^2 - 4*b*d*t + 4*c*d^2 - 4*a*c + b^2) + b)/(2*(-d^2 + a));
if 0 < d*x1 + t and 0 < d*x2 + t and type(x1, integer) and type(x2, integer) and nops({a, b, c, d, t}) = 5 and c <> t^2 and -d^2 + a <> 0 and nops({x1, x2}) = 2 then n := n + 1; L[n] := [a, b, c, d, t]; end if; end if; end do; end do; end do; end do;
end do;
L := convert(L, list);
nops(L);

I don't get any solutions. But, when I  solve(sqrt(2*x^2 + 3*x + 5) = x + 9, x); I get two solutions 19, -4.
Where is wrong in my code?

equality of vectors (too subtle for me)...

S := [1, 2];
S := [1, 2]

T := [1, 2];
T := [1, 2]

is(S = T);
true

Sv := Vector([1, 2]);

Tv := Vector([1, 2]);

is(Sv = Tv);
false

is(convert(Sv, list) = convert(Tv, list));
true

first order pde...

how to solve tis type of pdefirst_order_pde.mw

why has works different on seemingly same input?...

I obtained a Plot p, then trying to find if it has Float(undefined) in it. I am basically trying to find if DEplot returns an empty plot or not. I found that it the plot structure has HFlat(undefined) then this seems to imply an empty plot. So I said, then in the code I can check for HFlat(undefined) in the plot and it is there, then I know the plot is empty.

But this check is not working.

I used has(....,Float(undefined)) and this returns false. But if I copy and paste part of the plot structure and try the check on the copy, it gives true.

I do not understand what is the difference. First here is screen shot, and below if complete code to reproduce.

```restart;
ode2:=2*y(t)+t*diff(y(t),t) = t^2-t+1;

p:=DEtools:-DEplot(ode2,y(t),t=0..3.5,y=0..3,
linecolor = red,
arrowsize ='magnitude',
numpoints = 200 ,
axes = boxed,color = ('magnitude[legacy]')):

p0:=Array(1 .. 3,1 .. 2,{(1, 1) = HFloat(undefined), (1, 2) = HFloat(undefined), (2
, 1) = HFloat(undefined), (2, 2) = HFloat(undefined), (3, 1) = HFloat(undefined
), (3, 2) = HFloat(undefined)},datatype = float[8],order = C_order);
whattype(p0);
has(p0,HFloat(undefined))

p1:=op([1,2],p);
whattype(p1);
has(p1,HFloat(undefined))

```

Worksheet attached also.

Maple 2023.2 on windows 10

 > restart;

 > ode2:=2*y(t)+t*diff(y(t),t) = t^2-t+1; p:=DEtools:-DEplot(ode2,y(t),t=0..3.5,y=0..3,                         linecolor = red,                                                 arrowsize ='magnitude',                         numpoints = 200 ,                         axes = boxed,color = ('magnitude[legacy]')):

 > p0:=Array(1 .. 3,1 .. 2,{(1, 1) = HFloat(undefined), (1, 2) = HFloat(undefined), (2 , 1) = HFloat(undefined), (2, 2) = HFloat(undefined), (3, 1) = HFloat(undefined ), (3, 2) = HFloat(undefined)},datatype = float[8],order = C_order); whattype(p0); has(p0,HFloat(undefined))

 > p1:=op([1,2],p); whattype(p1); has(p1,HFloat(undefined))

 >

question is: Why the above give different result? And what is the correct way to check if the output plot from DEplot is empty or not (in code)?

Is there an argument placeholder that can be used ...

The documentation says:

A for...in loop can optionally have two loop variables. … If the second variable is the name _ (a single underscore), this indicates that the value is not needed, and Maple may choose to not look it up, and not assign a value to _.

So “_” can be treated as an argument placeholder in a for–in loop. Nevertheless, I would like to know if there is an argument placeholder like MatLab's tilde (`~`) operator:

Ordinarily, there is no need to to ignore inputs in function definitions, but as for the former, since there is a `_nresults` keyword in Maple (and some "built-in" routines do use it), when accessing the source code is unavailable, how do I ignore specific outputs from such a function (e.g., a procedure with option encrypted that has been loaded from a repository)?
For instance, the help page of `MTM:-eig` mentions three calling forms:

1. l := MTM:-eig(A):
2. [V,L] := MTM:-eig(A):
3. [V,L,N] := MTM:-eig(A):

If I do not directly invoke the linalg/Student[LinearAlgebra]/LinearAlgebra/Matlab package (and do not manually compute Eigenvals), will it be possible to imitate MatLab's

`[~, ~, W] = eig(A);`

in Maple as verbatim as possible?
Note that MatLab's help page claims:

… In this case, the variables are small. However, some functions return results that use much more memory. If you do not need those variables, they waste space on your system. …

A problem with the division symbols in Parse comm...

Hello, I'm trying to automate a series of priority calculation exercises. I have a problem with the "/" and " " division symbols. The "Parse" command only accepts "/" .Thanks for your insights

PEMDASTest.mw

How to make Maple show expression with values and ...

Assume

a:=2 m

b:=3 m

I will then calculate A as a times b, but Maple just gives med the answer 6 m2.

I would like the output to become:

A = a * b = 2 m * 3 m = 6 m2   (with * as normal multiplication-dots)

It is possible to write at proc with the above output? It should work for any expression.

The argument of the function should just be the name of the expression. Fx:

showCalculateProc(A)

The showCalculateProc(A) should then give the output

A = a * b = 2 m * 3 m = 6 m2         (with * as normal multiplication-dots)

I know about InertForm[NoSimpl], but it doesn't do all I want it to do, and not so nice output (* as multipliction)

Thanks.

Numeric-Formatting: Why is the exponent not format...

With the context-panel

 (1)

 (2)

How to format all occurences of numbers?

Error in system of Pdes equations ...

Dear Maple   help me to  to plot the graph please see and rectify.  thanks in advance

i am attaching the codes

inf:=5:
pdes:= R(X,R,t)*diff(U(X,R,t),X)+U(X,R,t)*diff(R(X,R,t),X)+R(X,R,t)*diff(V(X,R,t),R)+V(X,R,t),
diff(U(X,R,t),t)+U(X,R,t)*diff(U(X,R,t),X)+V(X,R,t)*diff(U(X,R,t),R)=Gr*T(X,R,t)+Gc*C(X,R,t)+(1/R(X,R,t))*diff(R*diff(U(X,R,t),R),R),
diff(T(X,R,t),t)+U(X,R,t)*diff(T(X,R,t),X)+V(X,R,t)*diff(T(X,R,t),R)+(1/(Pr*R(X,R,t)))*diff(R*diff(T(X,R,t),R),R),diff(C(X,R,t),t)+U* diff(C(X,R,t),X)+V(X,R,t)*diff(C(X,R,t),R)+(1/(Sc*R(X,R,t)))*diff(R*diff(C(X,R,t),R),R):
conds:= U(X,R,0)=0, V(X,R,0)=0, T(X,R,0)=0,  C(X,R,0)=0,
U(X,1,t)=1, V(X,1,t)=0, T(X,1,t)=1,  C(X,1,t)=1,                                                                          U(0,R,t)=0, T(0,R,t)=0, C(0,R,t)=0,
U(X,int,t)=0,T(X,int,t)=0,C(X,int,t)=0:
pars:= { Gr=5, Gc=10,Sc=2.0}

pars := {Gc = 10, Gr = 5, Sc = 2.0}

PrVals:=[0.71, 1.00, 1.25, 2.00]:
colors:=[red, green, blue, black]:
for j from 1 to numelems(PrVals) do
pars1:=`union`( pars, {Pr=PrVals[j]}):
pdSol:= pdsolve( eval([pdes], pars1),
eval([conds], pars1),
numeric
);
plt[j]:=pdSol:-plot( U(X,R,t),X=1, t=2, R=0..inf, numpoints=200, color=colors[j]);
od:
plots:-display( [seq(plt[j], j=1..numelems(PrVals))]);

Better way to change all indexed variables in an e...

I have expressions with head Sum that are all either one single Sum or sum of these Sum's. So my expression is either

Sum(.....)+Sum(....)+Sum(...)   or Sum()

Inside each Sum, I have indexed a[n] and also possibly nonindexed For an example

Sum( a[n]*x + a, n=1..10)

And I want to change all the indexed a[n] to b[n]

Hence the example above it will becomes  Sum( b[n]*x + a, n=1..10)

I can't just use eval(expr,a=b) as that will also change the non-indexed a to b which I want to leave as is. There will be only one single indexed variable in the sum. In this example it is `a`

Below is a general example and my solution. I'd like to find if there is a more canonical way or shorter more direct way to do this in Maple.

```restart;
expr:=Sum(x^(n+r)*a[n]*(n+r)*(n+r-1)+a[n-1]+3*a*x^10,n = 0 .. infinity)+Sum(4*a*x^(n+r)*a[n],n = 0 .. infinity)+Sum(4*a[n-1]*x^(n+r)+a[n]*x+a*x,n = 1 .. infinity) = 0;

evalindets(expr,specfunc( anything, 'Sum' ),f->Sum(evalindets(op(1,f),'indexed',ff->b[op(ff)]),op(2,f)))

```

I used evalindets twice. Once to look for Sum, and then to look for 'indexed' within each sum. It seems to work. Here is screen shot of the output

If you asking why I have indexed a and non indexed a in the same expression? Well, it is because the non-indexed happend to be a coefficient of the ode that the user used. So it is part of the input, which I have no control over. But the indexed is a local variable I am using inside the function being called to process the input.

On the screen they look the same. But they are actually not the same. The indexed is local to the function and the non-indexed is input via argument. So it is global symbol.

What is Ei_1(x) when solving an integral?...

 (1)

 (2)

What is Ei1 in Maple?

plot a volumetric body ...

How I can plot a volumetric body with the coordinates provided in the text file attachment?

after finding the geometry curve I want to find the curve that passes through the middle source.

1.txt

Convert given Eq. into Polynomial with a variable ...

Can someone explain how to use Maple to get from Eq. (4) to Eq. (5) using Eq. (6) to (8)?

This is the Peng Robinson Equation of State (1976)

I tried some stuff like using algsubs  on Eq. (4) and then do some polynomial operations (expand, collect etc.) It did not work out though. I'm grateful for any advice!

using arrows = curve gives error in DEplot. Any wo...

After I switched to using arrows = curve in the call to DEtools:-DEplot I found errors in some calls.

Is there a workaround other than not using this option? As phase plot looks like better with this option. For now, I will remove this option.

Here is an example

```restart;

ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0;
x_range:=-0.99 .. 0.99;
DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0],arrows = 'curve')
```

Error, (in DEtools/DEplot/direction) cannot assign a complex value to a hardware float Array

But this works

```restart;

ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0;
x_range:=-0.99 .. 0.99;
DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0])

```

I will report this to Maplesoft as it looks like a bug to me.

May be someone can find a workaround so I can use arrows = curve?

Maple 2023.2 on windows 10

 > restart;

 > ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0; x_range:=-0.99 .. 0.99; DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0],arrows = 'curve')

Error, (in DEtools/DEplot/direction) cannot assign a complex value to a hardware float Array

 > restart;

 > ode:=diff(y(x),x)-1/(-x^2+1)^(1/2) = 0; x_range:=-0.99 .. 0.99; DEtools:-DEplot(ode,y(x),x =x_range,y = -1.6 .. 1.6,[y(0) = 0])

 >

Can Maple dsolve formally this ode?...

I recently answered a question concerning the Lane-Emden equation (see here LaneEmden) where the main topic was about finding its numerical solution.

The generic form of the Lane-Emden equation with parameter n is

```LaneEmden := n -> (Diff(xi^2*(Diff(theta(xi), xi)), xi)) = -theta(xi)^n * xi^2

d   /  2 / d            \\             n   2
n -> ---- |xi  |---- theta(xi)|| = -theta(xi)  xi
dxi \    \ dxi          //
```

I have just realized that I missed a "small" point in the original question: the OP ( @shashi598 ) wrote
"[...] Maple never comes out of evaluating [the] analytical solution when n=5 [...] ".
The important point here is that this solution (at least for some initial conditions) is known and simple (in the sense it doen't involve any special function).

So I tried for a few hours to verify this claim, and ended wondering myself if it might not be right?

Could you please tell me (I guess @shashi598 would be interested too in your return) if the differential equation LaneEmden(5) can be solved formally?
TIA.

Emden_equation.mw

EDITED:
After a little research it seems that very specigic method are used to build the analytic solution of the LaneEmden(n) (n not equal to 0, 1 and 5): serie expansions, homotopy, Adomian decomposition for instance.
I wasn't capable to find how the solution for LaneEmden(5) have been got for the first time (iseems to be atthe end of the 19th century).

 First 6 7 8 9 10 11 12 Last Page 8 of 2071
﻿