[英]How to calculate the percentage of the total, when the total includes the percentage -circular calculations
對於這個問題,需要計算最終的合同價格。
令 c 為合同價格 = 例如 100 i = 利息(c 的 1%) g = 另一個百分比(例如 c 的 1%)
然而,總合同價格需要使用 c + i + g 的 i 和 g 來計算。 換句話說,最終值必須包括計算 i 和 g(百分比)占 c+i+g 總和的總和。 這可能嗎?
由於我們需要先計算 i 和 g,這似乎是不可能的/循環的。
我試圖在 python 中創建一些東西來模擬這個,但我們真正想要的是 excel 中的解決方案。
有沒有人能夠闡明這種似乎取決於未來價值的循環計算?
def totalcontractprice(c,i,g):
x=c+i+g
return x
def finalcontractprice(totalcontractprice):
#here we want to return the finalcontract price
#this should recalculate i and g as percentages of x (totalcontractprice)
c=100
i=1 #1 percent of c
g=1 #1 percent of c
print(totalcontractprice(c,i,g))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.