MaplePrimes Questions

Hi

I want to count in a list L with many sublists the number of sublists, that contain m elements and only primes. How can I do that?

Example:

L:=[[2,3,5,7],[7,13,29],[2,3,4],[5,31,53]], m=3

The result should be 2, because only [7,13,29] and [5,31,53] satiesfy both criteria.

Thank you for an answer!

Why Maple gives

           improper op or subscript selector

On this ode? I was not expecting to see steps for this, but was just trying to see what it will show.

restart;

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 1810 and is the same as the version installed in this computer, created 2024, September 18, 18:16 hours Pacific Time.`

libname;

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

restart;

ode:=sin(x)*diff(y(x),x$2)+cos(x)*diff(y(x),x)+(sin(x)-cos(x))*y(x)=0;

sin(x)*(diff(diff(y(x), x), x))+cos(x)*(diff(y(x), x))+(sin(x)-cos(x))*y(x) = 0

dsolve(ode);

y(x) = c__1*(tan((1/2)*x)+I)^(1/2+(1/2)*(5-4*I)^(1/2))*(tan((1/2)*x)-I)^((1/2)*(5+4*I+(5+4*I)^(1/2))/(5+4*I)^(1/2))*HeunG(2, 2*(((3/4)*(5-4*I)^(1/2)+7/4-I)*(5+4*I)^(1/2)+5/4+I+(5/4+I)*(5-4*I)^(1/2))/(5+4*I)^(1/2), 1+(1/2)*(10+2*41^(1/2))^(1/2), (1/2)*((5+4*I)^(1/2)*(5-4*I)^(1/2)+5+4*I+2*(5+4*I)^(1/2))/(5+4*I)^(1/2), 1+(5-4*I)^(1/2), 1, 1-I*tan((1/2)*x))+c__2*(tan((1/2)*x)+I)^(1/2-(1/2)*(5-4*I)^(1/2))*(tan((1/2)*x)-I)^((1/2)*(5+4*I+(5+4*I)^(1/2))/(5+4*I)^(1/2))*HeunG(2, -2*(((3/4)*(5-4*I)^(1/2)+(-7/4+I))*(5+4*I)^(1/2)+(-5/4-I)+(5/4+I)*(5-4*I)^(1/2))/(5+4*I)^(1/2), -(1/2)*(5-4*I)^(1/2)+1+(1/2)*(5+4*I)^(1/2), (1/2)*(-(5+4*I)^(1/2)*(5-4*I)^(1/2)+5+4*I+2*(5+4*I)^(1/2))/(5+4*I)^(1/2), 1-(5-4*I)^(1/2), 1, 1-I*tan((1/2)*x))

Student:-ODEs:-ODESteps(ode)

Error, (in Student:-ODEs:-OdeSolveOrder2) improper op or subscript selector

 


 

Download internal_error_ODEsteps_sept_26_2024.mw

Hi I wanna move the expressions except a^2 in the first term of p1 to after a^2 in the last term, and move the expressions except a^2+b^2 in the second term to after a^2+b^2 in the second-to-last term, etc., and achieve the reverse effect on p1 through  operation.

Maple code is as below (I add more letters in maple code compared to the above image)

with(ListTools)

p := map[scan = `+`](proc (x) options operator, arrow; x^3 end proc, [a, b, c, d, e, f, g, h, i, j, k])

[a^3, a^3+b^3, a^3+b^3+c^3, a^3+b^3+c^3+d^3, a^3+b^3+c^3+d^3+e^3, a^3+b^3+c^3+d^3+e^3+f^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3+i^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3+i^3+j^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3+i^3+j^3+k^3]

(1)

p1 := Reverse(p)

[a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3+i^3+j^3+k^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3+i^3+j^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3+i^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3+h^3, a^3+b^3+c^3+d^3+e^3+f^3+g^3, a^3+b^3+c^3+d^3+e^3+f^3, a^3+b^3+c^3+d^3+e^3, a^3+b^3+c^3+d^3, a^3+b^3+c^3, a^3+b^3, a^3]

(2)

nops(p1)

11

(3)
 

``

Download The_inverse_operation_of_map_on_the_elements_in_list.mw

How to collect coefficients of eta^j, j=0,1 from (7)?

restart

with(LinearAlgebra)

with(plots)

with(Physics)

interface(showassumed = 0)

Setup(mathematicalnotation = true)

[mathematicalnotation = true]

(1)

quantumOperators := {H, Id, Mqu, Mqu1, Theta, X, X1}

{H, Id, Mqu, Mqu1, Theta, X, X1}

(2)

Setup(quantumoperators = quantumOperators)

[quantumoperators = {H, Id, Mqu, Mqu1, Theta, X, X1}]

(3)

assume(x::real); assume(t::real)

alias(q = q(x, t), qb = qb(x, t), r = r(x, t), rb = rb(x, t), psi = psi(x, t), phi = phi(x, t), g = g(x, t), gb = gb(x, t), H = H(x, t), X = X(x, t), X1 = X1(x, t), Theta = Theta(x, t), eta = eta(t), Mqu = Mqu(x, t))

q, qb, r, rb, psi, phi, g, gb, H, X, X1, Theta, eta, Mqu

(4)

``

NULL

D1 := (Id*eta-H).X

eta*Physics:-`*`(Id, X)-Physics:-`*`(H, X)

(5)

D2 := diff(D1, x); D3 := subs({diff(X, x) = Mqu}, D2)

eta*Physics:-`*`(Id, diff(X, x))-Physics:-`*`(diff(H, x), X)-Physics:-`*`(H, diff(X, x))

 

eta*Physics:-`*`(Id, Mqu)-Physics:-`*`(diff(H, x), X)-Physics:-`*`(H, Mqu)

(6)

D3+D1 = D1*Mqu1

eta*Physics:-`*`(Id, Mqu)-Physics:-`*`(diff(H, x), X)-Physics:-`*`(H, Mqu)+eta*Physics:-`*`(Id, X)-Physics:-`*`(H, X) = Physics:-`*`(eta*Physics:-`*`(Id, X)-Physics:-`*`(H, X), Mqu1)

(7)

collect(coeff, eta, 1)

1

(8)

collect(coeff, eta, 0)

0

(9)
 

NULL

Download coefff.mw

Hello,

I am a completely new user; please forgive me for this newbie quesiton:

When trying to solve for the intersection between a parabola and a line (or a similar system), if the solutions involve integers, Maple display the solutions well. However, when the solutions involve square roots, the solution is much less "neat". Please see the picture below.

I wonder if there is some setting I can flip so that Maple outpus solutions with radicals? Thank you.

Daniel

I recently encountered an interesting issue when solving for the domain of a function in Maple using two different approaches, and I am curious about the differences in results between the following commands:

  1. domain := solve(0 < x and x <> 2, x);
  2. domain := solve({0 < x, x <> 2}, x);

I wonder if anyone could explain why Maple might treat these two syntaxes differently.

restart

``

h := proc (x) options operator, arrow; ln(x)/(x-2) end proc

proc (x) options operator, arrow; ln(x)/(x-2) end proc

(1)

domain_ln := solve(x > 0, x)

RealRange(Open(0), infinity)

(2)

denom_undefined := solve(x-2 = 0, x)

2

(3)

domain := solve(`and`(x > 0, x <> 2), x)

RealRange(Open(0), infinity)

(4)

solve({x > 0, x <> 2}, x)

{2 < x}, {0 < x, x < 2}

(5)

``

plot(h(x), x = 0 .. 10, discont = true, color = blue)

 

``


 

Download domain.mw

I am new to Maple will appreciate any advice.

I am trying to write a procedure to solve a cubic equation using fsolve, print the root at each stage, and store results in a table for later use.  

I have restricted the range of fsolve, but I know from other sources that there is a solution within this range.

The instructions work if entered manually line by line, but not as a procedure.

The code is copied below.  Thanks for any suggestions.

Stephen Martin

Reg_IV := proc (beta, n) local alpha, b, c, d, k, `&alpha;L`, 

   `&alpha;R`, delta, eqn, x; `&alpha;L` := 3+beta-6*beta^(1/2);\

   `&alpha;R` := 1-beta; delta := (`&alpha;R`-`&alpha;L`)/n; 

   print(`&beta; = `, evalf(beta, 5), `n = `, evalf(n, 5)); 

   print(`&alpha;L = `, evalf(`&alpha;L`, 5), ` &alpha;R = `, 

   evalf(`&alpha;R`, 5), `&delta; = `, evalf(delta, 5)); 

   print(``); for k from 0 to n+1 do alpha := `&alpha;L`+k*delta\

  ; b := -5+alpha-3*beta; c := 8-4*alpha-6*beta+2*beta^2-2*alpha\

  *beta; d := -(4*beta+4)*(1-alpha-beta); eqn := proc (b, c, d, 

   x) options operator, arrow; {x^3+b*x^2+c*x+d} end proc; x[k] 

   := fsolve(eqn, 0 .. 2); print(evalf(x[k], 5)) end do; 

   print(``); print(evalf(x, 5)) end proc


Reg_IV(0.2, 4);
                    &beta; = , 0.2, n = , 4.

 &alpha;L = , 0.51672,  &alpha;R = , 0.8, &delta; = , 0.070820


                      fsolve(eqn, 0 .. 2)

                      fsolve(eqn, 0 .. 2)

                      fsolve(eqn, 0 .. 2)

                      fsolve(eqn, 0 .. 2)

                      fsolve(eqn, 0 .. 2)

                      fsolve(eqn, 0 .. 2)


   TABLE([0 = fsolve(eqn, 0 .. 2), 1 = fsolve(eqn, 0 .. 2), 

     2 = fsolve(eqn, 0 .. 2), 3 = fsolve(eqn, 0 .. 2), 

     4 = fsolve(eqn, 0 .. 2), 5 = fsolve(eqn, 0 .. 2)])


 

Using the parametric representation of a circle in 2 dimensions:  c + r*cos(t)*v + r*sin(t)*u, t = 0..2*Pi,  where c is the center, r is the radius, v and u are orthogonal unit vectors, I want to animate the circle for r = r1..r2.

Example:

animate(plot, [c+r*cos(t)+r*sin(t),t=0..6.3],r=5..10);

I don't understand why this doesn't work!!  

Thank you

Hi

I am looking for a more efficient way to find all Divisors of n that are smaller than m as

Divisors(n) intersect {seq(i),i=1..m}

For example: For n=24 and m=7 it should result {1.2.3.4.6}.

Thanks for your help!

mm.mw    I want to obtain T_1*P_1*T_2*P_2*T_3*P_3. What should I do?

I want to test how well Maple's numeric solver respects a variety of conservation laws. To do so, I must numerically integrate a numerical derivative; however, every method I've tried using does not work. In essence, I need the following code to work.

restart;
with(PDEtools); with(plots); with(DEtools);
pde := diff(v(x, t), t, t) = diff(v(x, t), x, x);
f := xi -> exp(-xi^2);
a := -10; b := 10; dx := 1/50; t_final := 10;

pds := pdsolve(pde, {v(a, t) = 0, v(b, t) = 0, v(x, 0) = f(x + 5), D[2](v)(x, 0) = -eval(diff(f(x), x), x = x + 5)}, numeric, range = a .. b, time = t, spacestep = dx);

sol_proc := rhs(pds:-value(output = listprocedure)[3]);
sol := (x, t) -> piecewise(a < x and x < b, sol_proc(x, t), 0);
int(fdiff(sol(x, t), [t = 0]), a .. b);

Error, (in depends) too many levels of recursion

Verification_24_09_2024.mw

In the attached file, in the subsection named #Transmittance calculation I had an issue with the absolute value calculation. The calculation in the first part for the expression a1 was carried out although with addition of some strange t parameter in the exponent power. The second one just didn`t. I will be more than grateful for some help and advice. In addition, I have been struggling with that for a long time so if you have in mind some book or youtube lesson that clarifies all of that I will be more than happy. Nothing valuable was found on the web so far :(

The result of the function was computed successfully using the proc function, but how to plot the computed image? Using the seq command but the step size can not get the desired, using the for loop is too cumbersome, what should be done?fuxian.mwfuxian.mw

Hi everyone, I buy a new laptop with high resolution (2560x1600), I wanna zoom in the size of toolbar (like the icon size of File, Edit, View,......). I modify the fontsize, so for well-proportioned I wanna modify the icon size but I failed.


 

How can I make some triangles in a bigger triangle knowing its perimeters like this picture?

2 3 4 5 6 7 8 Last Page 4 of 2363