-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f226928
commit fc4ac8d
Showing
6 changed files
with
300 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { FC, ButtonHTMLAttributes, DetailedHTMLProps } from "react"; | ||
|
||
type buttonProps = DetailedHTMLProps< | ||
ButtonHTMLAttributes<HTMLButtonElement>, | ||
HTMLButtonElement | ||
>; | ||
|
||
const Button: FC<buttonProps> = (buttonProps) => { | ||
return ( | ||
<button | ||
className={ | ||
"rounded-lg border bg-purple-500 px-4 py-[0.33rem] text-white " + | ||
"font-semibold transition-all hover:scale-105 hover:bg-purple-600 active:scale-90" | ||
} | ||
{...buttonProps} | ||
> | ||
{buttonProps.value} | ||
</button> | ||
); | ||
}; | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { FC, ReactNode } from "react"; | ||
|
||
interface IPanel { | ||
children?: ReactNode; | ||
className?: string; | ||
} | ||
|
||
const Panel: FC<IPanel> = ({ children, className }) => { | ||
return ( | ||
<div | ||
className={ | ||
"z-10 m-auto min-h-48 min-w-96 max-w-screen-xl p-4 " + | ||
"rounded-2xl bg-slate-50 shadow-lg " + | ||
"flex flex-col gap-4 " + | ||
className | ||
} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Panel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { FC } from "react"; | ||
import Matrix from "../Matrix/Matrix"; | ||
import inverseMatrix from "../../functions/inverseMatrix"; | ||
import { roundedMatrix, roundedRow } from "../../functions/utils"; | ||
import matrixRank from "../../functions/matrixRank"; | ||
import solveLinearSystem from "../../functions/solveLinearSystem"; | ||
|
||
interface IResult { | ||
matrixA: number[][]; | ||
matrixB: number[]; | ||
} | ||
|
||
const Result: FC<IResult> = ({ matrixA, matrixB }) => { | ||
const invertedMatrix = inverseMatrix(matrixA); | ||
const rank = matrixRank(matrixA); | ||
const solution = solveLinearSystem(matrixA, matrixB); | ||
|
||
return ( | ||
<div className="inline-flex flex-col"> | ||
<p className="mt-4 font-bold">Finding the inverse matrix.</p> | ||
<span>--------------------------------------------------</span> | ||
{invertedMatrix ? ( | ||
<> | ||
<span>Inverse matrix:</span> | ||
<Matrix value={roundedMatrix(invertedMatrix)} /> | ||
</> | ||
) : ( | ||
<> | ||
<span>The inverse matrix was not found.</span> | ||
</> | ||
)} | ||
|
||
<p className="mt-4 font-bold">Finding the rank of a matrix.</p> | ||
<span>--------------------------------------------------</span> | ||
<span>Matrix rank: {rank}</span> | ||
|
||
<p className="mt-4 font-bold"> | ||
Solution of the system of linear equations. | ||
</p> | ||
<span>--------------------------------------------------</span> | ||
{solution ? ( | ||
<> | ||
<span>Solving the system of linear equations:</span> | ||
<Matrix value={roundedRow(solution)} /> | ||
</> | ||
) : ( | ||
<> | ||
<span>A matrix does not have an inverse matrix.</span> | ||
</> | ||
)} | ||
</div> | ||
// <> | ||
// {invertedMatrix ? ( | ||
// <> | ||
// <p>Inverse matrix:</p> | ||
// <Matrix value={roundedMatrix(invertedMatrix)} /> | ||
// </> | ||
// ) : ( | ||
// <> | ||
// <p> | ||
// The matrix is not square, the inverse matrix does not exist. | ||
// </p> | ||
// </> | ||
// )} | ||
|
||
// <p>Matrix rank: {rank}</p> | ||
|
||
// {solution ? ( | ||
// <> | ||
// <p>Solving the system of linear equations:</p> | ||
// <Matrix value={roundedRow(solution)} /> | ||
// </> | ||
// ) : ( | ||
// <> | ||
// <p> | ||
// A matrix does not have an inverse matrix. | ||
// </p> | ||
// </> | ||
// )} | ||
// </> | ||
); | ||
}; | ||
|
||
export default Result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters