ef X(n):
# 差分方程的解
return 2 * (-1)**(n + 1)
n_values = [0, 1, 2, 3, 4, 5]
for n in n_values:
print(f"X({n}) = {X(n)}")
print("学号:3028")
import networkx as nx
G = nx.DiGraph()
for i in range(1, 7):
G.add_node(i)
edges = [
(1, 2), (1, 4), (1, 5), (1, 6),
(2, 4), (2, 5), (2, 6),
(4, 5),
(6, 5)
]
G.add_edges_from(edges)
pagerank = nx.pagerank(G, alpha=0.85)
sorted_articles = sorted(pagerank.items(), key=lambda item: item[1], reverse=True)
print("文章影响力排序:")
for article, rank in sorted_articles:
print(f"文章{article}: {rank:.4f}")