Questions tagged [wolfram-mathematica]

Wolfram Mathematica is a computer algebra system and programming language from Wolfram Research. Mathematica has its own Stack Exchange site at https://mathematica.stackexchange.com/ and that site is the preferred place to ask questions about it.

Wolfram Mathematica is a computer algebra system and programming language from Wolfram Research. The programming language is a term-rewriting functional programming language strongly influenced by . Not to be confused with mathematics ().

Mathematica has its own Stack Exchange site. That is the preferred site for asking questions on this topic.

Tips for asking Mathematica questions

  • Include self-contained source code or a link to a notebook that illustrates the issue
  • Include relevant image, for a graphics related question

A chat room for the tag is available here. It is intended for discussion of some meta-related problems and perhaps some social activity.

Free Mathematica Programming Book


Don't forget to check out our little Tool Bag and add your favorite tricks there.

4457 questions
3
votes
1 answer

misleading plot issue in mathematica

I want to study some "strange" functions by plotting them out in mathematica. One example is the following: mod2[x_] := Which[Mod[x, 2] >= 1, -2 + Mod[x, 2], True, Mod[x, 2]]; f[x_] := Which[-1 <= x <= 1, Abs[x], True, Abs[mod2[x]]]; fn[x_, n_] :=…
Qiang Li
  • 10,593
  • 21
  • 77
  • 148
3
votes
1 answer

animate 3d plot with some further requirements in mathematica

I posted at this post before, but I still could not solve the following problem completely. As an example: {pA, pB, pC, pD} = {{0, 0, Sqrt[61/3]}, {Sqrt[7], 4*Sqrt[2/3], 0}, {0, -5*Sqrt[2/3], 0}, {-Sqrt[71], 4*Sqrt[2/3],…
Qiang Li
  • 10,593
  • 21
  • 77
  • 148
3
votes
3 answers

Quadratic programming in Mathematica

I'm looking at quadratic relaxation of maximum independent set problem (p.22 here), and found that FindMaximum fails for every graph I try, unless I give it optimal solution as the starting point. These quadratic programmes have 10-20 variables, so…
3
votes
1 answer

Processing large data in Mathematica

I'm dealing with large input arrays with Mathematica and it looks like I can't process anything bigger than (or equal to) 1024*1024 and 81*81*81. Is that normal? Should I be able to do computations on such input data? If so, how?
Ricky Robinson
  • 21,798
  • 42
  • 129
  • 185
3
votes
1 answer

Plot Complex Lines with mathematica

z1=a; z2=b; z3=c; z[t_]=z1+(z2-z1)t; z[t_]=z1+(z3-z1)t; z[t_]=z2+(z3-z2)t; I want to plot these lines with Mathematica on Unit circle. What will I do?
öznur
  • 31
  • 1
3
votes
1 answer

Mathematica, leftover zeros

I'm struggling how to get rid of expressions that are trivially zero in Mathematica from the output. Example: pVec = Table[{i, Exp[-i*0.03]}, {i, 0, 2.5, 1/2}]; pVec[[2, 2]] = p1; pVec[[3, 2]] = p2; pVec[[4, 2]] = p3; …
Vytautas
  • 177
  • 1
  • 8
3
votes
3 answers

How to make an analog of InString[]?

I have discovered that InString[] does not work in MathLink mode when sending input with EnterExpressionPacket header. So I need to define my own function that returns previous input line. One way I have developed here does not work in some…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
3
votes
1 answer

Truncate decimal numbers in Wolfram Mathematica?

Is there a quick and easy way to truncate a decimal number, say beyond 4 digits, in MATHEMATICA? With N[1/6, 4] it rounds to =1.6667. I want you to cut to 1.6666. Thanks!
jose
  • 35
  • 6
3
votes
2 answers

How to implement an eventually repeating list in Haskell?

I can see how cycle can be used to implement a repeating list (eg [0,9,0,9,...], the decimal expansion of 10/11), but how could one implement one that has some initial elements before it settles down to a repeating pattern (eg…
pdmclean
  • 131
  • 3
3
votes
2 answers

How to calculate and plot instantaneous phase in Mathematica

I would like a plot of the instantaneous phase difference between a frequency-swept drive and the nonlinear oscillator it is driving. x[t] below is the instantaneous displacement of the oscillator and plotx provides a plot. Thanks, Carey s = …
Carey
  • 1,137
  • 3
  • 11
  • 18
3
votes
2 answers

(MathLink) Correct handling of Messages generated by slave kernel

When working through MathLink with slave kernel I have a problem with correct parsing TextPackets. In particular when such packet corresponds to a Message generated by the slave kernel I do not understand how to handle it correctly at all. I need…
Alexey Popkov
  • 9,355
  • 4
  • 42
  • 93
3
votes
0 answers

Why don't the usual matrix operations In mathematica work when applied to the MatrixForm of a matrix?

If A a matrix in Mathematica, e.g. A = {{1, 2}, {4, 5}} the usual matrix operations on A, Det[A], Transpose[A], Inverse[A], etc. all produce the correct numerical output. However if we apply the same operations on MatrixForm[A], the numerical…
3
votes
2 answers

Accidental shadowing and `Removed[symbol]`

If you evaluate the following code twice, results will be different. Can anyone explain what's going on? findHull[points_] := Module[{}, Needs["ComputationalGeometry`"]; ConvexHull[points] ]; findHull[RandomReal[1, {10,…
Yaroslav Bulatov
  • 57,332
  • 22
  • 139
  • 197
3
votes
2 answers

How to solve for the analytic solution of a recurrence relation in mathematica

I have a recurrence such as following: RSolve[{f[m, n] == f[m, n - 1] + f[m - 1, n], f[0, n] == 1, f[m, 0] == 1}, f[m, n], {n}] I tried to use RSolve, but I got an error: RSolve::deqx: Supplied equations are not difference…
Qiang Li
  • 10,593
  • 21
  • 77
  • 148
3
votes
4 answers

Maxima crashes on relatively simple integral

I'm trying to Maxima-fy my Mathematica box options formula (https://github.com/barrycarter/bcapps/blob/master/box-option-value.m) but Maxima crashes on a fairly simple integration: load(distrib); pdflp(x, p0, v, p1, p2, t1, t2) :=…
user354134
1 2 3
99
100