Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,36 +0,0 @@
|
|||
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;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
scope # TPK algorithm in Agena
|
||||
local y;
|
||||
local a := [];
|
||||
local f := proc( t :: number ) is return sqrt(abs(t))+5*t*t*t end;
|
||||
local proc f( t :: number ) :: number return sqrt(abs(t))+5*t*t*t end;
|
||||
for i from 0 to 10 do a[i] := tonumber( io.read() ) od;
|
||||
for i from 10 to 0 by - 1 do
|
||||
y:=f(a[i]);
|
||||
|
|
@ -10,4 +10,4 @@ scope # TPK algorithm in Agena
|
|||
else printf( "%10.4f\n", y )
|
||||
fi
|
||||
od
|
||||
epocs
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
; 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
|
||||
|
|
@ -1,29 +1,29 @@
|
|||
import extensions;
|
||||
import extensions'math;
|
||||
|
||||
public program()
|
||||
public Program()
|
||||
{
|
||||
real[] inputs := new real[](11);
|
||||
console.printLine("Please enter 11 numbers :");
|
||||
Console.printLine("Please enter 11 numbers :");
|
||||
for(int i := 0; i < 11; i += 1)
|
||||
{
|
||||
inputs[i] := console.readLine().toReal()
|
||||
inputs[i] := Console.readLine().toReal()
|
||||
};
|
||||
|
||||
console.printLine("Evaluating f(x) = |x|^0.5 + 5x^3 for the given inputs :");
|
||||
Console.printLine("Evaluating f(x) = |x|^0.5 + 5x^3 for the given inputs :");
|
||||
for(int i := 10; i >= 0; i -= 1)
|
||||
{
|
||||
real result := sqrt(abs(inputs[i])) + 5 * power(inputs[i], 3);
|
||||
|
||||
console.print("f(", inputs[i], ")=");
|
||||
Console.print("f(", inputs[i], ")=");
|
||||
|
||||
if (result > 400)
|
||||
{
|
||||
console.printLine("Overflow!")
|
||||
Console.printLine("Overflow!")
|
||||
}
|
||||
else
|
||||
{
|
||||
console.printLine(result)
|
||||
Console.printLine(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
$tpk = 1..11 | Get-Tpk
|
||||
$tpk
|
||||
|
|
@ -1 +0,0 @@
|
|||
$tpk | where result -ne overflow | sort number
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
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