Items tagged with select select Tagged Items Feed

Filtering a Matrix

April 10 2012 by Petr Malik 28 Maple 15

Hello.

I need to filter a 2D Matrix based on the values in one of its columns.

Let's have a 2D Matrix like this one:

[1, 2]
[-2, 3]
[3, 18]

Now let's suppose we want to remove all rows with a negative number in the first column (second row in our example).

One possible solution would be to iterate over the whole Matrix in a for-loop removing rows one-by-one, but I was hoping for something more elegant (and hopefully faster).

Hi, I am trying to have a sequence of (0,Pi/32,2Pi/32,3Pi/32...Pi)

Here is what I did : theta:=[seq((Pi/33).n,n=0..32]:

Question 1 : Is this the same as doing 0:Pi/32:Pi in matlab?

Question 2 : how do i select the output? for example output 5 which is 4Pi/32.

Question 3 : how do I multiply it with another sequence of (0,2,4,6,.......64)? for example to get a new set of numbers (0,2Pi/32,8Pi/32.....)

Please help. Thanks.

I have the numerical solution of Phi(r,t) which is a numerical solution of a pde..

I want to find the following energy integral at fixed time say t=10 ,

Energy = int(a*r^2*Phi(r,10)^2 + 2*b*r*Phi(r,10)^3,r=0..infinity)... I could not find help in maple.. I guess I had to do the following

 

1. select the numerical solution dependent only on r at t=10 slice..

2.Use numerical methods to evaluate the integral..

 

 

I have data organized in a Matrix from which I want to select a sample based on a certain (simple) criterion, e.g. no cell in the first column to be negative.

I was quickly able to find a way to do it, inspired by a method Preben Alsholm used in a recent mapleprimes post.

But, I wondered, is that the most natural approach? So I quickly found another approach and compared them.

Any other suggestions welcome. Particularly methods that could...

At the start of my program I specify values for the parameters beta, Q and P. These values are used in calculations in the program. At some stage I then get a list from which I make a selection of elements that have positive imaginary parts. To illustrate. Here I assigned beta := 3; Q:=100;P:=100.

This is my list.

t1a := [VectorCalculus[`*`](sqrt(VectorCalculus[`*`](VectorCalculus[`+`](VectorCalculus[`+`](VectorCalculus[`*`](1440004, Pi^2), 9), VectorCalculus[`-`...

 

> I found this information and code quite useful. Now my set t1 changes slightly to include I and -I. I also set up conditionl statements to extract the right elements according to the criteria on the value of beta*Q as adviced previously. I then test this out using the values for (beta,Q) as (1,1), (-1,1),(0,1).

 

 

 

When beta*Q is positive (one in this case) I is not selected...

Hello All,

From the list

t1 := [((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2+8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), -((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2+8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), ((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2-8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2))^(1/2), -((-4*Pi^2-beta^2+4*beta^2*Q^2*Pi^2-8*I*Pi^2*beta*Q)/(4*Pi^2+beta^2-4*beta^2*Q*Pi+4*beta^2*Q^2*Pi^2...

I use a for loop to step through the operands of an expression and do a calculation on each operand. I am then unable to add up or otherwise access for manipulation the result of the for loop and wondered how this could be done. What I mean is as follows. I have the expression w

w := 2*(1/2/Pi+Q*cos(k*phi))*Q*cos(k*phi)*(exp(-1/2*sigma^2*k^2)-1)*t*(1/2/Pi+Q*cos(k*psi))/(beta^2*(1+beta^2*(1/2/Pi+Q*cos(k*phi))^2))+(1/2/Pi+Q*cos(k*phi))^2*Q*cos(k*psi)*(exp(-1/2*sigma^2*k^2...

When I solve a certain equation I get a list of solutions t as below. I want to select some of the solutions and assign them to variables. In the program I am writing the number of items in the list of solutions will vary and so I cannot really select the list item by using t[3].t[4] etc. for example. 

I want to be able to select only the list items with say a square root sign or another term such as Pi, beta etc that appears in the list of solutions. So...

From this expression I want to extract only terms with the variable x.

F := (1/2/Pi+Q*cos(k*x))^2*(1/2/Pi+Q*cos(k*y))/(1+beta^2*(1/2/Pi+Q*cos(k*x))^2);

 

I don't want to manually write it out rather extract the terms programmaticallly. I want to be left with

(1/2/Pi+Q*cos(k*x))^2 / (1+beta^2*(1/2/Pi+Q*cos(k*x))^2)

I have tried the collect fucntion but that did not seem to do it. Any suggestions...

about command "select"

March 24 2011 by belief111 3 Maple 14

Dear all,

I've got a Vector,

>V:=<xt[1, 1]*xt[1, 2]*alpha>;

and what I want to get is the elements in V which has xt[2,2]. In this case, <NULL> is what I am looking for.

I tried the following line:
> select(has,V,xt[2,2]);
     The result is Vector(1, {(1) = NULL});
when I tried
> select(has,V[1],xt[2,2]);
     The result is 1.
I have no idea where this

select a part of a list

October 08 2010 by gotamo 45

hey there, i have a simple question: lets say i have a list like:

list:=[[1,1],[2,4],[4,8],[5,7],[8,1],[5,3],[4,2]]

for some reason i only need the elements of this list from [4,8] to [5,3]. how do i

select these parts from my original list? (and i dont want to create the new list

by saying: take element 3..6 from list). thanks and cheers

Hi all

I'm fighting agaist this situation:

ccc:= sin(x);

S:= select(has,ccc,x)
     sin(x)
R:=remove(has,ccc,x);                                  
     sin()

 

what's that??? why doesn't it aswer 1 or " " istead?

How am I supposed to trust in the remove procedure? What should I do in order to...

Hi all!

solve({q[R1] >= 0, q[S] >= 0, `d&Pi;`[R1] = 0}, q[R1])

This command gives me a piecewise solution, showing somewhat like:

 

[] q[S] < 0.13...

[{q[R1] = ...(q[S])   }] q[S] => 0.13...

 

Is there some way to define that part of this piecewise function for which q[S]=>0.13 as a seperate function? I need to do some more work on q[R1...

I defined a procedure with two arguments.

The first one called Options is a list of lists (but no listlist), the second called Paratemers is a list of intergers.
Anyway both lists have the same number of elements and the ith element of Options is connected to its ith counterpart in Parameters.

One part within that procedure looks for an element in Parameters, that has a value of -1.

If that is the case, its counterpart in Options which will then be...

Page 1 of 1