from 2015-6-7

自分用の備忘録としてネット上にも残しておこうと思い書いています

maple-xの一次の項と定数項の係数を選ぶ方法

xの係数がこれこれ、定数項の係数がこれこれとするやりかた

r := (-3161*a+59*b+147036)*x+2160*a-40*b-100489;
solve({coeff(r,x)=2,coeff(r,x,0)=1},{a,b});

説明: coeff(r,x)=2は式rの中のxの係数が2, coeff(r,x,0)=1は式rのx^0(つまり定数)の

係数が1、そうなるようなa,bを求めるということ

数学-極座標系の二点間の距離

極座標系の二点の距離

2次元の極座標の例ですが
点P = (r,θ)
点Q = (q,φ) の距離の二乗は

r^2+q^2-2qr*cos(θ-φ) で得られます

実際
点P,Qの極座標表示をxy座標に直すと
P = ( rcos(θ), rsin(θ))
Q = ( qcos(φ), qsin(φ))

よって二点間の距離の二乗は
(rcos(θ)-qcos(φ))^2+(rsin(θ)-qsin(φ))^2
= r^2+q^2-2qr{cos(θ)cos(φ)+sin(θ)sin(φ)}
= r^2+q^2-2qr*cos(θ-φ)
になります
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1343924698

maple-mapleのplot

a:= x^2 - abs(x):
plot(a,x=-2 .. 2);
b := x * sin(x): plot(b,x = -Pi .. Pi);
c := 2 * sin(x) + sin(2*x): plot(c , x = 0 .. 2*Pi);
d:= exp( - x^2): plot(d, x = -infinity .. infinity);
f:= x -> if abs(x) <= 1 then abs(abs(x) - 1) else 0 fi;
x -> if |x| <= 1 then ||x| - 1| else 0 fi;
plot(f(x), x = -3 .. 3);
Error, (in f) cannot determine if this expression is true or false: abs(x) <= 1
f(3);
                               0
f(0);
                               1
g := proc(x)
if abs(x) <= 1 then abs(abs(x) - 1)
 else 0
 fi
 end proc;
proc(x)  ...  end;
plot('g(x)', x = -3..3);
h := proc(x)
if abs(x) > 1 then x^2
elif abs(x) = 1 then 0
else - x^2
fi
end proc;
proc(x)  ...  end;
plot(h, -2..2, -10 .. 10);
h(1);
x -> 0
plot({seq( x^j , j = 1 .. 4)}, x = -1.5 .. 1.5);
plot({seq( sin(k*x) , k = 1 ..4)}, x = 0 .. Pi, title = 'sin
( kx ) \in [-Pi, Pi]');
plot([cos(t), sin(t), t = 0 .. Pi], scaling = constrained);
plot([3*t/(1 + t^3), 3*t^2/(1 + t^3), t = -5 .. 5], -2 .. 2, -5 .. 5);

?polarplot
with(plots):
polarplot(3*cos(x), x = 0 .. 2*Pi);
polarplot([1+cos(t),t,t= -Pi .. Pi]);
plot([1+cos(t),t,t= -Pi .. Pi], coords=polar, scaling = constrained);
plot([t,Pi/3, t = -infinity .. infinity], 0 .. 5, 0 .. 5, coords = polar, scaling = constrained);
plot([cos(t), t, t = -Pi/2 .. Pi/2], coords = polar, scaling = constrained);
plot([1 + cos(t), t, t = -Pi .. Pi], coords = polar, scaling = constrained);
polarplot([(sin(t/3))^3, t, t= 0 .. Pi], scaling = constrained);
plot([1+t, t, t = 0 .. Pi/2], coords = polar, scaling = constrained);
polarplot([1+t, t, t = 0 .. Pi/2], scaling = constrained);
polarplot([sqrt(cos(2*t)), t, t = -Pi .. Pi]);

with(plots):implicitplot(x^2 + y^2=1 , x = -2 .. 2, y = -2 .. 2, scaling = constrained);
implicitplot(y^2 = x, x = -10..10, y = - 5 .. 5, scaling = constrained);
implicitplot(y^2 = x*(x-1), x = -3 .. 3, y = -9 .. 9, numpoints = 500000);

with(plots):implicitplot(x^3 - 3*x*y + y^3 = 0, x = -5 .. 5, y = -5 .. 5, numpoints = 20000);
implicitplot(9*x^2 + 24*x*y + 16*y^2 - 26*x + 7*y - 34 = 0, x = -10 .. 10, y = -10 .. 10, numpoints = 10000);

plot3d(sin(x^2 + y^2), x = -Pi/2 .. Pi/2, y = -Pi/2 .. Pi/2);
plot3d(x^2 + y^2, x = -2 ..2, y = -2 ..2);

maple-expression sequenceを作る_素数を選ぶ

expression sequenceをつくる, sequenceから選ぶ

$1..5
で1, 2, 3, 4, 5ができる

# sequenceから選ぶ
select(isprime, [$100..150]);%sequenceから選ぶ
# i番目の素数のsequenceを作る
seq(ithprime(k), k = 1 ..20);

maple-sumとproduct

sumとproductについて

seq(Sum(k^j, k = 1 .. n)= factor(sum(k^j, k = 1 .. n)),j = 1 .. 10);

Sum(k, k = 1 .. n):
% = factor(value(%));

#valueはSumというinertフォームを活性化するために使う。

 

Product(i,i=1..10):%=value(%);
Product(x - a[j],j=1..5): %=value(%);

差積は
n:=10:product(product(x[i] - x[j],j=i+1..n),i=1..n - 1);