1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pythonによるStandard受験編254

Last updated at Posted at 2022-05-03

問題254

p,qを定数としてp≠0とする\\
関数f(x)=px^3-qx+p
はx=αで極大値αを持つとする。\\
このときαの値

を求めよ。
そのときのqをpで表せ


import sympy 
α,x,p,q= symbols('α x p q')
f=p*x*x*x - q*x+p
fa=f.subs(x,α)-q#f(α)=qなので
fa
f1=sympy.diff(f, x)#f(x)を微分
expr1=f1.subs(x, α)#
expr1
solve([expr1, fa],[q,α])#連立方程式を解く,q,αに関して

問題256

関数f(x)=(x-1)^2(x+1)^2について次の問いに答えよ\\
(1)関数Y=f(x)の増減及び極値を調べてそのグラフの概形をかけ\\

(2)tを変数とする。関数をy=f(x)のグラフ上の点(t,f(t))における接線lの方程式tを用いて表せ\\


import sympy as sp
x,t= sp.symbols('x t')

f=(x-1)*(x-1)*(x+1)*(x+1)
f1=sympy.diff(f, x)
katamuki=f1.subs(x,t)

yy=katamuki*(x-t)-f.subs(x,t)
sp.expand(yy)


ans=sp.solve(f1,x)
for xx in ans:
    fa=f.subs(x,xx)
    print("x=",xx,"極値",fa)



import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-2, 2, 0.02)
y=(x-1)*(x-1)*(x+1)*(x+1)
plt.grid()
plt.ylim(-0.5,2)
plt.plot(x, y)




1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?