Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,36 @@
|
|||
with Ada.Text_IO, Ada.Numerics.Generic_Elementary_Functions;
|
||||
|
||||
procedure Trabb_Pardo_Knuth is
|
||||
|
||||
type Real is digits 6 range -400.0 .. 400.0;
|
||||
|
||||
package TIO renames Ada.Text_IO;
|
||||
package FIO is new TIO.Float_IO(Real);
|
||||
package Math is new Ada.Numerics.Generic_Elementary_Functions(Real);
|
||||
|
||||
function F(X: Real) return Real is
|
||||
begin
|
||||
return (Math.Sqrt(abs(X)) + 5.0 * X**3);
|
||||
end F;
|
||||
|
||||
Values: array(1 .. 11) of Real;
|
||||
|
||||
begin
|
||||
TIO.Put("Please enter 11 Numbers:");
|
||||
for I in Values'Range loop
|
||||
FIO.Get(Values(I));
|
||||
end loop;
|
||||
|
||||
for I in reverse Values'Range loop
|
||||
TIO.Put("f(");
|
||||
FIO.Put(Values(I), Fore => 2, Aft => 3, Exp => 0);
|
||||
TIO.Put(")=");
|
||||
begin
|
||||
FIO.Put(F(Values(I)), Fore=> 4, Aft => 3, Exp => 0);
|
||||
exception
|
||||
when Constraint_Error => TIO.Put("-->too large<--");
|
||||
end;
|
||||
TIO.New_Line;
|
||||
end loop;
|
||||
|
||||
end Trabb_Pardo_Knuth;
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
; Trabb Pardo–Knuth algorithm
|
||||
; by James1337 (autoit.de)
|
||||
; AutoIt Version: 3.3.8.1
|
||||
|
||||
Local $S, $i, $y
|
||||
|
||||
Do
|
||||
$S = InputBox("Trabb Pardo–Knuth algorithm", "Please enter 11 numbers:", "1 2 3 4 5 6 7 8 9 10 11")
|
||||
If @error Then Exit
|
||||
$S = StringSplit($S, " ")
|
||||
Until ($S[0] = 11)
|
||||
|
||||
For $i = 11 To 1 Step -1
|
||||
$y = f($S[$i])
|
||||
If ($y > 400) Then
|
||||
ConsoleWrite("f(" & $S[$i] & ") = Overflow!" & @CRLF)
|
||||
Else
|
||||
ConsoleWrite("f(" & $S[$i] & ") = " & $y & @CRLF)
|
||||
EndIf
|
||||
Next
|
||||
|
||||
Func f($x)
|
||||
Return Sqrt(Abs($x)) + 5*$x^3
|
||||
EndFunc
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
function Get-Tpk
|
||||
{
|
||||
[CmdletBinding()]
|
||||
[OutputType([PSCustomObject])]
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0)]
|
||||
[double]
|
||||
$Number
|
||||
)
|
||||
|
||||
Begin
|
||||
{
|
||||
function Get-TpkFunction ([double]$Number)
|
||||
{
|
||||
[Math]::Pow([Math]::Abs($Number),(0.5)) + 5 * [Math]::Pow($Number,3)
|
||||
}
|
||||
|
||||
[object[]]$output = @()
|
||||
}
|
||||
Process
|
||||
{
|
||||
$Number | ForEach-Object {
|
||||
$n = Get-TpkFunction $_
|
||||
|
||||
if ($n -le 400)
|
||||
{
|
||||
$result = $n
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = "Overflow"
|
||||
}
|
||||
}
|
||||
|
||||
$output += [PSCustomObject]@{
|
||||
Number = $Number
|
||||
Result = $result
|
||||
}
|
||||
}
|
||||
End
|
||||
{
|
||||
[Array]::Reverse($output)
|
||||
$output
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$tpk = 1..11 | Get-Tpk
|
||||
$tpk
|
||||
|
|
@ -0,0 +1 @@
|
|||
$tpk | where result -ne overflow | sort number
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
Function tpk(s)
|
||||
arr = Split(s," ")
|
||||
For i = UBound(arr) To 0 Step -1
|
||||
n = fx(CDbl(arr(i)))
|
||||
If n > 400 Then
|
||||
WScript.StdOut.WriteLine arr(i) & " = OVERFLOW"
|
||||
Else
|
||||
WScript.StdOut.WriteLine arr(i) & " = " & n
|
||||
End If
|
||||
Next
|
||||
End Function
|
||||
|
||||
Function fx(x)
|
||||
fx = Sqr(Abs(x))+5*x^3
|
||||
End Function
|
||||
|
||||
'testing the function
|
||||
WScript.StdOut.Write "Please enter a series of numbers:"
|
||||
list = WScript.StdIn.ReadLine
|
||||
tpk(list)
|
||||
Loading…
Add table
Add a link
Reference in a new issue