[Solved] How to convert a math expression into sums of factors programmatically? [closed]

I found the shortest way to do this using Math.NET Symbolics from Math.NET The key syntax to do so is like this: SymbolicExpression.Parse(“a*(b+c)”).Expand().Summands().Select(x => x.Factors()); In it, I expand the expression and then I get the summands. For each of the summands, I get the factors. To illustrate it better, consider the following expression: a … Read more

[Solved] C# basic Math, want to use decimals sometimes

Integers don’t have fractions. Use decimal if you want reliable numeric values with decimals. decimal box1 = decimal.Parse(Number1TextBox.Text); decimal box2 = decimal.Parse(Number2TextBox.Text); decimal box3 = decimal.Parse(Number3TextBox.Text); decimal answer = box1 * box2 * box3; You can round back the result like this: decimal rounded = Math.Round(answer); 5 solved C# basic Math, want to use decimals … Read more

[Solved] Adding reversed numbers then reversing the sum

First, you need to rethink how to reverse a number. Basically, what you want to do is to have a running total starting from 0. Then starting from the rightmost digit in the number to reverse, you 1) Take the total and multiply it by 10. This “moves” the digits of the running total to … Read more

[Solved] Python math issue [closed]

First of all, you always must include the description of what you have tried so far and what error you encountered while doing so. It is not nice to ask a question directly without showing your efforts in it. Now coming back to your question, it is actually quite very easy, what you can do … Read more

[Solved] C++ quadratic equation using factorization

Building on what @Aditi Rawat said, I’ve wrote a little program that does what you need using the quadratic roots formula. Not sure if you need to do it that way or not but this solves the problem: #include <iostream> #include <cmath> using namespace std; int main() { double a, b, c; cout<<“Enter a: “; … Read more

[Solved] Since when does 3 / 5 = 0?

The / operator looks at its operands and when it discovers that they are two integers it returns an integer. If you want to get back a double value then you need to cast one of the two integers to a double double difference = (endX – startX + 1) / (double)ordinates; You can find … Read more