Mathematica Asked by leosenko on December 18, 2020

I am reading a paper on High Harmonics Generation (HHG) and a Lewenstein model The paper is here. I would like to reproduce some results but I am stuck at the following problem. I have:

$$p(tau_b,tau)=frac{e}{tau-tau_b}int_{tau_b}^tau {rm d}tau^{‘} A(tau^{‘}),,$$

where $A(tau)$ is vector potential (given).

The time of birth $t_b$ as a function of $tau$ is determined by solution of the algebraic equation:

$$p(tau_b,tau)-e , A(tau_b)=0$$

How should I approach solving such an equation. I was thinking:

```
A[t_] := -Sin[t];
τ = 0.5;
FindRoot[NIntegrate[A[t], {t, τb, τ}]/(τ - τb) -
A[τb] == 0, {τb, 1}]
```

But Mathematica keeps saying

```
t = τb is not a valid limit of integration
```

Maybe there is an error in my solution. But besides making it work with Mathematica specific approach, what would a more general numerical approach be for such a solution?

Thank you.

"`FindRoot`

first localizes the values of all variables, then evaluates `f`

with the variables being symbolic, and then repeatedly evaluates the result numerically" is written in the documentation in the Details and Options section.

The reason

```
A[t_] := -Sin[t]
τ = 0.5;
FindRoot[NIntegrate[A[t], {t, τb, τ}]/(τ - τb) - A[τb] == 0, {τb, 1}]
```

doesn't work is because it attempts to evaluate

```
NIntegrate[A[t], {t, τb, τ}]
```

symbolically which fails.

Using belisarius's solution

```
k[s_?NumericQ] := NIntegrate[A[t], {t, s, τ}]
FindRoot[k[τb]/(τ - τb) - A[τb] == 0, {τb, 1}]
```

works because `k[τb]`

can be evaluated symbolically simply giving back `k[τb]`

.

When numerical evaluation is applied the function definition is used enabling

```
NIntegrate[A[t], {t, s, τ}]
```

to be evaluated.

Answered by Jack LaVigne on December 18, 2020

As noted by Jack LaVigue, `FindRoot`

by default tries first to evaluate its first argument symbolically, which fails here. However, it is possible to instruct `FindRoot`

not to do so by employing the option `Evaluated -> False`

.

```
A[t_] := -Sin[t];
τ = 0.5;
FindRoot[NIntegrate[A[t], {t, τb, τ}]/(τ - τb) - A[τb] == 0, {τb, 1}, Evaluated -> False]
```

`FindRoot`

returns without error the not particularly interesting but correct answer `{τb -> 0.5}`

. With an initial guess of `2`

, it instead returns `{τb -> 2.0984}`

Answered by bbgodfrey on December 18, 2020

0 Asked on March 12, 2021 by crises

1 Asked on March 11, 2021 by jesper-johansson

2 Asked on March 11, 2021

0 Asked on March 11, 2021

1 Asked on March 11, 2021 by hosein-rahnama

1 Asked on March 10, 2021

boundary conditions differential equations finite element method

4 Asked on March 9, 2021 by matrix89

combinatorics graphics graphs and networks trees visualization

1 Asked on March 9, 2021

2 Asked on March 9, 2021 by abcderia

0 Asked on March 9, 2021 by marsupilami

0 Asked on March 9, 2021 by yousuf-soliman

0 Asked on March 9, 2021 by nazanin-variji

boundary condition at infinity boundary conditions differential equations equation solving symbolic

2 Asked on March 9, 2021 by kospall

1 Asked on March 9, 2021

Get help from others!

Recent Questions

Recent Answers

- Joshua Engel on Why fry rice before boiling?
- haakon.io on Why fry rice before boiling?
- Lex on Does Google Analytics track 404 page responses as valid page views?
- Jon Church on Why fry rice before boiling?
- Peter Machado on Why fry rice before boiling?

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir