Questions tagged [variable]

Questions on the use or manipulation of Mathematica variables (i.e. names associated with a changeable value). Use [variable-definitions] or [assignment] for questions on variable context localization, or assignment.

2
votes
1answer
64 views

How to read in and assign values from a txt file?

I have a text file that I would like to import into Mathematica - after searching around the internet, I can't seem to find any pages that explain how to do this: The text file containes these four ...
0
votes
1answer
53 views

Table and FindRoot of a 2 variable function of x and t : cos(x + 3t)

I am trying implement mathematica commands: Table and FindRoot, of a 2 variable function <...
0
votes
0answers
74 views

Problem with fitting

So I have a very simple question related to a simple topic, but also directly related to a fitting problem. I see that my question is related to this question but I don't manage to make the bridge ...
1
vote
2answers
44 views
0
votes
1answer
58 views

Five equations to solve 6-variables question, is it possible?

I was given a task to find the value of variable a,b,c,d,e and f. But I'm not sure it is even possible, given that only 5 equations are available. Can anybody point out how to solve these: ...
1
vote
1answer
34 views

How to use a table with two variables as the values for a function with two variables (x and y)? [duplicate]

I'm sorry if this is a dumb question. I am a student and have 0 prior experience with Mathematica or any sort of coding and I have looked at various resources trying to figure it out myself but still ...
0
votes
0answers
28 views

Bounding Solve results to named variables

How can i bound results of my Solve function to variables properly? This metod works but causes unexpected troubles i struggle to resolve ...
2
votes
1answer
128 views

How do I create a variable that uses I?

I'm planning on working with a set of non-linear differential equations. A few of the equations look like: Mathematica tells me that I is protected. Is there any ...
1
vote
3answers
34 views

Simple question about variables into functions

Im trying to write a very simple code that will solve an equation. total = 800; side1 = x; side2 = total - 2 x; f[x_] := side1*side2 f[x] f'[x] Solve[f'[x]==0] ...
1
vote
1answer
22 views

How to define a function, that generates matrix of variables, which can be later used in Reduce?

My goal is to generate matrices, on which I will put different constraints in Reduce funcion, e.g.: ...
0
votes
2answers
67 views

Separating variables in a set of equations

I have a very large set of equations eqs with variables denoted by capital letters like PVA[2], QA[2], etc. and small letters like ica[1,2], tr[2,3] etc. And I have ...
1
vote
1answer
45 views

Apply different PlotStyles to functions with functions as variable [closed]

I have a function func[expr,var] with which I want to plot the list expr[var] and have different styles applied to it. When ...
1
vote
1answer
45 views

Rearranging similar terms in an equation

In a piece of code I am writing, I run into an equation of the form ...
0
votes
2answers
51 views

How to show the answer in terms of another variable

if we have A = 1; B = 44 + 1 output :: B = 45 how we can show B like this output :: B = 44 + A
0
votes
1answer
43 views

Changing variables to obtain derivatives of new variables [duplicate]

Let's say that I have some symbolic expression of a function $x(t)$, and would like to obtain its derivative $x'(t)$. However, I also have the following two identities, $\xi = \omega t$, and $\eta = ...
4
votes
1answer
248 views

Why is DSolve different when the equation is built programmatically?

Here is a simple differential equation. mwe=y[x]/.First@DSolve [{y'[x]==x-2*x*y[x],y[0]==0},y[x],x] I get the answer $\frac{1}{2}-\frac{e^{-x^2}}{2}$ If I build ...
0
votes
1answer
55 views

Why is ww[[1]] not a valid variable in FindMinValue and Plot [closed]

Why is ww[[1]] not a valid variable when given to FindMinValue and Plot, but is a variable ...
0
votes
0answers
27 views

How can I access the name of a variable inside a function? [duplicate]

How can I access the name of a variable inside a function? For example I have variables mike={some stuff} jenny={other stuff} and want to write a function f giving the following: input> f[mike] ...
0
votes
1answer
129 views

Can I bake my own PI using your Wolfram language oven and prebuilt utensils? [closed]

How might I override the value of the Greek letter PI within various builtin language functions in the Wolfram language? Specifically and without having to reinvent the wheel or code equivalent ...
0
votes
1answer
74 views

Computing an integral : Mathematica seems to say it's diverging or not defined and I think it is

I would like to compute : Element[a, Integers] Element[b, Integers] Integrate[Exp[-a^2*(x (1 - x/b^2))^2], {x, 0, Infinity}] which is obviously not diverging. ...
0
votes
1answer
35 views

Inequality with assumptions

I would like to find 2D region formed by $(a,c) \in \mathbb{R}^2$ such that the inequality $f(a,c,x,y) \geq 0$ holds for all $x,y \in [0,1]$. If I solve this inequality with reduce of the form ...
0
votes
1answer
33 views

Factoring out a parameter

I have some function: f[a_,b_,c_]:=Sqrt[a^2+b^2+c^2] Is there a way that I can factor out parameter (variable) b like this: <...
1
vote
1answer
75 views

What is the recommended way to plot a function with a dependent variable?

I am currently learning the basics of Mathematica. I can't seem to find a straightforward answer in the Wolfram documentation, probably for a lack of clarity in my queries. For example, I want to ...
1
vote
1answer
41 views

Question about ListPlot of variables [closed]

My question is trivial but I don't seem to be able to get the answer. Suppose that I do a numerical computation (division of some numbers that come from the numerical solution of an NDSolve or ...
3
votes
2answers
58 views

Using Symbolize to Convert Multiple Variables at Once

So, I have created a list of subscripted and overdotted variables that I would like to symbolize, so I run them through a for loop. Seems to me that this would work? Any help is appreciated. ...
6
votes
0answers
63 views

Nested rules and automatic renaming of variables [duplicate]

I understand why $ happens here: ClearAll[foo] foo[a_] := (x_ :> a x) foo[1] ...
2
votes
2answers
88 views

Possible to solve this function?

I have this function: Emax[T_, d_] := -(1/2) + d + d/(-1 + E^(d/T)) - 1/2 Coth[1/(2 T)]; All I want is to transform this Function so I get: ...
1
vote
2answers
54 views

Showing variable values on a 3D Plot

I am running a 3D plot a 100 times to show the dynamics of two undetermined variables (cM and cR) for a 100 values of ...
0
votes
1answer
25 views

Extract and name PNG's from loops [duplicate]

I want to extract PNG files and name them depending on the dummy variable of a loop. For example, starting from ...
0
votes
0answers
37 views

matrix perturbation general formula with random values

Is there a way to generate an arbitrary-sized diagonal matrix of variables, not numbers, in mathematica? Probably unnecessary context: For a research question I'm pursuing, I want to find general ...
1
vote
1answer
37 views

Use Solve for two Functions to find 1 common Variable

I have 2 functions that look like this: F[t_,d_]:= 10+t+2d G[t_,d_]:= 5+t+d I'd like to solve this in such a way to know for which t both Function have the Same value. I assume that this won't be ...
17
votes
2answers
322 views

When to name a variable with $

There are some symbols in the Wolfram Language that start with $, including $Abort, ...
1
vote
1answer
48 views

Mathematica is picking up variable definition from other files

Mathematica is using definitions from other open files in the same folder. I want variables not defined in a particular file to be treated as undefined variables. I do not want Mathematica to pick ...
0
votes
0answers
29 views

Problem in importing function in NDSolveValue

I have a code for solving a system of 2 differential equations (sol1). Given that what's inside is a bit heavy, I define functions so that I can call them. My issue is that when I write everything ...
2
votes
2answers
104 views

Define a function of a function of an arbitrary variable

I want to define a function called int that takes another function as an argument and yields an integral of that function from 0 to 1 (just for example). So I ...
0
votes
1answer
41 views

Plot interpolating function depending on free variable inside manipulate

I create an interpolating function which depends on some free variables. I then want to plot it inside a manipulate, but my output is empty. What am I doing wrong? ...
0
votes
1answer
35 views

Altering the Values of Global Lists Within Tables

Say I have some lists: list1 = {4} list2 = {2} list3 = {6} list4 = {9} list5 = {7}. I want to alter them in a table like so: ...
0
votes
1answer
67 views

Solve an equation with two specific domains?

In Solve an equation with specific domain? I asked how to write a code in Mathematica with one specific domain for one of its variables. Now I have a questions: If two of the variables are from ...
1
vote
2answers
261 views

Solve an equation with specific domain?

How can I write a code in Mathematica to solve an equation with variable in specific domains? For instance, I want to write a code for ...
-1
votes
2answers
144 views

How to replace Variable With Variable [closed]

Clear[a, b, c]; a = c; a =. ; b = a; b =.; c = b; c =.; Print[a, b] and the result is {a b} but I want the result ...
0
votes
1answer
74 views

Automatic variable naming

I am trying to construct a complicated code in which I need to name a lot of variables and their definitions. For Example: The problem is as follow: Once I insert new variable in between two, I ...
1
vote
1answer
47 views

Using Variables[] as the argument of Plot[]

I want to use the Variables[] function to extract the name of the variable of a function, such that I can use it later, e.g. in a ...
0
votes
1answer
59 views

How to plot solutions for simultaneous equations

I have 2 simultaneous equation of $x$ and $y$. Here is how I solve it, and it works. But I want to vary the parameters n and ...
2
votes
1answer
67 views

Relabeling and matching variables (in MultiplicationTable)

Suppose we have a set of data given here as the multiplication table of 8 elements labeled {1,2,3,4,9,10,11,12}: $$ \begin{array}{cccccccc} 1 & 2 & 3 & 4 & 9 & 10 & 11 & ...
1
vote
1answer
62 views

Use Manipulate for a global variable

I do have a global variable called w1, which is used as a factor in a dataset, however I want to make this factor dynamic. ...
0
votes
1answer
51 views

How can I evaluate a function using the results of Reduce?

Can I use the output of reduce to define a variable in a function definition? In other words, can I somehow skip the step where I manually enter t:=2? ...
0
votes
0answers
39 views

assigning numerical values to variable

I have a csv data file, has two columns of data. First column denotes time (t) and the corresponding value in the second column is flow rate (f). I would like to assign these values to an array f[t], ...
0
votes
0answers
150 views

What are the valid symbol names for packages?

Regarding to the message: ...
1
vote
0answers
52 views

Execute a notebook with a changing variable

I have created a notebook with one fix variable that I want to run from 1 to 100. Every time the whole notebook (all cells) shall be executed for the given number. At the end of the notebook, it shall ...
0
votes
1answer
57 views

Issue with variable recognition

Why are the variables r,s,u,v identified differently in the definitions of F2,G1,G2?