MaplePrimes Questions

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. 

 

 

int(1/(x*exp(x)), x)

-Ei(1, x)

(1)

int(1/(x^2*exp(x)), x)

-1/(x*exp(x))+Ei(1, x)

(2)

NULLNULL

What is Ei1 in Maple?

Download Ei1.mw

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

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 v=Z*R*T/p on Eq. (4) and then do some polynomial operations (expand, collect etc.) It did not work out though. I'm grateful for any advice!

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;

292176

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')

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

-.99 .. .99

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

restart;

292176

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])

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

-.99 .. .99

 

Download detools_deplot_arrows_curve_problem_NOV_10_2023.mw

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).

Hello everyone, 

Can someone help me how to use a Matrix in sum?

Thanks

Given a system of 2 first order ode's which are autonomous (i.e. the RHS does not explicitly depend on time), one can make phase plot in Maple using DEtools:-DEplot

I am trying to get my Maple output to look like I get with Mathematica. I am getting close, but there are two issues. First, here is what I get in Maple

restart;

ode1:=diff(x(t),t)=2*x(t)*y(t);
ode2:=diff(y(t),t)=1-x(t)^2-y(t)^2;

DEtools:-DEplot([ode1,ode2],[x(t),y(t)],
                           t=0..1,x = -4..4, y = -4..4,arrows=curve,linecolor=red,
                           numpoints =300,arrowsize='magnitude',scene=[x(t),y(t)]);

Here is the same thing in Mathematica

ode1=x'[t]==2*x[t]*y[t]
ode1=y'[t]==1-x[t]^2-y[t]^2

StreamPlot[{2 x*y,1-x^2-y^2},{x,-4,4},{y,-4,4},
    FrameLabel->{{y[t],None},{x[t],None}},BaseStyle->16,ImagePadding->{{50,10},{50,0}}]

Is it possible to get the arrows to be stream lines similar to how they show up? Also, the axes labels in Maple are internal and hard to see. Is it possible to have on the outside like above so they are easier to see?

On a side question: Should one use DEtools:-DEplot or DEtools:-phaseportrait I could never understand when to use one vs. the other.

Maple 2023.2 on windows

Once the terms have been selected, as below

I only need to keep terms that contain a certain function with generic arguments, for example, tanh(x), in this case, that is, I want from A01

-(m2/4) tanh(2k-2ç)+(m2/16) tanh(4k+2ç)+-(m2/4) tanh(2k+2ç)+(3m2/8) tanh(2ç)

and delete the terms

3/16-(3/16)m2^2

What's the best command to make that? In other words, always exclude terms that do not accompany tanh

I am using Maple to compute the principal part around the point 0, which involves obtaining the series expansion terms with strictly negative powers. This is necessary for my work on evaluating infinite integrals that involve complex functions. While I can calculate these expressions manually, I am exploring whether Maple already offers a convenient tool for this purpose. For instance, Maple's built-in Laurent series expansion can be used to obtain the principal part of functions like BesselK(4, x) as 48/x^4 - 4/x^2. Any assistance on this matter is greatly appreciated. Thank you for your help.

I want to solve the following elliptic integral with symbolic inputs a, b, c, and d, and requires a closed-form solution in Legendre's form in terms of these input variables. I want to know how can I solve this using Maple

  int(1/sqrt((a - t)(t - b)(t - c)(t - d)), t = b .. a)

Condition: a>t>b>c>d

Download maple_query.mw

How do I solve sol1 in terms of DC and T (and tau)?
restart

eq1 := x2 = x1+(A-x1)*(1-exp(-ton/tau))

 

 

eq2 := x1 = x2*exp(-toff/tau)

 

eq3 := T = ton+toff

 

NULL

eq4 := DC = ton/T

 

sol1 := simplify(`assuming`([solve({eq1, eq2}, {x1, x2})], [`and`(`and`(`and`(`and`(A > 0, tau > 0), ton > 0), toff > 0), T > 0)]))

{x1 = A*(exp(-ton/tau)-1)*exp(-toff/tau)/(exp((-toff-ton)/tau)-1), x2 = (exp(-ton/tau)-1)*A/(exp((-toff-ton)/tau)-1)}

(5)

Thank youNULL

Download dutycycle.mw

For any given function solely and exclusively given by exponentials, as follows (expression A1), I need to select the argument of each exponential and apply it to any function, for example COS(X)

A1 :=  exp(4*k)/4 + exp(2*k)/2 - exp(-2*k)/2 - exp(-4*k)/4+5

That is, we would have

A1':=cos(4*k)/4 + cos(2*k)/2 - cos(-2*k)/2 - cos(-4*k)/4+5

I know this result is zero, but this is a simple example. What is the best way to do this?

I have a linear system of 3 equations in 3 variables and have no issues with solving it using solve().

I am having issues with solving it by imposing assumptions on my parameters. The infolevel[solve] now outputs "Entering solver with 6 equations in 3 variables", so I am likely making mistakes in the syntax solve(Eqs, Vars, UseAssumptions) assuming ... first of all, do I even need to do this given the assume statements that I set up on top of my script? How do I make sure that all the assumptions are preserved throughout all the calculations in my worksheet?

Moreover, I don't know why I get SolutionsLost: setting solutions lost flag.

My script: 061123_solving_with_assumptions.mw

First 7 8 9 10 11 12 13 Last Page 9 of 2281