Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors parsing and evaluating complex-valued string #104

Open
King-Taz opened this issue Oct 19, 2023 · 0 comments
Open

Errors parsing and evaluating complex-valued string #104

King-Taz opened this issue Oct 19, 2023 · 0 comments

Comments

@King-Taz
Copy link

Greetings, beginner here, I need to learn how to parse and evaluate a complex-valued expression to its real and imaginary parts, but getting 2 errors, (Error CS1061 'SymbolicExpression' does not contain a definition for 'RealPart' and no accessible extension method 'RealPart' accepting a first argument of type 'SymbolicExpression' could be found (are you missing a using directive or an assembly reference?)). Couldn't find documentation for class references or unit tests to assist me. Can you point me to documentation with complex examples, or tell me how to fix these errors?

    using MathNet.Numerics;
    using MathNet.Numerics.LinearAlgebra;
    using MathNet.Symbolics;

    string complexString = "3 + 2i + 1/3i - 7";
    SymbolicExpression expression = SymbolicExpression.Parse(complexString);

    // Extract real and complex parts
    SymbolicExpression realPart = expression.RealPart();
    SymbolicExpression complexPart = expression.ComplexPart();

    Console.WriteLine("Real Part: " + realPart);
    Console.WriteLine("Complex Part: " + complexPart); 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant