jbmorell

4 Reputation

2 Badges

15 years, 60 days

MaplePrimes Activity


These are replies submitted by jbmorell

Ok, thanks again
Ok, thanks again
Hello Riel, I am sorry I made a mistake in the formulation, nevertheless what you said before is also of interest to me. I had really initialized eq as an array instead of eq1. The problem is that when I write > restart:assume(t::real, g::real): > eq := Array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) the instructions map(eval, M) doesnt take into account the changes t:=x+2 , x:=1 (why this happens? is the question) Nevertheless, if you try this > > restart; > eq := Array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t assuming t:: real,g::real;end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) then things are ok. As I said, for me both codes are equivalents, except the fisrt, which doenst take into account the evaluations. Regards
Hello Riel, I am sorry I made a mistake in the formulation, nevertheless what you said before is also of interest to me. I had really initialized eq as an array instead of eq1. The problem is that when I write > restart:assume(t::real, g::real): > eq := Array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) the instructions map(eval, M) doesnt take into account the changes t:=x+2 , x:=1 (why this happens? is the question) Nevertheless, if you try this > > restart; > eq := Array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t assuming t:: real,g::real;end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) then things are ok. As I said, for me both codes are equivalents, except the fisrt, which doenst take into account the evaluations. Regards
Ok, ok, I will take it into account. Thanks. By the way, I had another ride, maybe it is of interest to you. I have solve it by using a trick, but I am not very happy with the solution, I think that there is something that doesnt works correctly. Here it goes Try this code > restart:assume(t::real, g::real): > eq1 := array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) As you see, the instructions map(eval, M) doesnt take into account the changes t:=x+2 , x:=1 Nevertheless, if you try this > > restart; > eq1 := array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t assuming t:: real,g::real;end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) then it evaluates correctly the change. I dont know too much of maple but common sense says that both codes are equivalent, nevertheless they are not. Well if you you know what happen here, let me know Regards
Ok, ok, I will take it into account. Thanks. By the way, I had another ride, maybe it is of interest to you. I have solve it by using a trick, but I am not very happy with the solution, I think that there is something that doesnt works correctly. Here it goes Try this code > restart:assume(t::real, g::real): > eq1 := array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) As you see, the instructions map(eval, M) doesnt take into account the changes t:=x+2 , x:=1 Nevertheless, if you try this > > restart; > eq1 := array(1 .. 2, 1 .. 2): for u to 2 do: for v to 2 do eq[u, v] := g*t assuming t:: real,g::real;end do: end do; > t := x+2 > M := map(eval, eq) > x := 1 >map(eval, M) then it evaluates correctly the change. I dont know too much of maple but common sense says that both codes are equivalent, nevertheless they are not. Well if you you know what happen here, let me know Regards
Thanks a lot Riel. It works. These are my first steps and now just learning a little bit of proc. Thanks again Bye
Thanks a lot Riel. It works. These are my first steps and now just learning a little bit of proc. Thanks again Bye
Page 1 of 1