MaplePrimes Questions

i am trying to solve definite integral but i want result in A,B form i dont want to assign numerical values to them can i get that  in maple? i have tried evalf, eval and simplify command but it is not working kindly help me out

restart

NULL

integrand := p*exp(-A/sqrt(p)-B/p)

p*exp(-A/p^(1/2)-B/p)

(1)

integral := int(integrand, p = 0 .. infinity)

int(p*exp(-A/p^(1/2)-B/p), p = 0 .. infinity)

(2)

simplify(integral)

int(p*exp(-(A*p+B*p^(1/2))/p^(3/2)), p = 0 .. infinity)

(3)

evalf(integral)

int(p*exp(-1.*A/p^(1/2)-1.*B/p), p = 0. .. Float(infinity))

(4)

eval(integral)

int(p*exp(-A/p^(1/2)-B/p), p = 0 .. infinity)

(5)
 

NULL

Download integral.mwintegral.mw

I was wondering if this has ever been discussed?

File preview would make life easier when searching an older document.

Since it seems to be a non trivial programming task, I was wondering whether generating a pdf document in parallel to a worksheet could be an option (in a subfolder). However, doing this by hand for all existing documents is not pratical.
 

Could this (generating pdf files) be done by a batchjob?

 

Why does sqrt(-2) give as a result only i*sqrt(2)?

Why does the result not also include -i*sqrt(2)?

How to Call a maple code from inside a python code in jupyter say or sypder.

I tried to solve a equation f(x). Finally I got a polynomial with coefficients.  (see Solve_for_coefficients.mw)

I want to find the values of unknown coeffients in the last polynomial equation as procedure to equating each cofficients to zero.

For example, the coefficients of x^2 is 1/48*(-24*p[2]+48*q[1]+24*q[2]+24) = 0.

Likewise, collect all the coefficients from x^0 to x^4 and solve them. Finally we get the coefficients value.

My question is How to collect the coefficients in this polynomial and solve this coefficients?

Hi,

How do we get from equation 11 to equation 13 with Maple by converting equations 12?

Hello

I would like to calculate the number of partitions of a number s with length n, where the maximum value in the partitions is also n.

For example: s=10, n=4

The result should be 5, because there are 5 partions with length 4 and maximum value 4:

4411, 4321, 4222, 3331, 3322

If I use "PartitionFixedSize(10,'parts'=4)", it makes also partitions with values > 4, for example 5311. How to limit this?

Thank you for an answer!

Kind regards

 

 

Suppose we have the following simple Matrix

T := <1,2;3,4>;

How do we replace an entry with another expression?

I know that for a list L := [1,2,3] we can do, for example subsop(2=500,L) to replace the entry at index 2.

This creates a new list since lists are immutable.

As far as I can tell, a Matrix is mutable.

However, I wish to change an entry in a Matrix without mutating it.

My actual use case is the following.

I use LinearAlgebra:-Eigenvectors to obtain a Matrix of eigenvectors. Some of the entries are huge expressions with many variables. I would like to sub in placeholders where these huge expressions are so I can visualize the Matrix better, but without modifying the original Matrix.

Is it possible to  convert an existing document in worksheet mode to document mode in Maple22 ?

It seems you can only select either at creation of document but not convert documents already existing.

I switched to using smart plot in Maple since it makes it easier. Here is an example

sol:=[-1/4*x^2, x];
plot(sol,legend=sol)

But sometimes it gives internal error, like in this example, because some of the list of solutions give complex over some x domain

sol:=[-1/4*x^2, (-1/2-1/2*(-3)^(1/2))^2+(-1/2-1/2*(-3)^(1/2))*x, (-1/2+1/2*(-3)^(1/2))^2+(-1/2+1/2*(-3)^(1/2))*x];
plot(sol,legend=sol)

Luckily I can trap this error and workaround it. 

The strange thing is that if I give it explicit x range, then it works. It now can remove the solutions which give complex values automatically

p:=plot(sol,x=-4..4,legend=sol);

 

question is: Should not smart plot have done this automatically? That is why it is called smart plot.

i.e. remove those solutions that give complex values like the case the above? 

Maple 2024.1 on windows 10

 

I want to define a piecewise function. How do I test if a variable t is in a definite open or closed real range?

I am using the smart plot (i.e plot without giving the x=from..to) since I am generating these plots programmatically and better let Maple figure the best range to use.

But found Maple hangs on some solutions.

Here is an example

restart;
sol:=1/2/cos(x)*(sin(x)^2+(sin(x)^4+36*cos(x))^(1/2));
plot(sol);

I waited for 30 minutes and nothing happened.

If I change the above command to 

plot(sol,x=-Pi..Pi);

then it finishes instantly. It looks like Maple is stuck trying to find correct x and y ranges to use.

Is this known limitation  or smart plot or is this a bug?

Maple 2024.1 on windows 10.

 

What exactly is the difference between the differential operator d_[] from the physics package and diff() ? Why is it not possible for me to differentiate a scalar function g or a coordinate r with the help of the operator? d_[1] should correspond to d/dx (X = (x, y, z, t)) or not? 

restart

with(Physics)

with(Vectors)NULL

Setup(coordinates = cartesian)

[coordinatesystems = {X}]

(1)

r = sqrt(x^2+y^2+z^2)

r = (x^2+y^2+z^2)^(1/2)

(2)

d_[1](g(r))

0

(3)

diff(g(r), x)

(D(g))((x^2+y^2+z^2)^(1/2))*x/(x^2+y^2+z^2)^(1/2)

(4)

d_[1](r)

0

(5)

diff(r, x)

x/(x^2+y^2+z^2)^(1/2)

(6)

d_[1](x)

1

(7)

diff(x, x)

1

(8)

NULL

Download example_d_[].mw

restart;
with(Plot);
params := {alpha = 2.5, k = 3, w = 2, beta[3] = 3, beta[4] = 1.7};
xi := beta[3]*(2*alpha*k*t + x)*sqrt(1/(36*alpha*beta[4] + 36*gamma*beta[4]));
params := {alpha = 2.5, k = 3, w = 2, beta[3] = 3, beta[4] = 1.7}

          xi := beta[3] (2 alpha k t + x) 

                                                 (1/2)
            /                 1                 \     
            |-----------------------------------|     
            \36 alpha beta[4] + 36 gamma beta[4]/     


sol1n := u(x, t) = U(xi)*exp((-sqrt(1/(36*alpha*beta[4] + 36*gamma*beta[4]))*x + w*t + theta)*I);
                     /                          
                     |                          
 sol1n := u(x, t) = U|beta[3] (2 alpha k t + x) 
                     \                          

                                        (1/2)\    /  /
   /                 1                 \     |    |  |
   |-----------------------------------|     | exp|I |
   \36 alpha beta[4] + 36 gamma beta[4]/     /    \  \
                                       (1/2)                \\
  /                 1                 \                     ||
 -|-----------------------------------|      x + w t + theta||
  \36 alpha beta[4] + 36 gamma beta[4]/                     //



plot3d(rhs(sol1n), x = 0 .. 250, t = 0 .. 4);

how plot the the solution of PDE of this kind of function?

Download plot.mw

Hello

Here is the ODE

sys := {diff(w(t), t) = y(t)*z(t), diff(x(t), t) = a*w(t), diff(y(t), t) = x(t)*z(t) + w(t), diff(z(t), t) = -x(t)*y(t), w(0) = w0, x(0) = x0, y(0) = y0, z(0) = z0}

with initial parameters a=2, w0 = -0.727367040, x0 = -0.728244724, y0 = -0.237753623 and z0 = 0.014225402.

With these parameters I have no problem to plot the solution.

nsys := subs({a=2,w0 = -0.727367040, x0 = -0.728244724, y0 = -0.237753623, z0 = 0.014225402},sys);

numsol := dsolve(nsys, numeric, method = rkf45);

vars:=[x,y,z,w];

with(plots):

col := [red, magenta, cyan, blue]:
display(
  seq(
    plots:-odeplot(numsol, [t, vars[i](t)], t=0..3, color=col[i], legend=vars[i](t))
    , i=1..numelems(vars)
  )
)

How to use animate (or explore?)  with a slider for each parameter (a,x0,y0,z0,w0)? And if I want to add a tfinal as well for the simulation (in place of 3)? ( I am newbie as far as using plot and related functions in Maple).  

Many thanks. 

First 85 86 87 88 89 90 91 Last Page 87 of 2427