Suppose I define a vector/list like this: v = {x + 3 y, z – x} It can be expressed as a matrix vector multiplication m.vars: vars = {x, y, z}; m = { {1, 3, 0}, {-1, 0, 1} }; v == m.vars (* True *) Is there a built-in function to get thisRead more
Suppose I define a vector/list like this: v = {x + 3 y, z – x} It can be expressed as a matrix vector multiplication m.vars: vars = {x, y, z}; m = { {1, 3, 0}, {-1, 0, 1} }; v == m.vars (* True *) Is there a built-in function to get thisRead more
In PHP, there are at least four ways of checking if a given variable is in the set {0, 1}, or not: ($ var > -1 && $ var < 2) ($ var >= 0 && $ var <= 1) ($ var == 0 || $ var == 1) !($ var < 0 || $Read more
For a while, I have been wondering: Does there exist a preferred file extension to use for simple expression export using the Put command? Example: Put[{1, {2.123, 0}, 3 + I}, “name.extension”] I am using this file format for the data exchange of unstructured lists with numeric scalars. So I am interested to use anRead more
I have the following equations – T = (2*cos[\[Alpha]]*sin[\[Beta]])/sin[\[Alpha] + \[Beta]]; sin[\[Alpha]]/sin[\[Beta]] = sqrt[1 – V/E]; And I want to eliminate \[Beta] from the two equations so as to obtain an expression for T. How should I proceed?Read more
I see several questions about converting Mathematica content to LaTeX. But I didn’t see any satisfying answers. I’m wondering if there is a utility that will convert Mathematica display formulae to LaTeX in a way that preserves the ordering and appearance of the original as displayed by the Mathematica Frontend. I understand that there isRead more
Consider the following setup: CREATE TABLE NAMES(Id integer PRIMARY KEY, Name text); INSERT INTO NAMES VALUES(1,’Tom’); INSERT INTO NAMES VALUES(2,’Lucy’); INSERT INTO NAMES VALUES(3,’Frank’); CREATE TABLE fields(fid integer, fname text); INSERT into fields values(1, “Id”); insert into fields values(2, “Name”); SELECT name, (SELECT “Name”) FROM NAMES; The last statement will output Tom|Tom Lucy|Lucy Frank|Frank However,Read more
I have expression f =11*x^2 – 4*x*y + 14*y^2 – 5 substituting this expression with x=(2x+y)/√5 and y=(x-2y)/√5 and subsequently simplifying the expression in sympy does not produce the correct result. correct result=2x^2+3y^2-1 >>> f =11*x**2 – 4*x*y + 14*y**2 – 5 >>> f.subs({x: (2*x+y)/(5**.5), y: (-2*y+x)/(5**.5)}) 14*(0.447213595499958*x – 0.894427190999916*y)**2 – 4*(0.447213595499958*x – 0.894427190999916*y)*(1.09442719099992*x –Read more
I think that I discovered another (c.f. Series expansion of expressions with Log and PolyLog functions) issue related to Series and PolyLog. Consider the following expression exp = (-16*Pi^2*Log[1 + Sqrt[x]])/3 + (16*Pi^2*Log[1 + Sqrt[x]])/ x^4 + (16*Pi^2*Log[1 + Sqrt[x]])/(3*x^2) + (32*Pi^2* Log[1 + Sqrt[x]])/(3*x) + (32*Pi^2*x*Log[1 + Sqrt[x]])/ 3 – (16*Log[1 + Sqrt[x]]^3)/3 +Read more
I have a huge expression (spanning 70 pages) involving polynomials and logarithms and polylogarithms. A sample of that looks as below: (x*(2 + x + 4*x^2 + x^3 + 2*x^4 + 4*z – x*z + 8*x^2*z – x^3*z + 4*x^4*z -10*x*z^2 – 2*x^2*z^2 – 10*x^3*z^2 + 6*x^2*z^3)) + 6*Log[z]*Log[-x + z] + (12*I)*Log[Z] + 6*Log[Z]^2Read more
Background I written a chemical equation balancing program. elem=Alternatives@@Reverse@SortBy[StringLength]@Array[ElementData[#,”Symbol”]&,112]; chem=StringCases[#,e:elem~~n:DigitCharacter…:>{e,n}]/.””->”1″&; group=List@@@Normal[GroupBy[#,First->Last,Total@ToExpression[#]&]]&; name2mat=group/@chem[ToString/@#]&; ChemicalSolver[input_List]:=Block[{all,elemts,null}, all=name2mat[input]; elemts=Union[First@Transpose[Flatten[all,1]]]; null=NullSpace@Transpose[(elemts/.Rule@@@#&/@all)/._String->0]; Thread[input->Transpose@null] ]; Give a chemical equation: $ $ C_2H_5OH+O_2==H_2O+CO_2$ $ The first part name2mat change the chemicals to lists, then ChemicalSolver calculate the nullspace and find the solution. So one of the solutions is : $ $ C_2H_5OH+3O_2==3H_2O+2CO_2$ $Read more