Questions tagged [syntax]

Questions on correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and ~ characters.

Filter by
Sorted by
Tagged with
0
votes
2answers
52 views

Syntax error using Plot

Why is the error coming and what should I do to resolve it The code is ...
0
votes
0answers
40 views

Mathematica Syntax - Mixing commands with text [duplicate]

Simple question but couldn't find answer anywhere.. I'm trying to write a coordinate of a point as such: "(" Subscript[x, k] "," Subscript[y, k] ")" But the output is ...
4
votes
1answer
69 views

Convert numbers to rational numbers with the same denominator

Is it possible to modify an answer so that all numbers have the same denominator? E.g. Table[(27 - k)/15, {k, 0, 29}] returns ...
0
votes
0answers
42 views

Is it possible to integrate partial integro-differential equation?

Consider a system of equations $$ \begin{cases}\frac{\partial f(p,t)}{\partial t}-H(t,T_{\gamma})\frac{\partial f(p,t)}{\partial p} = \int \limits_{p(p)} dp' G_{1}[p',f(p'),T_{\gamma}], \\ \frac{dT_{\...
0
votes
0answers
28 views

Working with associations: summing

Consider some association: ...
0
votes
0answers
32 views

Working with associations: precomputing

Consider some association: ...
1
vote
3answers
99 views

Making a plot of ${\rm Re}(z)+\ln|1βˆ’𝑧| $

Please, help me to make a plot of the complex expression ${\rm Re}(z)+\ln|1βˆ’π‘§| ≀ 1/2$ I tried this: Plot[Rez + Log10[abs( 1 βˆ’ 𝑧)] ≀ 0.5, {z, -10, 10} and ...
0
votes
0answers
47 views

Giving variable inside WhenEvent a value

I am defining ParametricNDSolveValue in one cell and then using this in another one to find the parameter value using bisection. For clarity, I have simplified my differential equation. In order to ...
2
votes
0answers
32 views

Replacement using /. and two parts, one for variables and one for values [duplicate]

How do I evaluate, e.g. $3x+2y+z$, if I have $(x,y,z)$-values defined by a variable a = {4, 5, 6} I could do it with ...
1
vote
1answer
46 views

How to emulate statistical command choice tab of this widget?-how to do what i ask?

I designed this little program, but I want you to be able to choose what I want to look for by choosing it as you do with the widget tab, please help me. widget Widget of internet my program ...
1
vote
1answer
75 views

If I don't want Pi to be calculated, what should I do?

Dt[0.04Cos[10Pi x]Cos[50Pi t]] As the titile described, I don't want the Pi to be calculated. I just want it to exist in the form "Pi".
1
vote
0answers
31 views

NIntegrate with AdaptiveMonteCarlo method

I have some complicated function that depends on a few parameters that I need to integrate. It is integrated in the fastest way by using "AdaptiveMonteCarlo" method. However, I have found ...
0
votes
1answer
58 views

Error test failure for the following system

My question is about a reason of the inability of Mathematica to integrate the given system of differential equations, that depends on parameters, in a stable way: for some values of the parameters ...
1
vote
1answer
43 views
2
votes
3answers
94 views

force maximum simplification of radicals in a traditional way-How to do it?

this should be simple but I can't get mathematica to simplify a radical or a set of radicals and express them in the traditional way for example by simplifying this ...
4
votes
1answer
61 views

Method for determining valid name syntax?

This question 40194 asks about work arounds to check and replace variable names which are invalid in a specific MMA function context. For that case testing using the function itself is the most ...
1
vote
1answer
55 views

ReplaceAll with a list of parameters [closed]

Trying to ReplaceAll with a list of parameters, but I can't see how to do it properly: ...
0
votes
0answers
29 views

How apply a function to multiple nested elements without a loop

I'm trying to speed up solving the intersection of groups of lines with a surface. At the moment I have a function that loops through each line in a group (i), then goes to the next group (j). The ...
1
vote
1answer
54 views

How do I write small “black board” c1, c2, … constants?

New for Mathematica 12(?) seems to be a formatted "black board" style of the former C[1], C[2], ... constants in Mathematica 11. How do I type these with formatting at input? C[1] etc. still ...
1
vote
1answer
52 views

Why does Replace `/.` not get evaluated in this formula?

Learning the wolfram Language, in section 32 "The Wolfram Language" // Characters[#]& /. Alternatives @@Characters["aeiou"] -> Nothing ...
1
vote
0answers
68 views

How to figure out syntax for symbols?

I'm new to Mathematica and am having a hard time figuring out how to type certain symbols when I read the documentation. For example, in https://reference.wolfram.com/language/ref/...
2
votes
2answers
42 views

How to get the symbol name of a list element?

Let's say we have a list g with variable d as its element: Clear[g, d] g = {1,2,3,d} Now <...
1
vote
0answers
40 views

Create a set of prime factor numbers given a set of tuples

Given a set $\Omega$ of tuples, for example, Tuples[{Range[0, 4], Range[0, 3], Range[0, 2]}] how can I create all numbers on the form $p_1^{t_1}p_2^{t_2}p_3^{t_3}$ ...
0
votes
1answer
28 views

Is there a better syntax to obtain the derivative of a function as a function/operator? (e.g. for simple plotting of derivtives of functions, etc.)

When trying to plot a derivative of a function, (I take Sin as a simple example), the naive approach ...
0
votes
1answer
79 views

Root finding: Is there no bisection method root finder?

I am trying to find a root to an equation f[k,...]==0 numerically, where k is the variable I am solving for. Using both NSove as ...
1
vote
1answer
142 views

Can anyone translate this code into simpler one?

I'm new in Mathematica, so can anyone translate the following code into a simpler form where uses more familiar syntax? my mean is #,...
0
votes
0answers
85 views

What does it mean when a function has two square brackets?

I have been solving some partial differential equations with mathematica, and the solution of one involves a function $c_1$ as follows, $f[x,y,z]=e^{x}c_1[y][y+xz].$ I am not sure exactly what it ...
12
votes
2answers
856 views

How to solve the Monty Hall problem?

Problem For purely recreational purposes I would like to solve the Monty Hall problem with Mathematica using the function Probability (dedicated to the calculation ...
3
votes
1answer
83 views

Create a list of coordinates given a list of x values and a function

I have a function and $x$-values as a list. How do I construct a list with coordinates $(x_i,y(x_i))$, $i=1, 2, …$ y[x_]:= 2x x = { -3, 0, 4, 5} which should be ...
1
vote
1answer
75 views

Center and radius of sphere

What is the Mathematica equivalent(s) of the Wolfram Alpha command to get the center and radius of a sphere given by an expression, e.g. (in Wolfram Alpha); ...
0
votes
0answers
20 views

Equation in ContourPlot3D requires Evaluate

Why does ContourPlot3D require Evaluate when Solve does not in the following example? ...
1
vote
1answer
82 views

Having trouble plotting $y=\ln\left(T^{3/2}\right)$ and $y=\dfrac{1}{k_B T}$ on the same graph [closed]

Originally, I simply wanted a way to plot $\ln(T^{3/2})$ versus $\dfrac{1}{k_B T}$ But all that appeared was this: ...
1
vote
0answers
65 views

What is … and :? [duplicate]

Reading Maeder's The Mathematica Programmer and in section 4.6 I am interested in the following line: ...
0
votes
1answer
86 views

correct use of the command FindInstance

I have tried to solve this system for numbers that go from 1 to 10 non-repeated integers, this occurs to me ...
2
votes
0answers
77 views

Problem with writing simplified commands [closed]

I would like to know how I can learn to write a complicated command with syntax like the one below. I might know each one separately, but I can not combine them or know the pattern which works for ...
1
vote
1answer
44 views

Define trace-like function (e.g. cyclically invariant) involving operators without built-in meaning

I am interested in defining a function, say $\mathrm{Tra}$, that imply operators without build-in meaning, say it involves products with the $\cdot$ (Esc . Esc), ...
3
votes
2answers
53 views

Define the behavior of operators without built-in meaning

I need an operation $\tilde{}$ that lifts another operation (for example, the sum, but this does not have to be limited to real numbers) in the sense that $\widetilde{ (x \oplus y)} = \tilde x + \...
0
votes
1answer
24 views

What is the general behavior of the “enter” character, and why does the specific behavior differ in these four situations?

I am trying to understand the exact behavior of the "enter" character in Mathematica. (I am not even sure what to call it: perhaps it is really the carriage return or newline character, which is input ...
0
votes
1answer
30 views

How to reverse the axes in the following way?

Could you please tell me whether (and how) it is possible to make the redesign of the x axis in the plot? I have not found the relevant information in the documentation.
4
votes
2answers
95 views

Limit solution domain in Solve

How should you write the Solve command or another to give me solutions to this equation for example integers rationals Here are the equations: ...
3
votes
4answers
104 views

Interpreting an ODE solution from DSolve

I'm doing a project where I need to solve an ODE. . I tried using DSolve to solve it, and it gave me an answer, but I'm unsure how to interpret it. The code I'm ...
0
votes
1answer
51 views

Correct syntax for tensor operators?

So I have an operator $A_0$ whose matrix representation is given by $$A_0 = \begin{pmatrix} 0 & -i \\ -i & 0\end{pmatrix},$$ and I also have two vector states $|0\rangle$ and $|1\rangle$ ...
1
vote
1answer
37 views

Issue with Compile for Complex Input/Output

I'm writing a Runge-Kutta algorithm for solving a system of coupled differential equations. My code works fine when defined as a module, but when I try to compile it, I get the following error: ...
2
votes
2answers
72 views

Isn't there a better way to display mathematical equations as labels, in Manipulate[ ] etc.?

I often want to output a mathematical equation in a text environment, and I find it very cumbersome and often the result is also not satisfactory. This example out of the "Advanced Manipulate ...
0
votes
2answers
110 views

Define derivative as a new function

I’m coding my first physics simulation in Mathematica, and have a problem. I want to do the following inside a single cell input. ...
2
votes
2answers
313 views

Why does 'Transpose[list]' work but 'Map[Transpose[#]&, list]' not when attempting to transpose a 2D-array list? [closed]

I define this list: list={{100,100},{200,200}} Taking the transpose like this works as intended: Transpose[list] Taking ...
0
votes
0answers
47 views

How do I set a control in an “If” statement?

I have the following lines of code: ...
1
vote
2answers
58 views

Problem with internal variable of a `Module` which returns the solution of an `NDSolve` command. y$25947 β†’ InterpilatingFunction[…]

I will try to give a minimal example of my problem. Say I define the following function, spitting out an NDSolve result, using ...
1
vote
0answers
22 views

Manipulating a system of equalities into particular form

newbie here just trying to learn the Mathematica syntax. I have a list of equations, some of them definitions, others relationships, as follows: ...
1
vote
2answers
45 views

Plotting a complete response to an oscillation; already have particular solution, not sure how to solve for constants in homogeneous solution

I am writing a code that plots an oscillator's response to a periodic excitation. The response consists of the following: x(t) = xh + xp where xh is the homogeneous solution and xp is the particular ...

1
2 3 4 5
…
16