{"uid":"cap_h7FJRGjhc0LqXlNq2kYmE","slug":"weighted-average-calculator-with-plain-average-comparison-30cad761","name":"Weighted Average Calculator with Plain Average Comparison","description":"Weighted average, with the plain average for comparison — Genesis402 / UnyKorn Operator Network","url":"https://twin.unykorn.org/weighted-average?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"params":{"type":"object","properties":{"values":{},"weights":{}}}}},"responseSchema":{"type":"json","example":{"ok":true,"type":"weighted-average","receipt":{"tx_hash":"0x<64hex>","amount_usd":0.002,"receipt_id":"g402-<16hex>"},"generated_at":"<iso8601>"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_EKTaCrLT_FISAqMDyuB4b","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes a weighted average of a list of values given corresponding weights, and returns the plain (unweighted) average alongside for comparison.","exampleAgentPrompt":"Calculate the weighted average of [80, 90, 70] with weights [1, 2, 1], and also show me what the plain unweighted average works out to.","exampleUseCases":[{"title":"GPA calculation from graded courses","prompt":"I have three courses with grades 85, 92, and 74, and credit hours of 3, 4, and 2 respectively — can you compute the weighted average GPA and also tell me what the plain average would be?"},{"title":"Portfolio weighted return analysis","prompt":"My portfolio has three assets with returns of 5%, 8%, and -2%, and I have 50%, 30%, and 20% allocated to each — what's the weighted average return, and how does it compare to just averaging the returns equally?"},{"title":"Survey response weighting by group size","prompt":"I ran a survey across three groups that rated satisfaction as 7, 8, and 6 out of 10, with group sizes of 200, 150, and 50 people — what's the weighted average satisfaction score versus the plain average?"}],"resultDescription":"Returns a JSON object with a boolean ok status, the result type labeled 'weighted-average', the computed weighted average and plain average for comparison, a generated_at ISO8601 timestamp, and a payment receipt containing tx_hash, amount_usd, and receipt_id.","failureModes":["Mismatched lengths between values and weights arrays causing a 400 error","Missing or empty values/weights parameters returning a validation error","Non-numeric values in the arrays causing computation failure","Payment failure via x402 protocol preventing endpoint access","Weights summing to zero causing a division-by-zero error"],"whenToPreferThis":"Use this endpoint when you need to compute a weighted average and want the plain average surfaced automatically for side-by-side comparison. Particularly useful for finance (portfolio returns), education (GPA), or survey analysis scenarios where different items have different levels of importance or representation. Choose this over a manual calculation when operating in an agentic workflow that already uses x402 micropayments.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-01T18:55:18.683Z","isFirstParty":false,"canonicalSlug":"weighted-average-calculator-with-plain-average-comparison-30cad761"}