# Symbolic integration has 3 solutions based on integration variable range, how to extract one of these?

11 visualizzazioni (ultimi 30 giorni)
Jason Oakley il 17 Feb 2024
Commentato: Jason Oakley il 17 Feb 2024
r is the integration variable. The integration is:
and the result is:
size(mom_2) = 1 1
Question: how do I access each of these three possible solutions?
For example, I would like to use (50/49)*pi*U_0^2 in further calculations. Thanks ahead of time!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Paul il 17 Feb 2024
mom_2 =
One approach that just extracts the case you want
c = children(mom_2)
c = 3×2 cell array
case1 = c{1,1}
case1 =
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Jason Oakley il 17 Feb 2024
Awesome response, and so quick too!

Accedi per commentare.

### Più risposte (1)

John D'Errico il 17 Feb 2024
Or do this:
mom_2 =
ans =
Note that it resolves the three cases into 1.
##### 5 CommentiMostra 3 commenti meno recentiNascondi 3 commenti meno recenti
Paul il 17 Feb 2024
It's usually better to use assume before calling int to give it some help. In this case, if R>0, we'd try
mom_2 =
Not sure why that didn't work. Instead, we can do
syms rho
assume(rho,'positive')
mom_2 =
mom_2 =
Jason Oakley il 17 Feb 2024
Yes, that is a good tip and now this looks like the cleanest solution

Accedi per commentare.

### Categorie

Scopri di più su Solvers in Help Center e File Exchange

R2023b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by