Community RSS Feed
https://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Algebra sorted by activeIterating tiltedsinewave discretizes vehemently
https://community.wolfram.com/groups/-/m/t/2599607
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/d996284d-fa0e-471c-9229-2ffdce12a6caBill Gosper2022-08-16T15:26:15ZOptimize the efficiency of outer product when generating group elements
https://community.wolfram.com/groups/-/m/t/2598124
Based on the idea [here](https://mathematica.stackexchange.com/questions/21850/how-to-generate-a-matrix-group), I wrote the following code snippet to generate all non-equivalent elements of an affine crystallographic group:
AffOnLeftModOne[x_,y_]:=Module[{dim},
dim=Dimensions[x,1][[1]]-1;
(*TransformationMatrix[AffineTransform[{#[[1;;dim,1;;dim]],Mod[#[[1;;dim,dim+1]],1]}]&@Dot[x,y]]*)
TransformationMatrix[
AffineTransform[{#[[1 ;; dim, 1 ;; dim]],
Mod[#[[1 ;; dim, dim + 1]], 1]}] &@Dot[x, y]] // Expand //
Together // FullSimplify
]
AffCrystGroupOnLeft[gens_]:=Module[{dim,count,ge},
If[Length[Dimensions[gens]]==3 && Dimensions[gens][[2]]==Dimensions[gens][[3]],
dim=Dimensions[gens][[2]]-1;,Abort[]];
count=0;
ge = NestWhile[ (count++;
Union[Join[#1,
(*TransformationMatrix/@(AffineTransform[{#[[1;;dim,1;;dim]],Mod[#[[1;;dim,dim+1]],1]}]&/@Flatten[Outer[Dot, gens, #1, 1], 1])*)
Flatten[Outer[AffOnLeftModOne, gens, #1, 1], 1]
]]) &
,
{AffineTransform[{IdentityMatrix[dim],ConstantArray[0, dim]}]//TransformationMatrix}
,
Length[#2] != Length[#1]&
,
2
,
99
];
(*Return[{ge,count}]*)
Return[ge]
]
M1={{0,0,1,1/4},{1,0,0,1/4},{0,-1,0,1/4},{0,0,0,1}};
M2={{0,0,-1,0},{0,-1,0,0},{1,0,0,0},{0,0,0,1}};
SGGenElemAK227LeftS1={M1,M2};
In[172]:= AffCrystGroupOnLeft[SGGenElemAK227LeftS1]//Length//Timing
Out[172]= {1.3305, 192}
However, for the above method, I have the following problems need to be solved or further improvements:
1. Here I use **99** as the most times to apply the function and a variable **count** to stores the number of function executions. I want to know how to automatically throw an error or prompt message when this condition is violated, so that I know that the task has not been completed normally.
2. **Outer** is the core command of this method. I want to know if there are any other methods to further improve efficiency.
Regards,
ZhaoHongyi Zhao2022-08-14T14:19:53ZRow vs column vectors?
https://community.wolfram.com/groups/-/m/t/2598337
I am 73 years old and retired. I failed Calculus in college. I am working my way through Linear Algebra (with Mathematica in the Cloud) and am perplexed by how Mathematica represents column vectors.
Wolfram U’s “Introduction to Linear Algebra” has a section in chapter 4 on Vector Equations in which the numbers in column vectors are moved into an augmented matrix. The example is simple and so the conversion to a matrix is done manually. I succeeded in doing the conversion in Mathematica:
v1= {1,2,3} // MatrixForm
v2 = {5,-13,3} // MatrixForm
b= {-3, 8, 2} // MatrixForm
MatrixForm[Table[{v1[[1,i]],v2[[1,i]],b[[1,i]]},{i,1,3}]]
The column vectors look like row vectors until you display them with "// MatrixForm." They are displayed quite differently using MatrixForm[ ]. Such differences lead me to the attached PDF and to the question why Mathematica doesn't CLEARLY distinguish between row and column vector. Any comments (however critical) would be appreciated.Frederick H Lott Jr2022-08-14T23:24:52ZUnderstanding the computations applied to a square matrix
https://community.wolfram.com/groups/-/m/t/2597662
We have a square matrix A. I am not able to understand how matrix A is used to create matrix SC by looking at the code.
Can you please advise?
not[idx_] := Complement[Range[NN], idx]
SC[A_, idx_] := A[[idx, idx]] - A[[idx, not@idx]] . Inverse[A[[not@idx, not@idx]]] . A[[not@idx, idx]]
I am a beginner in Mathematica and trying to understand..Baymax Hamada2022-08-14T05:25:42ZThe solution of cubic equation x^3+cx=d
https://community.wolfram.com/groups/-/m/t/2597093
The solution is complicated and even cannot understand.
Why can't Mathematica give a simple expression like this?
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/80217dce-9525-4b47-805e-02a99028887cDaniel Niu2022-08-13T14:08:32ZUsing Simplify for FractionalPart[x] and Mod[x,1] gives different results
https://community.wolfram.com/groups/-/m/t/2597574
See my following code snippet:
In[544]:= gensSG141ITA1={
{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0,0,0,1}},
{{-1, 0, 0, 1/2}, {0, -1, 0, 1/2}, {0, 0, 1, 1/2}, {0,0,0, 1}},
{{0, -1, 0, 0}, {1, 0, 0, 1/2}, {0, 0, 1, 1/4}, {0,0,0, 1}},
{{-1, 0, 0, 1/2}, {0, 1, 0, 0}, {0, 0, -1, 3/4}, {0,0,0, 1}},
{{-1, 0, 0, 0}, {0, -1, 0, 1/2}, {0, 0, -1, 1/4}, {0,0,0, 1}},
{{1, 0, 0, n1+1/2}, {0, 1, 0, n2+1/2}, {0, 0, 1, n3+1/2}, {0,0,0, 1}}
};
TransformationMatrix/@(AffineTransform[{#[[1;;3,1;;3]],#[[1;;3,4]]//FractionalPart//Simplify[#,Element[n1 | n2 | n3, Integers]]&}]&/@gensSG141ITA1)
TransformationMatrix/@(AffineTransform[{#[[1;;3,1;;3]],Mod[#[[1;;3,4]],1]//Simplify[#,Element[n1 | n2 | n3, Integers]]&}]&/@gensSG141ITA1)
Out[545]= {{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0,
1}}, {{-1, 0, 0, 1/2}, {0, -1, 0, 1/2}, {0, 0, 1, 1/2}, {0, 0, 0,
1}}, {{0, -1, 0, 0}, {1, 0, 0, 1/2}, {0, 0, 1, 1/4}, {0, 0, 0,
1}}, {{-1, 0, 0, 1/2}, {0, 1, 0, 0}, {0, 0, -1, 3/4}, {0, 0, 0,
1}}, {{-1, 0, 0, 0}, {0, -1, 0, 1/2}, {0, 0, -1, 1/4}, {0, 0, 0,
1}}, {{1, 0, 0, FractionalPart[1/2 + n1]}, {0, 1, 0,
FractionalPart[1/2 + n2]}, {0, 0, 1, FractionalPart[1/2 + n3]}, {0,
0, 0, 1}}}
Out[546]= {{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0,
1}}, {{-1, 0, 0, 1/2}, {0, -1, 0, 1/2}, {0, 0, 1, 1/2}, {0, 0, 0,
1}}, {{0, -1, 0, 0}, {1, 0, 0, 1/2}, {0, 0, 1, 1/4}, {0, 0, 0,
1}}, {{-1, 0, 0, 1/2}, {0, 1, 0, 0}, {0, 0, -1, 3/4}, {0, 0, 0,
1}}, {{-1, 0, 0, 0}, {0, -1, 0, 1/2}, {0, 0, -1, 1/4}, {0, 0, 0,
1}}, {{1, 0, 0, 1/2}, {0, 1, 0, 1/2}, {0, 0, 1, 1/2}, {0, 0, 0,
1}}}
As you can see, using Simplify for FractionalPart[x] and Mod[x,1] gives different results. In this example, Simplify doesn't work in the former case.
Any hints for this subtle behavior?
Regards,
ZhaoHongyi Zhao2022-08-13T10:19:06ZFind transformations for two non-square matrices $A$ and $B$
https://community.wolfram.com/groups/-/m/t/2597351
I noticed the following question [here](https://www.exceptionlife.com/mathematica/question/5314/find-transformations-for-two-non-square-matrices-a-and-b):
![enter image description here][1]
In[1]:= A = {{0, c, b, -c + b c, a c, -a + a b, c + b c, a c,
a + a b}, {0, c, b, c + b c, a c, a + a b, -c + b c,
a c, -a + a b}, {0, -1, 0, b, a, 0, b, a, 0}}
B = {{0, c, b, 0, c, b, 0, -1, 0}, {-c + b c, a c, -a + a b, c + b c,
a c, a + a b, b, a, 0}, {c + b c, a c, a + a b, -c + b c,
a c, -a + a b, b, a, 0}};
Out[1]= {{0, c, b, -c + b c, a c, -a + a b, c + b c, a c,
a + a b}, {0, c, b, c + b c, a c, a + a b, -c + b c,
a c, -a + a b}, {0, -1, 0, b, a, 0, b, a, 0}}
I also noticed the example code given on the same website as follows, which does not seem to be the solution to this problem and is very lengthy:
In[15]:= Rx = RotationMatrix[\[Phi][t], {1, 0, 0}];
Ry = RotationMatrix[\[Xi][t], {0, 1, 0}];
Rz = RotationMatrix[\[Psi][t], {0, 0, 1}];
Q = Rz . Ry . Rx;
v = {\[Phi][t], \[Xi][t], \[Psi][t]};
T1 = Flatten /@ D[Q, {v}];
T2 = Flatten /@ D[Transpose[Q], {v}];
P1 = {{1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0,
0, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0,
1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 0, 0,
0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1}};
A1 = T1 . {{1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 1, 0}, {0, 0, 0}, {0,
0, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}};
A2 = T1 . {{0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 1, 0}, {0,
0, 0}, {0, 0, 0}, {0, 0, 1}, {0, 0, 0}};
A3 = T1 . {{0, 0, 0}, {0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0,
1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 1}};
Transpose[P1 . ArrayFlatten[{{A1}, {A2}, {A3}}]] ==
Flatten /@ D[Transpose[Q], {v}] // MatrixForm
Out[26]//MatrixForm= \!\(
TagBox["True",
Function[BoxForm`e$,
MatrixForm[BoxForm`e$]]]\)
Is there a neat solution to this problem?
Regards,
Zhao
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=Selection_112.png&userId=2470387Hongyi Zhao2022-08-13T02:34:36ZSolve error: not a valid variable
https://community.wolfram.com/groups/-/m/t/2589708
I have not used Mathematica in probably 10 years, so need some guidance. Specifically solving combinations of linear equations and circles. (Mohr circle analysis for engineers).
Anyway, hitting lots of roadblocks in syntax.
Here is an example:
Solved for intercept of line y=mw+b with circle centered at xo and radius R. Coordinates are (x,w). You get two solutions:
x = -((b - (b + m xo)/(1 + m^2) +/-
Sqrt[(-b^2 m^2 + m^2 R^2 + m^4 R^2 - 2 b m^3 xo - m^4 xo^2)/(1 + m^2)^2])/m)
for
w = (b + m xo)/(1 + m^2) +/-
Sqrt[(-b^2 m^2 + m^2 R^2 + m^4 R^2 - 2 b m^3 xo - m^4 xo^2)/(1 + m^2)^2]
I am not trying to solve for a special case of when I have a tangent. and the solution for this case as Sin[w], related to Mohr circles.
So for determinant:
(-b^2 m^2 + m^2 R^2 + m^4 R^2 - 2 b m^3 xo - m^4 xo^2) = 0
There one two many variables here, should be three: but I have b, m, R and xo
R and xo should set the circle, and m the line slope which is tangent. So I am trying to solve for one of these, so I can plug back into eqs for (x,w). In particular, I need to get Sin[phi], where Tan[phi=m.
When I enter:
ClearAll
y = Sin[phiw]
xo = (sig1 + J)/(1 + y)
R = y*xo
m = Sqrt[y/(1 - y^2)]
b = J*m
Solve[-b^2 m^2 + m^2 R^2 + m^4 R^2 - 2 b m^3 xo - m^4 xo^2 ==
0, b, Reals,
Assumptions -> R > 0 && b > 0 && J > 0 && m > 0 && y > 0 && sig1 > 0]
I am getting an error for b=J*m as
Solve::ivar: J Sqrt[Sin[phiw]/(1-Sin[<<1>>]^2)] is not a valid variable.
in which case Solve just spits the entry back out at me.
I am sure this is some sort of beginner syntax issue.
Also, what is the command to clear everything. Clear All leaves variable definitions of something like that. I should have some beginning commands to always reset everything. Now I close and reopen Mathematica to ensure this.J E2022-07-30T21:41:10ZHow to solve system of 3 non-linear equations analytically and numerically?
https://community.wolfram.com/groups/-/m/t/2595688
![enter image description here][1]I want to solve the system of 3 non-linear equations using this command in Mathematica 9.0
&[Wolfram Notebook][2]
where u_1,u_2,u_3 are the variables and the coefficients can be real or complex. Is it a right command for this type of complicated equations? Can it be solved analytically?
Please can you suggest me how to solve these type of equations either numerically or analytically.
[1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=wr1.png&userId=2595633
[2]: https://www.wolframcloud.com/obj/2cb3f57e-7443-48a5-8b72-c1a668f98a91TAPENDER Thakur2022-08-11T04:35:01Z[R&DL] Wolfram R&D LIVE: What's New in Calculus and Algebra
https://community.wolfram.com/groups/-/m/t/2596451
We introduce here the material used in our livestream **"What's New in Calculus and Algebra"** on Wednesday, August 10. This is part of **Wolfram R&D** livestream series announced here:
https://community.wolfram.com/groups/-/m/t/2593151
For questions about this livestream, please leave a comment below.
&[Wolfram Notebook][1]
[1]: https://www.wolframcloud.com/obj/e4882395-59b6-43e3-a242-0927393d372eDevendra Kapadia2022-08-11T18:25:15Z