پرش به محتوا
منوی اصلی
ناوبری
  • تغییرات اخیر
  • مقالهٔ تصادفی
ویکی حج
جستجو
  • ایجاد حساب
  • ورود
  • ایجاد حساب
  • ورود
صفحه‌هایی برای ویرایشگرانی که از سامانه خارج شدند بیشتر بدانید
  • مشارکت‌ها
  • بحث

در حال ویرایش پودمان:Math

  • پودمان
  • بحث
  • خواندن
  • ویرایش مبدأ
  • نمایش تاریخچه
ابزارها
عمل‌ها
  • خواندن
  • ویرایش مبدأ
  • نمایش تاریخچه
عمومی
  • پیوندها به این صفحه
  • تغییرات مرتبط
  • بارگذاری پرونده
  • صفحه‌های ویژه
  • اطلاعات صفحه
در پایگاه‌های دیگر
  • ویکی‌شیعه
  • دانشنامه اسلامی
  • امامت پدیا
  • ویکی‌پاسخ
  • ویکی حسین
ظاهر
متن
این صفحه همیشه از قلم در اندازهٔ کوچک استفاده می‌کند
عرض
این محتوا تا حدی که پنجرهٔ مرورگرتان اجازه می‌دهد عریض است
هشدار: شما وارد نشده‌اید. نشانی آی‌پی شما برای عموم قابل مشاهده خواهد بود اگر هر تغییری ایجاد کنید. اگر وارد شوید یا یک حساب کاربری بسازید، ویرایش‌هایتان به نام کاربری‌تان نسبت داده خواهد شد، همراه با مزایای دیگر.

این ویرایش را می‌توان خنثی کرد. لطفاً تفاوت زیر را بررسی کنید تا تأیید کنید که این چیزی است که می‌خواهید انجام دهید، سپس تغییرات زیر را ذخیره کنید تا خنثی‌سازی ویرایش را به پایان ببرید.

نسخهٔ فعلی متن شما
خط ۵۲: خط ۵۲:
-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,
-- Use a function on all supplied arguments, and return the result. The function must accept two numbers as parameters,
-- and must return a number as an output. This number is then supplied as input to the next function call.
-- and must return a number as an output. This number is then supplied as input to the next function call.
local vals = makeArgArray(...)
local vals = makeArgArray(...)
local count = #vals -- The number of valid arguments
local count = #vals -- The number of valid arguments
if count == 0 then return
if count == 0 then return
-- Exit if we have no valid args, otherwise removing the first arg would cause an error.
-- Exit if we have no valid args, otherwise removing the first arg would cause an error.
nil, 0
nil, 0
end
end  
local ret = table.remove(vals, 1)
local ret = table.remove(vals, 1)
for _, val in ipairs(vals) do
for _, val in ipairs(vals) do
خط ۱۲۰: خط ۱۲۰:
else
else
return p._order(input_number)
return p._order(input_number)
end
end  
end
end


خط ۱۵۴: خط ۱۵۴:
return math.log10(denom_value);
return math.log10(denom_value);
end
end
end
end                      
end
end
end
end  


input_number, input_string = p._cleanNumber(input_string);
input_number, input_string = p._cleanNumber(input_string);
خط ۱۶۳: خط ۱۶۳:
else
else
return p._precision(input_string)
return p._precision(input_string)
end
end  
end
end


خط ۱۸۰: خط ۱۸۰:
x = string.sub(x, 1, exponent_pos - 1)
x = string.sub(x, 1, exponent_pos - 1)
result = result - tonumber(exponent)
result = result - tonumber(exponent)
end
end  


if decimal ~= nil then
if decimal ~= nil then
خط ۲۳۸: خط ۲۳۸:


function p._median(...)
function p._median(...)
local vals = makeArgArray(...)
local vals = makeArgArray(...)
local count = #vals
local count = #vals
table.sort(vals)
table.sort(vals)
 
if count == 0 then
if count == 0 then
return 0
return 0
end
end
 
if p._mod(count, 2) == 0 then
if p._mod(count, 2) == 0 then
return (vals[count/2] + vals[count/2+1])/2
return (vals[count/2] + vals[count/2+1])/2
خط ۲۵۴: خط ۲۵۴:


--[[
--[[
min
min  


Finds the minimum argument
Finds the minimum argument
خط ۲۷۹: خط ۲۷۹:


--[[
--[[
sum
sum  


Finds the sum
Finds the sum
خط ۳۰۵: خط ۳۰۵:


--[[
--[[
average
average  


Finds the average
Finds the average
خط ۳۴۷: خط ۳۴۷:
else
else
return p._round(value, precision)
return p._round(value, precision)
end
end  
end
end


خط ۳۸۷: خط ۳۸۷:
else
else
return p._mod(x, y)
return p._mod(x, y)
end
end  
end
end


خط ۴۳۱: خط ۴۳۱:
precision_format
precision_format


Rounds a number to the specified precision and formats according to rules
Rounds a number to the specified precision and formats according to rules  
originally used for {{template:Rnd}}.  Output is a string.
originally used for {{template:Rnd}}.  Output is a string.


خط ۴۶۳: خط ۴۶۳:
-- some circumstances because the terminal digits will be inaccurately reported.
-- some circumstances because the terminal digits will be inaccurately reported.
if order + precision >= 14 then
if order + precision >= 14 then
if order + p._precision(value_string) >= 14 then
orig_precision = p._precision(value_string)
precision = 13 - order;
if order + orig_precision >= 14 then
end
precision = 13 - order;      
end      
end
end


خط ۴۷۲: خط ۴۷۳:
value = p._round(value, precision)
value = p._round(value, precision)
current_precision = p._precision(value)
current_precision = p._precision(value)
end
end  


local formatted_num = lang:formatNum(math.abs(value))
local formatted_num = lang:formatNum(math.abs(value))
خط ۴۸۲: خط ۴۸۳:
else
else
sign = ''
sign = ''
end
end  


-- Handle cases requiring scientific notation
-- Handle cases requiring scientific notation
خط ۴۹۱: خط ۴۹۲:
formatted_num = lang:formatNum(math.abs(value))
formatted_num = lang:formatNum(math.abs(value))
else
else
order = 0;
order = 0;      
end
end
formatted_num = sign .. formatted_num
formatted_num = sign .. formatted_num


-- Pad with zeros, if needed
-- Pad with zeros, if needed  
if current_precision < precision then
if current_precision < precision then
local padding
local padding
خط ۵۰۹: خط ۵۱۰:


formatted_num = formatted_num .. string.rep('0', padding)
formatted_num = formatted_num .. string.rep('0', padding)
end
end          
else
else                  
padding = precision - current_precision
padding = precision - current_precision
if padding > 20 then
if padding > 20 then
خط ۵۲۶: خط ۵۲۷:
else
else
order = lang:formatNum(order)
order = lang:formatNum(order)
end
end  


formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
خط ۵۳۵: خط ۵۳۶:


--[[
--[[
Helper function that interprets the input numerically.  If the
Helper function that interprets the input numerically.  If the  
input does not appear to be a number, attempts evaluating it as
input does not appear to be a number, attempts evaluating it as
a parser functions expression.
a parser functions expression.
پیشرفتهنویسه‌های ویژهراهنما
عنوان
سطح ۲سطح ۳سطح ۴سطح ۵
قالب
افزودن
لاتین
لاتین گسترش‌یافته
آوانگاری بین‌المللی
نمادها
یونانی
یونانی قدیمی
سیریلیک
عربی
عربی گسترش‌یافته
عبری
بنگالی
تامیلی
تالوگو
سینهالی
دیواناگرى
گجراتی
تایلندی
لائو
خمر
بومی کانادا
رونی
ÁáÀàÂâÄäÃãǍǎĀāĂ㥹ÅåĆćĈĉÇçČčĊċĐđĎďÉéÈèÊêËëĚěĒēĔĕĖėĘęĜĝĢģĞğĠġĤĥĦħÍíÌìÎîÏïĨĩǏǐĪīĬĭİıĮįĴĵĶķĹĺĻļĽľŁłŃńÑñŅņŇňÓóÒòÔôÖöÕõǑǒŌōŎŏǪǫŐőŔŕŖŗŘřŚśŜŝŞşŠšȘșȚțŤťÚúÙùÛûÜüŨũŮůǓǔŪūǖǘǚǜŬŭŲųŰűŴŵÝýŶŷŸÿȲȳŹźŽžŻżÆæǢǣØøŒœßÐðÞþƏə
قالب‌بندی
پیوندها
عنوان‌ها
فهرست‌ها
پرونده‌ها
بحث
توضیحآن چه می‌نویسیدآن چه به دست می‌آورید
مورب''متن مورب''متن مورب
پررنگ'''متن پررنگ'''متن پررنگ
پررنگ و مورب'''''متن پررنگ و مورب'''''متن پررنگ و مورب
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--[[
This module provides a number of basic mathematical operations.
]]
local yesno, getArgs -- lazily initialized
local p = {} -- Holds functions to be returned from #invoke, and functions to make available to other Lua modules.
local wrap = {} -- Holds wrapper functions that process arguments from #invoke. These act as intemediary between functions meant for #invoke and functions meant for Lua.
--[[
Helper functions used to avoid redundant code.
]]
local function err(msg)
-- Generates wikitext error messages.
return mw.ustring.format('<strong class="error">Formatting error: %s</strong>', msg)
end
local function unpackNumberArgs(args)
-- Returns an unpacked list of arguments specified with numerical keys.
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
000
1:0
لطفاً توجه داشته باشید که همهٔ مشارکت‌ها در ویکی حج منتشرشده تحت Creative Commons Attribution-NonCommercial-ShareAlike در نظر گرفته‌می‌شوند (برای جزئیات بیش‌تر ویکی حج:حق تکثیر را ببینید). اگر نمی‌خواهید نوشته‌هایتان بی‌رحمانه ویرایش و توزیع شوند؛ بنابراین، آنها را اینجا ارائه نکنید.
شما همچنین به ما تعهد می‌کنید که خودتان این را نوشته‌اید یا آن را از یک منبع با مالکیت عمومی یا مشابه آزاد آن برداشته‌اید (برای جزئیات بیش‌تر ویکی حج:حق تکثیر را ببینید). کارهای دارای حق تکثیر را بدون اجازه ارائه نکنید!
لغو راهنمای ویرایش (در پنجرهٔ تازه باز می‌شود)
میزفرمان اشکال‌زدایی
* برون‌بری پودمان به عنوان متغیر "p"، شامل تغییرات ذخیره نشده در دسترس هستند. * یک خط را با "=" برای ارزیابی آن به عنوان یک عبارت، یا با استفاده از print()‎ مقدم کنید. از جداول mw.logObject() استفاده کنید * از mw.log()‎ و mw.logObject() در کد پودمان برای ارسال پیام‌ها به این کنسول استفاده کنید.

الگوی به‌کاررفته در این صفحه:

  • پودمان:Math/توضیحات (ویرایش)
برگرفته از «https://wikihaj.com/view/پودمان:Math»
  • دربارهٔ ویکی حج
  • نمای موبایل
  • ویرایش تنظیمات پیش‌نمایش
  • Creative Commons Attribution-NonCommercial-ShareAlike
  • Powered by MediaWiki
در حال ویرایش پودمان:Math
افزودن مبحث
    ویرایش را آغاز کنید