Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- equivale := proc (p, q) options operator, arrow; (not p or q) and (p or not q) end proc;
- (p, q) -> (not p or q) and (p or not q)
- for p in [true, false] do for q in [true, false] do print(p, q, equivale(p, q)) end do end do;
- true, true, true
- true, false, false
- false, true, false
- false, false, true
- X := {seq(x, x = 1 .. 7)};
- {1, 2, 3, 4, 5, 6, 7}
- for x in X do for y in X do if irem(x^3*y+x*y^3, 5) <> 2 then print(x, y) end if end do end do;
- 1, 2
- 1, 3
- 1, 4
- 1, 5
- 1, 7
- 2, 1
- 2, 3
- 2, 4
- 2, 5
- 2, 6
- 3, 1
- 3, 2
- 3, 4
- 3, 5
- 3, 6
- 3, 7
- 4, 1
- 4, 2
- 4, 3
- 4, 5
- 4, 6
- 4, 7
- 5, 1
- 5, 2
- 5, 3
- 5, 4
- 5, 5
- 5, 6
- 5, 7
- 6, 2
- 6, 3
- 6, 4
- 6, 5
- 6, 7
- 7, 1
- 7, 3
- 7, 4
- 7, 5
- 7, 6
- for x in X do for y in X do if irem(x^3*y+x*y^3, 5) = 2 then print(x, y); break; break end if end do end do;
- 1, 1
- 2, 2
- 3, 3
- 4, 4
- 6, 1
- 7, 2
- Y := {seq(y, y = 0 .. 10)};
- {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
- for x in Y do for y in Y do if (x+1)^2+y^2 = 100 then print([x, y]) end if end do end do;
- [5, 8]
- [7, 6]
- [9, 0]
- h := proc (n) options operator, arrow; piecewise(n < 5, 1, 5 <= n, sum(j/(j+1), j = 1 .. n)) end proc;
- / n \
- | ----- |
- | \ |
- | ) j |
- n -> piecewise|n < 5, 1, 5 <= n, / -----|
- | ----- j + 1|
- \ j = 1 /
- evalf(h(8));
- 6.171031746
- f := proc (n) options operator, arrow; piecewise(n = 1, 1, 2 <= n, (1/2)*n*f(n-1)) end proc;
- / 1 \
- n -> piecewise|n = 1, 1, 2 <= n, - n f(n - 1)|
- \ 2 /
- f(20);
- 9280784638125
- -------------
- 2
- evalf(%);
- 12
- 4.640392319 10
- for n to 10 do if irem(f(n), 2) = 0 then print(n) end if end do;
- Error, invalid input: irem received 3/2, which is not valid for its 1st argument, m
Advertisement
Add Comment
Please, Sign In to add comment