Questions tagged [syntax]

Questions on the correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and _ characters, which are keyboard shortcuts for the Wolfram Language named functions Apply, Map, Slot, Function, and Blank.

Filter by
Sorted by
Tagged with
1
vote
1answer
30 views

list elements as indices

I have the list R: ...
2
votes
3answers
375 views

How can I solve a system of linear equations?

How can I solve this system of equations in Mathematica? ...
0
votes
0answers
54 views

An issue with ParallelTable

I have some function function[x_,y_,method_,distr_]:=NIntegrate[distr[x,y,z,t],{z,zmin[x,y],zmax[x,y]},{t,tmin[z,x,y],tmax[z,x,y]},Method->method] Here, ...
6
votes
1answer
63 views

Context Manipulation within Scoping Constructs

In the following the full context form of Test is not required as "Aaa`" is added to ...
0
votes
1answer
48 views

Parallel evaluation produces wrong result

Consider the following code: ...
1
vote
0answers
30 views

rule generalization-NCA algebra [duplicate]

How can I generalize the rule ...
0
votes
0answers
22 views

parallel computation fails

I have a code that evaluates matrix elements. It works correctly in sequential mode (one Kernel). It involves a custom function BariVi which is declared earlier and ...
1
vote
4answers
81 views

numerical values of coefficients

Consider the following output: x= (Sqrt[3/(2 (1 + Sqrt[11]/4))] b[0, π/3] - (1 + Sqrt[7/3]) b[(2 π)/3, (2 π)/3])/(4 Sqrt[2] 7^(1/4) Sqrt[1 + Sqrt[7]/4]) If i do <...
1
vote
1answer
39 views

Normal ordering of operators multiplied by scalars

I have the following code for normal ordering of two Boson operators $a(x),\,b(y)$: ...
1
vote
2answers
33 views

function changes upon condition

I have the function f[x_,y_]:=1/(Sin[x]+Sin[y]) which obviously becomes infinite for $x=\pi n, \;y=\pi n$ where $n\,\epsilon \, \mathbf{N}$. I want to give ...
2
votes
1answer
79 views

Empty graph when using parametric plot 3D

I want to plot a parametric 3D plot from the following ParametricNDSolve code: ...
1
vote
0answers
40 views

dot product of vectors with noncommutative elements

I came upon an interesting problem. Suppose you have three vectors $\psi=(a, b)$, $\phi=(c,d)$ such that their components do not commute: $ac\neq ca$, $bd \neq db$ etc. (in general the vectors may ...
1
vote
1answer
35 views

NonCommutativeMultiply syntax question

I define: ...
2
votes
1answer
39 views

NonCommutativeMultiply question- syntax question

if I define id as: id /: NonCommutativeMultiply[id, x_] := x id /: NonCommutativeMultiply[y_, id] := y then ...
-1
votes
0answers
26 views

NDSolve initial condition as argument of NMinimize

I need to numerically minimize a function that involves a numerical solution of an ODEs system. One of the initial conditions of the ODEs is a function of some parameters with respect to which I ...
1
vote
2answers
57 views

Better way to do a replacement to define a function

I have a long analytical process where I have defined a stand in function Int[] to act as a placeholder for either NIntegrate[] ...
1
vote
0answers
27 views

Variables with super/sub scripts

So I know how to create variable names with subscripts/superscripts at the end (using ctrl+_ etc), however, how would I use them in the middle of a variable name?
0
votes
1answer
58 views

Simplifying Kronecker Delta in Partial Derivative

I am a Mathematica beginner. I am trying to solve an economics optimisation problem by using the lagrangian method. So I formalised my problem in the following way: ...
3
votes
1answer
47 views

Probability Generating Function(s)?

I'm very new to Mathematica and I have started to use it since I have been tackling some Physics related problems(I'm an engineer by training). Specifically, I'm dealing with Master Equations and one ...
0
votes
0answers
39 views

Matrix, basis, vector syntax

I am in the beginning of learning tensors, basis and other linear algebra subjects and am having quite some difficulty using mathematica in regards creating such objects that mathematically work. Or ...
2
votes
0answers
32 views

Padding decimal output with ending zeros

I want to pad with ending zero and tried the following code ...
1
vote
1answer
139 views

Desktop vs. Cloud option, home plan vs. basic plan: syntax differences

I do not understand why the following simple expression is accepted using a browser (cloud option), but is not accepted using the installed software (desktop option) with the plan basic of Wolfram ...
0
votes
3answers
70 views

Composition of Maps

I want to create a composition of several lists. For example: ...
1
vote
1answer
71 views

Supplied equations not differential or integral equations of the given functions

I am trying to solve this differential equations and I have 2 initial conditions. However, mathematica doesn't seem to work. I get Solve::ifun and ...
0
votes
1answer
44 views

How to add the error indicator in table?

Consider some function function[mass_,lifetime_]:=NDSolve[{equations[mass,lifetime], initialconditions},functions,{t,t0,tmax}] Let us assume that there is some ...
4
votes
1answer
85 views

How to improve the solution of the following differential equation?

Consider a PDE $$ \tag 1 \frac{\partial f_{n}}{\partial t}- \frac{1}{2t}E\frac{\partial f_{n}}{\partial E} = 0 $$ I choose the initial condition $f_{n}(E, t_{0}) = e^{-E/T_{0}}$, where $T_{0}$ is some ...
0
votes
1answer
30 views

Reducing solutions from Solve to positive solutions

Consider the following lines; ...
2
votes
2answers
159 views

Unexpected Indeterminate result from evaluating a limit [closed]

Consider $\qquad \underset{h\to 0}{\text{lim}}\dfrac{\sqrt[4]{h+x}-\sqrt[4]{x}}{\sqrt{h+x}-\sqrt{x}}$ Here is what I get when I evaluate it Mathematica: When I calculate it by hand and in other ...
0
votes
1answer
45 views

WhenEvent doesn't work as expected when the condition is satisfied in the first step

I have noticed strange behavior of WhenEvent in the case where the body of WhenEvent is satisfied in the first step. For example, ...
0
votes
0answers
35 views

How to define function in Mathematica

I have a 3 by 3 symbolic matrix M(x,y,z). Question:1 First, I want to find its eigenvalues and eigenvectors. After that I want to make each eigenvalue and eigenvector a function of x,y, and z i.e. <...
1
vote
0answers
109 views

Solving the following system of integrodifferential equations: speed up of the code

Consider a system of equations $$ \begin{cases}\frac{\partial f(E,t)}{\partial t}-H[T_{\gamma},f(E,t)]E\frac{\partial f(E,t)}{\partial E} -I[f(E,t),E,T_{\gamma}(t)]=0, \\ \frac{\partial T_{\gamma}}{\...
5
votes
2answers
56 views

Are arbitrary expressions allowed as input arguments in Compile?

I made a typo when entering code for Compile. I thought it should have resulted in an error when the code was compiled, but it didn't. It did give an error when ...
1
vote
2answers
55 views

How to define a derivative of a function at some point?

Consider a function derivative[x_]:=D[Sin[x],x] When calling it with some argument, like derivative[2], instead of $\cos(x)$ it gives me $\partial_{2}\sin(2)$. Is ...
0
votes
2answers
61 views

Syntax error using Plot

Why is the error coming and what should I do to resolve it The code is ...
0
votes
0answers
41 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
76 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
34 views

Working with associations: summing

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

Working with associations: precomputing

Consider some association: ...
1
vote
3answers
106 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
49 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
33 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
50 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
76 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
39 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
65 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
44 views
2
votes
3answers
96 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
64 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
56 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
32 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
2 3 4 5
16