# Questions tagged [variable-definitions]

Questions on assigning and unassigning definitions to names that represent them, including issues raised by context and localization. Use tag [assignment] for issues relating to Set versus SetDelayed.

416 questions
Filter by
Sorted by
Tagged with
50 views

### Define/store individual elements of Table output for back-substitution

At its core, mine is a very simple communication error between me and Mathematica that I haven't been able to crack, so I do apologise if it seems embarassingly inane. Please consider the following ...
40 views

### Getting error messages form Set while trying to implement the bisection method with a For-loop [duplicate]

My objective is to build a function using modules that runs the bisection method. I have a working bisection method but when I try to implement it as a module I keep getting this error and I can't ...
96 views

### Basic Question: how should I read this instruction?

I'm very new at using Mathematica and it's not my Job. It's just something I like. ...
34 views

### Multiple functions compact form

I have a sort of silly question... I need to define two functions in the following way ...
108 views

### How can we make the input of a function multiple lists?

I want to create a function that takes inputs that are multiple lists of ordered quadruples. For example, when we run the code our input line should read something like inputs[{2,3,4,5},{6,7,8,9},...} ...
63 views

### Save a Derivative

I have defined the derivative of a function Derivative[f][x_] := Sin[x] How can I save this definition in a file? Derivatives are not included in ...
45 views

### Compact notations for multiple variables

Why does this work Manipulate[ListPlot[{a,a,a}], {a, 0, 1}, {a, 0, 1}, {a, 0, 1}] But this doesn't? ...
177 views

### KeyExistsQ[] but for functions?

Is there a good way to check if, say, f has been defined if f is a function, similar to ...
42 views

### Defined function keeps the variable

I'm a beginner at Mathematica, and I have a problem finding the roots of a function for a specific variable (using Jens' findAllRoots function). Due to the nature of my problem, I need to compute ...
2k views

### Character to replace _ in symbol names?

In C, _ comes in handy when naming variables and functions, as a replacement for space. For example: ...
408 views

### Create variables in a for loop

I am very new to mathematica, but it would be much easier for me to use For loops in order to create variables. My train of thought was simple, but apparantly does not work. Let's say I defined these ...
24 views

### Number of values stored in a function

Suppose I run this: f = 1; f[n_] := f[n] = 2 f[n - 1]; f Now there will be 1001 values stored in f, and ...
747 views

### When is a symbol a Symbol? Is there an easy Mathematica way to test if an object is a symbol sort of like a SymbolQ?

Yes I know there is no built-in native function called SymbolQ (but JavaScript does). However, could one be simulated to work for most cases? I often rely on ...
37 views

### How to Append the value of a variable and not the variable itself

So lets say I have a = Some complicated code that changes list = {} AppendTo[list, a] Obviously it would give me ...
26 views

### Referencing data in sets of sets

Given a data set how to assign definitions to the subsets. For instance given the data data = {{0, 1, 1}, {0, 1, 1}, {1, 1, 0}, {0, 1, 1}, {1, 1, 0}} if {0, 1, 1} ...
89 views

### Is there something wrong with DistributeDefinitions?

I have the following code, which fails to distribute the DownValues for the symbol f. Could anybody please explain what is wrong. ...
61 views

### Subscripts use to make expression readable [duplicate]

I am trying to write a function in mathematica which depends on different parameters. For example $$f(x_1, x_2, x_3, x_4, x_5)= 2x_1+\sin(x_2)+x_3*x_4-x_5^{-1}$$ (My actual function has 12 such ...
129 views

39 views

### Problema simulating FindRoot

I am writing a procedure that simulates the findRoot built-in function using the same code that appears at chapter 6 of $\textit{Programming in mathematica}$ by Paul Wellin. The code is the following....
30 views

### syntax error when defining a list of matrices: “…cannot be followed by..”

I am literally just defining a list of matrices, but seem to run into the following error when adding the last matrix. (so to be clear, I get no error when I take out the last matrix entry). What's ...
40 views

### Assign variable to solve [duplicate]

I would like to assign my result from equation. I tried /. and := but it gives me empty variable. How can i fix it?
35 views

### Getting a stored variable from its value

Given a numerical value, is it possible to check whether that value is stored in (or defines) some variable in the notebook? Maybe if I could list all of the defined variables, then I could simply ...
112 views

### Mathematica Won't Recognize a MeshRegion

I've implemented the code in the top answer of this question on the Plateau problem in differential geometry, and it works with the example shown in Example 1, so there is nothing wrong with the code. ...
54 views

### How to define an Intermediate Variable [duplicate]

I want to find the relationship between several parameters. But I don't know how to define an Intermediate Variable. For example: I want to know the relationship between x and {y,z} which will satisfy ...
29 views

### Avoid an Error Message when Importing

Consider the following code Button["Import", file = SystemDialogInput["FileOpen"]; data = Import[file], Method -> "Queued"] which yields a button which, ...
11 views

### Min of a set defined with conditions

I would like to define this parameter inside a function: \$R = \min\left\lbrace i \in \left\lbrace 1,\cdots,n \right\rbrace \; : \; ((p+i)\mod n) \; \neq a_{j} \; \forall j \in \left\lbrace 1,\cdots,m ...
67 views

### Automatically generating and labelling controls in Manipulate

Consider the following code ...
79 views

### Issue with Solve, NSolve, FindRoot

I have this code that I've been trying to get working for some time. I asked some questions before which helped but still struggling! ...
35 views

### Issue with variables/functions in solving equations

I've been posting some questions all around issues with defining and using variables/functions in Mathematica. Based on the answers/comments I got I still cannot make this simple code work... Why is ...
59 views

### Table of Variables within Manipulate

Given a certain number n, I want to define n controls within Manipulate with the correct ...
305 views

### ParallelSum vs. Sum: New functions also defined in other Kernels?

Set-Up: While I had tested a few toy examples that ParallelSum produces the result faster than the Sum, here I encounter one example in my code that the ParallelSum produces either wrong/incorrect ...
70 views

### Store boolean expression into a variable

My purpose is to use a boolean expression as a requirement that a pattern must comply. The requirement is c1 == "a", and I am using it to select a string from a ...
536 views

### Do Table iteration variables need to be localized using Module?

Lets say I define a Module, that internally use iterating in a Table or Do, say something ...
21 views

### Plot 2 functions, and function defining practise [duplicate]

I would like to plot the f1 and f2 functions on the same plot. The problem is that all functions are green on the plots. Is this a good practice to define the f1 and f2 functions and the rules like ...
90 views

### Is it possible to use a previously defined value in subsequent definitions of a Block`?

Is it possible to use a previously defined value in subsequent definitions of a Block? According to syntax coloration, this should work as expected, that is, ...