Click here to Skip to main content
15,885,435 members
Articles / Programming Languages / Visual C++ 10.0

Polynomial Equation Solver

Rate me:
Please Sign up or sign in to vote.
4.96/5 (46 votes)
29 Mar 2013CPOL17 min read 169.6K   12.9K   103  
Solves 1st, 2nd, 3rd and 4th degree polynominal by explicid fomulas for real coefficients and any degree by the numerical Jenkins-Traub algorithm with real and complex coefficients.
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Polynomial Equation Solver" Height="436" Width="559" Background="WhiteSmoke"  >
    <StackPanel>
        <TextBlock Margin="10" TextAlignment="Center" >The coefficients below are on the form Ax^4 + Bx^3 + Cx^2 + Dx + E = 0</TextBlock>
        <WrapPanel>
            <TextBlock  Width="100" TextAlignment="Right" >a=</TextBlock>
        <TextBox Name="txtA" Width="100"></TextBox>
        </WrapPanel>
        <WrapPanel>
            <TextBlock  Width="100" TextAlignment="Right" >b=</TextBlock>
            <TextBox  Width="100" Name="txtB"></TextBox>
        </WrapPanel>
        <WrapPanel>
            <TextBlock  Width="100" TextAlignment="Right" >c=</TextBlock>
            <TextBox  Width="100" Name="txtC"></TextBox>
        </WrapPanel>
        <WrapPanel>
            <TextBlock  Width="100" TextAlignment="Right" >d=</TextBlock>
            <TextBox  Width="100" Name="txtD"></TextBox>
        </WrapPanel>
        <WrapPanel>
            <TextBlock  Width="100" TextAlignment="Right" >e=</TextBlock>
            <TextBox Width="100" Name="txtE"></TextBox>
        </WrapPanel>
        <Button Name="btnClear" Margin="5">Clear</Button>
        <WrapPanel Margin="10">
            <TextBlock>Description of the polynomial:</TextBlock>
            <TextBox Name="txtDescription" TextWrapping="Wrap" Width="357" Height="60"></TextBox>
        </WrapPanel>
        <Button Margin="5,10,5,5" Name="Button1">Calculate</Button>
        <TextBox Name="txtResult" Margin="5" Height="148"></TextBox>
    </StackPanel>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
Norway Norway
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions