Cody

10 Reputation

4 Badges

12 years, 150 days

MaplePrimes Activity


These are replies submitted by Cody

So v and w will be done separately then? 

 

So w will be :

 

w:= <5,4>; 

A:= <<1,1>|<2,3>>;

X:=LinearAlgebra[LinearSolve](A, v);

So v and w will be done separately then? 

 

So w will be :

 

w:= <5,4>; 

A:= <<1,1>|<2,3>>;

X:=LinearAlgebra[LinearSolve](A, v);

How would you add that to what I've already given?

How would you add that to what I've already given?

could you show one where it starts as a recursive procedure and then show you would change it to a non recursive while loop?

could you show one where it starts as a recursive procedure and then show you would change it to a non recursive while loop?

That's kind of what I'm looking for, though with two parts.  Like when some procedures say for i=1 do this, else do this.  Not sure if that made sense, it's a homework problem where I'm supposed to change a recursion procedure into a while loop.  The recursion procedure has a proc, local, and 2 statements in it.

That's kind of what I'm looking for, though with two parts.  Like when some procedures say for i=1 do this, else do this.  Not sure if that made sense, it's a homework problem where I'm supposed to change a recursion procedure into a while loop.  The recursion procedure has a proc, local, and 2 statements in it.

@Joe Riel Thanks so much for your help! I think I got it!

@Joe Riel Thanks so much for your help! I think I got it!

Ok I tried 2 things for the first part (i'm new to maple so I'm not sure exactly what I'm doing)

I'm not sure if these would work for the sequence part

 

first one

> seq(i,i="abcd");

    "a","b","c","d"

>L[];

     a,b,c,d

>L[-1],L[-2],L[-3],L[-4];

     d,c,b,a

I'm not sure if there's a way to get that into the recursion

 

second one (could only get it to work with numbers)

>n:=proc(x);

   return x+1

   end proc;

  for i from 0 to 3 do

   n(i);

    end do;

               1

               2

               3

               4

Ok I tried 2 things for the first part (i'm new to maple so I'm not sure exactly what I'm doing)

I'm not sure if these would work for the sequence part

 

first one

> seq(i,i="abcd");

    "a","b","c","d"

>L[];

     a,b,c,d

>L[-1],L[-2],L[-3],L[-4];

     d,c,b,a

I'm not sure if there's a way to get that into the recursion

 

second one (could only get it to work with numbers)

>n:=proc(x);

   return x+1

   end proc;

  for i from 0 to 3 do

   n(i);

    end do;

               1

               2

               3

               4

Thanks for all your help!

Thanks for all your help!

I have this given to me in my notes, is there a way to change it to work for the same question?

 

>PSeries:=proc(cfn,var,minreg::integer,maxreg::interger)

  local r,imaxreg,iminreg;

 

    if minreg>maxreg then

      imaxreg:=minreg;

      iminreg:=maxreg;

    else

      imaxreg:=maxreg;

      iminreg:=minreg;

    end if;

 

     sum(cfn(r)*var^r,r=iminreg..imaxreg);

    end proc:

>PSeries(i->1/i!,x,2,0);

       1+x+(1/2)*x^2

 

Is there a way to make it work for the partial sum of the alternating series

1-(1/4)+(1/9)-(1/16)+..+((-1)^(n-1))*(1/n^2)   ?

1 2 Page 1 of 2