The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
40 views

Permanently fixing a variable in the function

I need to define a function let's say f[x_, y_] := x^2 + y^2 such that I need to fix one variable (let's take y = a) and to ...
0
votes
0answers
31 views

Why is my program returning results when there should be no primes? [on hold]

I used the formula to get all the primes up to 1001^2 and I examined the returned list for large gaps between two primes, because I wanted to see what would happen if I specified a range with no ...
0
votes
1answer
117 views

Issue with Set function

Tables often come with column headers. Indexing the columns with the header is a natural thing to do. Although a proper dictionary is the usual solution in such a case, I find it often practical and ...
0
votes
0answers
42 views

While-loop gone wild [closed]

This is my code. i = 4; While[i < 0, {x[i] = (b3[[i]] - Sum[A3[[i, j]] x[j], {j, i + 1, 4}])/A3[[i, i]], i--}] Table[x[i], {i, 1, 4}] and this is it's ...
0
votes
2answers
83 views

How to construct a linear feedback shift register

Are there any posts regarding the construction of a LFSR (Linear Feedback Shift Register) in Mathematica? I can't seem to find any and I am not sure how I would construct one.
0
votes
2answers
58 views

Function that creates a table from two lists

I have two lists shown below: list1 = {(0,0,0,0),(0,0,0,1),(0,0,1,0),...,(1,1,1,1)} list2 = {1,5,5,5,...,5} How can I construct a function that outputs a table similar to this: $$\begin{array}{c|c} ...
0
votes
1answer
89 views

Help with functions in Mathematica

Still learning how to do things in Mathematica. I want to make a function that has many parts. Doing this in something such as Java, which I am familiar with, would be simple. In Mathematica I have ...
0
votes
0answers
32 views

Appending items to list [closed]

I have a list declared like so: listOfInitVectors = {{0, 0, 0, 0}} I am using the following command to append more items to this list as I go: ...
0
votes
1answer
36 views

Built in function to convert list of numbers into list of binary numbers [closed]

Does Mathematica have a build in way to convert a list of numbers into a list of binary numbers? If not how can this be accomplished?
2
votes
5answers
213 views

Making loop based off what I can say in words

I have a list of values a: {1,4,11,14} I want to print out values that satisfy b(1+a) = 0 mod 15 where b are the values from 0 to 14. The output I am wanting is ...
-2
votes
1answer
30 views

Function that returns the divisors of an integer [closed]

Does Mathematica have a build in function that takes a number and returns the numbers that divide it? I was unable to find anything in their docs. If not, how would I accomplish this: For example how ...
2
votes
3answers
43 views

Perform For-loop and show output which meets a certain criterion

I am new to Mathematica and I have a For loop like so: For[i = 0, i < 15, i++, PowerMod[i, -1, 15]] Currently it doesn't output anything. The calculation I am ...
0
votes
0answers
29 views

How can I remove some bad rules applied as a result of syntax error?

This user is pretty light-weight regarding Mathematica rules and such. I dont know how the following issue was created (some prevous bad syntax in the same session) ...
1
vote
1answer
99 views

Using FindMinimum with matrix input

I define the following function which spits out a number S when I feed it a dxd square matrix: ...
38
votes
1answer
838 views

Incompatible Changes since Mathematica Version 7?

There is documentation of the incompatible changes made to Mathematica with each major release: Incompatible Changes since Mathematica Version 1 Unfortunately that documentation simply stopped ...
9
votes
1answer
313 views

How to visualize pattern matching process?

I want a function that does the same job like ReplaceRepeated, and can make the matching process visible. I searched the Internet but didn't find any existing code ...
0
votes
0answers
53 views

Using NestList instead of Do [duplicate]

How can I express the following code using NestList: ...
10
votes
1answer
158 views

Copy Built-in function to new name

It is know that some built-in functions are system function and changing their properties may cause trouble. Suppose for example I want to change features of Cases: ...
28
votes
2answers
805 views

Is there a name for #1@#2&?

Why does the pure function # @ #2 & have no name? I'm asking because sometimes I find inelegant to write expressions like ...
13
votes
2answers
359 views

I define a variable as local to a module BUT then the module uses its global value! Why?

I have a question about modules and local variables. Here's my example: h = 5; Module[{a, h}, a[h_]= h^2; a[4]] (*Out[2] = 25*) I expected the module to ...
4
votes
3answers
172 views

Manipulate: How to create custom reset Button automatically?

I have a complex Manipulate with more than 10 controls. Each one has its own default value. I'd like to add a custom button in the control area to reset all ...
17
votes
1answer
362 views

Confused about how Partition works

I have a problem about the padding list about Partition command. For instance, ...
2
votes
1answer
74 views

ControlType -> None Vs. Module inside Manipulate (i.e. making everything local)

I'm building a program on another one made available in the Wolfram Demonstration Project. I've noticed that in the original code (working flawlessly) many variables were made local inside the ...
20
votes
3answers
440 views

Real Numbers in the Wolfram Language

Epilog: Much of the discussion in the answers below revolves around the distinction between Real as a data type and real numbers as a domain or class of numbers (irrespective of the form in which ...
0
votes
1answer
114 views

How do I write nested for-loops?

Looking through the reference.wolfram, I couldn't see an example of how to write a multiple line "for" loop in Mathematica. I need to nest many for-loops in such a way I can do many things in the ...
4
votes
2answers
380 views

Code elegance and compactness. Help needed with Map, Apply

I need some help with code optimization and compactness. I have a set of two-dimensional points and I can use the Mathematica function FindClusters to find 4 clusters. I'd like to plot the points ...
2
votes
0answers
56 views

What was the thought behind the parallel versions of Table, Map, etc..?

There separately named versions of the parallel analogues of Map[] and friends: ...
2
votes
3answers
117 views

Pick bug? level 0 matching

A previous discussion of this issue (Is there a bug in Pick?) accepted that matching at level 0 is not a bug in Pick. Was that correct? I am not yet persuaded. ...
2
votes
3answers
115 views

Computing a sequence by recurrence

I am trying to create a list where each element of the list is calculated using the sum of all previous elements of the list and also uses the $N$th element of another list. The initial value of the ...
1
vote
1answer
65 views

Computing a Sequence using Recurrence

I posted a similar question earlier today, but unfortunately I realized after several hours that I over-simplified the problem for this forum. There is a very good answer to the Computing a sequence ...
11
votes
2answers
808 views

Scan vs Map vs Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
10
votes
2answers
321 views

When must I use the Return function?

In a comment to my answer to this question, QuantumDot asks, "Where can I find more information on when I must use the 'Return' function?". I found this too deep a question to be answered by leaving a ...
20
votes
1answer
266 views

M9 performance regression for Fold?

Bug introduced in 8.0 and persisting through 10.0.2 or later I noticed an over 10x performance drop on Mathematica v9.0.1 (as Oleksandr R. commented, also v8) compared with v7.01 for this code: ...
17
votes
1answer
267 views

Why some built-in functions are slow

I just wonder why some built-in functions are slower compared to some other ways using more than one built-in functions for doing same job. consider this example: ...
18
votes
1answer
387 views

Shorter syntax for Fold and FoldList?

I find it tedious to write out the following: a = {1, 2, 3, 4}; Fold[f, First @ a, Rest @ a] f[f[f[1, 2], 3], 4] It ...
2
votes
2answers
99 views

DictionaryLoopkup - pattern specification

I would like to find all Italian words that have a specific pattern of letter repetitions. Actually I'm looking for 6-letters words that have 1 letter repeated 3 times, a second letter repeated two ...
3
votes
1answer
120 views

How can I trans-compile Mathematica into another language?

I'm looking for an exhaustive list of source-to-source compilers to all other languages, if any exist that is.
5
votes
1answer
95 views

Changing the definition of N: unexpected $RecursionLimit::reclim error

I have some objects represented as follows: Object[data, param] data is a list of numbers, ...
15
votes
0answers
136 views

A bug in the overloading of MemberQ and FreeQ for Association?

Bug introduced in 10.0.0 While answering Pattern match for nested Association I came across behavior of MemberQ and FreeQ in ...
70
votes
3answers
2k views

How to make use of Associations?

I have been curious about it for long. Now that Mathematica 10 arrives, I think it's time to ask the question: How the new Association data structure would be used ...
4
votes
1answer
36 views

How to find out which definitions use Temporary symbol?

According to the Documentation, Symbols with attribute Temporary are automatically removed when they are no longer needed. For example: ...
14
votes
3answers
189 views

How do I understand ListCorrelate(contains $\{k_L,k_R\}$) when it works for 2-dimentional data?

Two months ago, I asked a question here And @nikie give me a solution: The intuitive way to understand ListCorrelate is that the kernel is "moved" to every ...
1
vote
0answers
70 views

Concise way to express Table[FactorInteger[300][[n, 2]], {n, 1, Length @ FactorInteger[300]}]

I can get the exponent part of FactorInteger[300] with Table[FactorInteger[300][[n, 2]], {n, 1, Length @ FactorInteger[300]}] ...
35
votes
4answers
562 views

What's the difference between Inactive and HoldForm?

In version 10, Mathematica not only added Inactive / Activate but also highlighted this change in the "New in 10" page (in Core ...
3
votes
2answers
100 views

MapThread problem

I would like to do the following: ...
2
votes
0answers
56 views

Unexpected behavior from Indexed

I was going to include Indexed in this answer, thinking that it operated much as a List-only ...
0
votes
1answer
57 views

What does this Append expression do? [closed]

I have to understand some code. A part of it is written below. Can someone explain to me what it does: ...
9
votes
6answers
368 views

Product of elements of a list

Sum is for functions; Total is for a list. Product is for a function; what is the command ...
9
votes
2answers
121 views

DownValue assignment using Apply

Why does assigning a DownValue using Apply, e.g., ...
2
votes
0answers
29 views

How exactly does ReplaceAll work? [duplicate]

I am not sure if this question has been asked before but anyway, Consider these two examples: ...