## 148 Reputation

18 years, 136 days

## How to get the index of some elements?...

Maple
I have two small questions: 1. Given a list L: L:=[false, false, true, true, FAIL,false]; and I want to get the positions of "FAIL" (in this case 5) and false (1,2,6). HOW could I get that? 2. Now, given another list Z with the same number of elements: Z:=[z1,z2,z3,z4,z5,z6]; I would like to replace the values of FAIL by 0 (zero). (in the way that Z became: Z:=[z1,z2,z3,z4,0,z6];) It is possible to do that without using "for do" commands? Thanks in advance, JJacques

## 2 small questions.....

Maple
Hi dear Maple's gurus. I have the lists a and b: a:=[A, B, C] b:= [[K1,L1][K2,L2][K3,L3]] I want to add the each term of "a" in the intervals given in "b": sum(A from L1 to K1)+ ..+sum(C from L3 to K3). I tried with this procedure: > sums:= proc(a,b) local j,tot; tot:=0; for j from 1 to nops(a) do tot:=tot+sum(a[j], k=b[j,2]..b[j,1]); end do: end proc: >sums([a1,a2,a3],[[ku1,kl1],[ku2,kl2],[ku3,kl3]]); 1. Is there some more efficient way to do the same? 2. I would like also that the sums on a[j] under the following 2 join conditions: 2.1. assuming that a[j] is real and positive, and

## Numerator/ denominator......

Hi there! Assuming that I have the following fraction: fr1:= (x+1)/(x-1); I have the following 2 questions: 1. with which command could I take only the numerator "(x+1)"? (and for the denominator?) 2. Is it normal that whattype(fr1); returns a star * Thanks in advance for your answers, Jean Jacques

## It exist some way to factorize with "res...

Given an algebraic expression p(x,y)..it is possible to factorize assuming that some terms are involved?. For example if I have poly1 and I expand it, I obtain a poly2 (with several terms).. now, if I factor(poly3) I dont recover the exact expression poly1. But at least in this case, it would be possible to factorize (or collect) poly3 asumming that in numerator and denominator we have the term(x+y)?. Thanks in advance, JJacques. poly1:= ((1-x-y)^2+ (2+x+y)^3)/((1+x+y)^2+ (4-x-y)^2); poly2:= expand(%); poly3:=factor(%);

## Is "assume" or is "is" the reason?...

Hi, I cannot understand why IS fails below. Am I doing something wrong?. Maybe I generated a new variable when I wrote 2*L/(1-x-y).. Thanks a lot for reading this message, > restart; > assume(L=1/2); > assume(x>0,y>0); > additionally(x+y <> is(x <>"true" > is(2*L/(1-x-y)<>"FAILS" JJacques,
 1 2 3 4 5 6 Page 4 of 6
﻿