algebra

Is it possible to convert A string that is an equation with a variable into a equation?

萝らか妹 提交于 2020-01-25 12:16:34
问题 I need to convert a string returned from prompt into an equation, however the parseFloat returns as only the first number, and symbols in an equation, and stops at the variable. The variable will always = x . The program is designed to convert an algebraic expression say 15*x(5^4-56)*17/x=15 into an expression, and calculate the value of x. If someone could show me how to do this, it would help dramatically. I am currently using multiple prompts, having the user put in the equation before x ,

Is it possible to convert A string that is an equation with a variable into a equation?

大憨熊 提交于 2020-01-25 12:15:08
问题 I need to convert a string returned from prompt into an equation, however the parseFloat returns as only the first number, and symbols in an equation, and stops at the variable. The variable will always = x . The program is designed to convert an algebraic expression say 15*x(5^4-56)*17/x=15 into an expression, and calculate the value of x. If someone could show me how to do this, it would help dramatically. I am currently using multiple prompts, having the user put in the equation before x ,

Element by element tensor multiplication in python

泪湿孤枕 提交于 2020-01-24 13:17:27
问题 I am trying to solve a problem in computational algebra using python. Basically given two sets, say A={a,b} and B={e} , I need to compute the element by element tensor products and get a final set say C={a\tensor{e},b\tensor{e}} containing these products of elements. I can do an element by element multiplication using arrays with numbers but I can't do an element by element tensor multiplication of letters instead of numbers. 回答1: Not sure if I understood correctly, this below code multiplies

How to add two rational in agda?

 ̄綄美尐妖づ 提交于 2020-01-15 16:46:30
问题 How to add two rational.. I was trying this but this is not correct. As I am unable to prove that coprime part. open import Data.Rational open import Data.Integer open import Data.Nat _add_ : ℚ -> ℚ -> ℚ x add y = (nx Data.Integer.* dy Data.Integer.+ dx Data.Integer.* ny) ÷ (dx′ Data.Nat.* dy′) where nx = ℚ.numerator x dx = ℚ.denominator x dx′ = ℕ.suc (ℚ.denominator-1 x) ny = ℚ.numerator y dy = ℚ.denominator y dy′ = ℕ.suc (ℚ.denominator-1 y) 回答1: You need to simplify (nx * dy + dx * ny) / (dx

Generated methods for polynomial evaluation

有些话、适合烂在心里 提交于 2020-01-13 02:57:29
问题 I'm trying to come up with an elegant way to handle some generated polynomials. Here's the situation we'll focus on (exclusively) for this question: order is a parameter in generating an n th order polynomial, where n:=order + 1. i is an integer parameter in the range 0..n The polynomial has zeros at x_j, where j = 1..n and j ≠ i (it should be clear at this point that StackOverflow needs a new feature or it's present and I don't know it) The polynomial evaluates to 1 at x_i. Since this

Generated methods for polynomial evaluation

↘锁芯ラ 提交于 2020-01-13 02:57:24
问题 I'm trying to come up with an elegant way to handle some generated polynomials. Here's the situation we'll focus on (exclusively) for this question: order is a parameter in generating an n th order polynomial, where n:=order + 1. i is an integer parameter in the range 0..n The polynomial has zeros at x_j, where j = 1..n and j ≠ i (it should be clear at this point that StackOverflow needs a new feature or it's present and I don't know it) The polynomial evaluates to 1 at x_i. Since this

Finite Field Linear Algebra Library for Haskell

旧城冷巷雨未停 提交于 2020-01-11 04:55:11
问题 I'm searching for a finite field linear algebra library for Haskell. Something like FFLAS-FFPACK for Haskell would be great :-). Of course, I checked hmatrix, there seems to be some support for arbitrary matrix element types but I couldn't find any finite field library which works with hmatrix. And surely I'd appreciate a performant solution :-) In particular I want to be able to multiply 𝔽 p n×1 and 𝔽 p 1×m matrices (vectors) to 𝔽 p n×m matrices. 回答1: Your best bet would be a binding to

Creating a java program that given 3 terms as input(a,b,c) in that order prints their roots

女生的网名这么多〃 提交于 2020-01-07 23:59:12
问题 Wrie a method printRoots that given 3 terms as input(a,b,c) in that order prints their roots We have the following given information If b²-4ac is a positive number , your program should print “The two roots are X and Y” where X is the larger root and Y is the smaller root If b²-4ac * equals 0 * , the program should print. “The equation has one X” where X is the only root If b²-4ac is a negative number , the program should print.” The equation has two roots(-X1 + Y1i) and (-X2 and Y2i) The

Prime factors in C

走远了吗. 提交于 2020-01-05 07:11:20
问题 I came across this effective program for printing all the prime factors of a given number: # include <stdio.h> # include <math.h> // A function to print all prime factors of a given number n void primeFactors(int n) { // Print the number of 2s that divide n while (n%2 == 0) { printf("%d ", 2); n = n/2; } // n must be odd at this point. So we can skip // one element (Note i = i +2) for (int i = 3; i <= sqrt(n); i = i+2) { // While i divides n, print i and divide n while (n%i == 0) { printf("%d

sparse matrix overdetermined linear equation system c/c++ library

房东的猫 提交于 2020-01-03 20:44:08
问题 I need a library to solve Ax=b systems, where A is a non-symmetric sparse matrix, with 8 entry per row (and it might be quite big). I think a library that implements biconjugate gradient should be fine, but i can't find one that works (i've tried iml++, but there are some headers missing in the iml++/sparselib++ packages). Any tips? 回答1: There are standard ways of treating overdetermined systems. For example Wikipedia says this: A set of linear simultaneous equations can be written in matrix