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.

learn more… | top users | synonyms

0
votes
3answers
73 views

Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
0
votes
0answers
13 views

mathematica online variable naming [migrated]

I am new in mathematica Doing my best, still I don't know how to use a variable with a length higher than one. Here I use a variable called ba while wolfram alpha ...
0
votes
1answer
87 views

Variable dependency…easy one

I'm brand new to Mathematica...should be an easy one. Instead of writing u[x] everywhere in the code, how do I assign the dependency early on like this: u=u[x] ...
3
votes
2answers
66 views

How to use locally scoped dynamic variables in Manipulate for expression and control parameters

I have a Manipulate that has dynamic variables that I want to use in the displayed expression and use in the parameters for the manipulate controls. I only ...
1
vote
1answer
64 views

Adding letters and numbers to create a variable name [duplicate]

Let's say I have several variables, named R1, R2 and R3. I wanted to have a function ...
0
votes
2answers
77 views

How to define $x^n$ where $x=\pm 1$ and $n\in\mathbb{Z}^{+}$?

I do not know how I can define $x^{n}$ in Mathematica, where $x=\pm 1$ and $n=1,2,3,\ldots$. For even values of $n$ we simply have that $x^{n}=1$. While for odd values of $n$ we have that $x^{n}=x$. ...
1
vote
1answer
45 views

Define operator with special characters [duplicate]

I have looked here which describes how to define operators. I was wondering whether there was a way to assign thes operators to special characters? eg Let $\odot:=(a+b)(ab),$ so ...
1
vote
3answers
88 views

How to replace element of list by index

I'd simply like to replace the value x at index [[j,i]] in a two dimensional table with the value ...
2
votes
1answer
38 views

Strange behavior when defining a symbol/function pointwise

I am well aware of the fact that floating point number have finite precision, so one needs to be careful when comparing them. Still, I find it disturbing/surprising that the following input into ...
5
votes
1answer
87 views

Naming conflicts with Dummy variables in several packages conflicts

I'm using several packages in a notebook. In each packages there is functions defined with dummy variables. When I load the several packages in my session, i've got a warning message: ...
0
votes
0answers
47 views

Errors when changing variables

I have the following function : K[r_, h_] = -(D[h[r], {r, 2}] + D[h[r], r]/r + D[h[r], r]^3/r)/(2 (1 + D[h[r], r]^2)^(3/2)) In order to adimension it, I am ...
0
votes
1answer
49 views

Setting the solutions of an equation as a variables [closed]

This is probably a simple question, but i couldn't find a solid answer. So i have an equation Solve[{F[x, y] == 0, G[x, y] == 0}, {x, y}] but i want to use the ...
1
vote
0answers
42 views

Subscripts in variable names: Bug?

In the following plot, one of the two functions {-par, par} defined by ...
0
votes
3answers
92 views

Define a matrix depending on variable in Mathematica [closed]

I am translating my code from Python to Mathematica. I am trying to define a matrix, whose values depend on a variable chosen by the user, called kappa. In Python the code looked like that: ...
2
votes
1answer
57 views

Is there a shorthand for Optional with Condition?

I have a recursive function that does some work to an object for a repeatedamount of times. ...
0
votes
1answer
46 views

Weird subscript name in output [duplicate]

One of my first times using mathematica, I'm getting a weird Subscript(1,0) output when I try to solve a derivative. What is going on and how can I fix this?
0
votes
1answer
48 views

Simplify huge output or using the output without showing it in full [closed]

I'm trying to solve a system of differential equations. It works fine but Mathematica creates a huge output, which, when shown in full, results in a file size about 100 mb. Using Simplify doesn't work ...
1
vote
1answer
104 views

Iteration convergence of Newton approximations

I am trying to determine for which initial values Newton's approximation of specific functions (EX: f(x)=x^2 -1)converge and to what numbers it will converge to. *Where Newton's approximations are ...
0
votes
1answer
108 views

Plotting Complex Numbers - Functions of Complex Numbers [duplicate]

So I have to generate a few different plots with z, where z is a complete number... z[x_, y_] := x + y*I F[z_] := (25*Pi*z*I)/(1 + 10*Pi*z*I) First, I need to ...
0
votes
1answer
46 views

Calling a function on a variable with parameters [duplicate]

I have an equation that contains parameters. I want to use it in a function like NDSolve, but I can't seem to figure out how to do so. Here's an example: I define ...
3
votes
1answer
123 views

How can I overload a function with multiple bracket-slots so f[a][b] and f[a] can coexist?

Maybe this is not even possible: I want to create a function f that can have two input brackets like: f[a_][b_:1]:= a*b and ...
0
votes
1answer
64 views

How to specify the domain of a variable?

How can I specify for every expression the domain of a variable without using assumptions everytime i have to simplify it?
0
votes
0answers
34 views

Variables input generation for Minimization in High dimensional space

I'm currently doing optimization in a high dimensional space. I was thinking of giving FindMinimum (or NMinimize not certain ...
3
votes
2answers
133 views

Using Block with a list of variables

I have a list of variables var={v1,v2}; which I want to protect/localize during a particular operation. I have decided that I want to use ...
8
votes
1answer
164 views

Context of localised (dynamic) symbols

When you localise a symbol with Module, the created unique symbol is usually in the current context. There seems to be an exception to this which has further ...
10
votes
1answer
172 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: ...
0
votes
0answers
14 views

Use of placeholders in functions [duplicate]

I'm having some trouble with Mathematica's placeholders within functions. The function sel[lowerLimit_] should select all elements of x that are greater than the lowerLimit: ...
7
votes
2answers
298 views

Using up-values and down-values

I have a problem I'm trying hard to find a solution for, although I don't know if a solution exists. The following rules produce the result e[2].f[] ...
2
votes
0answers
22 views

Determining default value from previous arguments [duplicate]

How does one specify a default value for an argument which is dependent on the previous arguments of a function? For instance, consider the function ...
2
votes
1answer
101 views

Table of references [duplicate]

I have a list of variables (say a, b, c, d, e) that I want to assign in a single command. {a,b,c,d,e} = {1,2,3,4,5} would ...
0
votes
0answers
83 views

Numerical Integration/Function

I have a problem with a function defined numerically through an integral of the form: ...
4
votes
0answers
86 views

Using an external Pattern breaks Format

I noted while writing this answer that using an external Pattern on Format doesn't work: ...
12
votes
1answer
253 views

Orderless pattern matching

The MMA docs state that "In matching patterns with Orderless functions, all possible orders of arguments are tried". Why then does the following not work? ...
-4
votes
2answers
98 views

Module function corrupts string? [closed]

I have the module who should replace some elements of a matrix with checkboxes ...
0
votes
1answer
67 views

How to assign the array data to variables?

A very basic question but puzzled me for long time on how to assign array to variables. For instance, we have array {{t1,x1},{t2,x2}...{tn,xn}} how to assign the first element to variable t and ...
0
votes
0answers
11 views

Watching variables during Notebook work session [duplicate]

One feature that I have always wanted but could not find out if it was supported and that is to actively watch variables and their values while working in a Notebook session. In fact, there are two ...
6
votes
2answers
122 views

Injecting list of controls into manipulate

I am trying to program a method to manually move around graph vertices, and then output the new coordinates. I'd like to turn this into a function that can be called with a variable number of ...
1
vote
2answers
2k views

How to tell Mathematica that certain variables are real/imaginary, integer-valued, etc

I'm trying to expedite some quantum mechanical calculations by running them through Mathematica. Expectation values and stuff like that. When I say, for example, ...
0
votes
1answer
28 views

Variable as Difference of 2 Variables

I would like to evaluate a function based on the absolute difference of two variables. An example: g=5*x-5*x*y-5*y diff=x-y D[g,x] D[g,y] D[g,diff] I cannot find ...
3
votes
1answer
81 views

Defining a function that prints both the name and value of a variable defined locally within the calling function

To save time when debugging with Print statements, I'd like to define a function -- call it PrintVal -- that prints both the name and value of a variable defined locally within the calling function. ...
1
vote
1answer
86 views

How to form a variable from matrix elements

I have matrix with n rows and 2 columns, say m = {{x11, y12}, {x21, y22}, ..., {xn1, yn2}. Now, I want to form three new variables for example: ...
1
vote
0answers
108 views

How to create a complex variable from dated list values

Can anyone help me to construct a variable "PI" from values of variable x. Variable x represents a group of two time series rj and ri on equal dates(joined two dated lists with states).Variable x have ...
2
votes
1answer
99 views

Equivalent command to the Maple indets command

This carries on the discussion here and here. I had mistaken Variable[] to give you ALL variables in an expression, but apparently, it is not meant for that. ...
0
votes
1answer
102 views

About Symbolize and Variables

I do believe this sort of similar questions had been asked many times, so I have read a LOT. For example this and this as well as many other related posts. But a glance at what my main question is ...
3
votes
1answer
91 views

Need some explanation of “Global`*”

When I start a new notebook, I enter Names["Global`*"] I get this {"list", "msgs", "rhs", "z"} Then I enter, ...
0
votes
0answers
22 views

SharedVariable in WebMathematica

How can I create a variable to be used and setted over all my WebMathematica kernels? Here is the case: Create a package with do data structure like: data = ...
0
votes
2answers
116 views

Variable Value as Range

Thank you for the help so far! I would like to assign +/i signs for the function and solution such as (+)(+)(-) and therefore (-). It is working for the first evaluation, ╬╗lower, but not for the ...
3
votes
2answers
152 views

Convert matrix rows into variables

Can anyone show me how to set all matrix rows to variables. For example, I have matrix w={{1,2,3},{3,2,1},{0,0,0}} and I need to set each matrix row to be separate ...
0
votes
0answers
46 views

Replacing variable names in a notebook

I am working on a code that simply imports and graphs a function. If I preset the directory I would have something that looks like this: ...
5
votes
3answers
330 views

Assign output of solve to variables [duplicate]

I have this input: Solve[x^2 + 3 x + 2 == 0, x] which gives this output: {{x -> -2}, {x -> -1}} I want the first x ...