Hidden variabile in functions contaning integrals

Hidden variabile in functions contaning integrals - Messages

#1 Posted: 5/12/2020 4:10:00 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Hello everyone,
I would like to solve a system of two equations in two variables (x, y) which contain defined integrals with other two variables (t, z for example).

The functions seem to work properly, but why does Smath also recognize as unknowns the fictitious variables into the integrals?
I can't solve the system....


Thanks.

Prova funzione.sm (9 KiB) downloaded 85 time(s).
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#2 Posted: 5/12/2020 5:11:08 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I can't solve the system....


As simple as demonstrated !

Prova funzione.sm (6 KiB) downloaded 70 time(s).

#3 Posted: 5/12/2020 10:14:57 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1675 posts.

Group: User

Hi. SMath can't handle integrals in symbolic form. You don't have a "true" system of equations, because t and z are dummy variables, and Unknowns badly returns them as it. Using maple you can see what you actually have.

Clipboard01.jpg

Best regards.
Alvaro.
#4 Posted: 5/13/2020 2:01:05 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Thanks to both, but I'm dealing with a more complex case:
Forum example.sm (48 KiB) downloaded 79 time(s).

As you can see, I know the solution of the system from a textbook example made with Mathcad: the single variable equation works well (apart the fact I've to input a very short range of solution...), but for the system of two eqn there is an errorro referring to a matrix...

Can anyone help me?
Thanks in advance.

PS: I know Jean doesn't like the unit usage, but it's very useful for making more general spreadsheets!
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#5 Posted: 5/13/2020 7:38:55 PM
Alvaro Gavilán

Alvaro Gavilán

25 likes in 68 posts.

Group: User

Hope this solves your problem: (declare the boundaries)

declare.png

Just for my curiosity, are you obliged by your codes (and which) to use the parabola-rectangle diagram?

Regards,

Alvaro
1 users liked this post
Alvaro Diaz Falconi 5/14/2020 4:18:00 PM
#6 Posted: 5/14/2020 7:36:49 AM
Davide Carpi

Davide Carpi

1417 likes in 2873 posts.

Group: Moderator

It is a know issues/beahvior of Unknowns; I have plans to improve it although isn't easy to provide something generic and reliable.

Wrote

Just for my curiosity, are you obliged by your codes (and which) to use the parabola-rectangle diagram?



Italian code NTC2018 probably, it allows to use different diagrams.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Posted: 5/14/2020 10:20:30 AM
Alvaro Gavilán

Alvaro Gavilán

25 likes in 68 posts.

Group: User

Thank you Davide, now I have dowloaded/read the NTC2018, it looks like EC2-1.1.
#8 Posted: 5/15/2020 6:30:43 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Wrote

Hope this solves your problem: (declare the boundaries). Just for my curiosity, are you obliged by your codes (and which) to use the parabola-rectangle diagram?
Regards,
Alvaro



No, I'm not obliged to use the parabola-rectangle diagramma for the ULS.

Wrote

Your system is over-killed from gyzmas [subscripts] and from carrying units at the design stage. You have J, N in the solve bloc. Smath is not a clone of the crappy PTC Mathcad.



Thanks. I can remote units before defining the functions, but what are the subscript-related issues?

Wrote

Thank you Davide, now I have dowloaded/read the NTC2018, it looks like EC2-1.1.



Yes, the Italian code is very similar to Eurocodes, also for the design of structures made with material other than concrete.
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#9 Posted: 5/16/2020 6:43:55 AM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

I purged units in function definitions: Forum example w-o units.sm (54 KiB) downloaded 68 time(s).

Now I have three different errors:
  • Maxima couldn't reduce functions to polynomials;
  • roots founds 2 equations with 3 variables;
  • FindRoots I do not understand.


I think now I'm closer to the solution. Any other suggest?

PS: sometimes I used a while loop to solve single equations, but I've some desing difficulties with 2 variables...
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#10 Posted: 5/16/2020 10:32:03 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

Old school. See AlgLib 3.1x.

File not found. File not found.

2020-05-16_19-02-33.png
Russia ☭ forever, Viacheslav N. Mezentsev
2 users liked this post
SteelCat 5/16/2020 1:31:00 PM, frapuano 5/16/2020 5:00:00 PM
#11 Posted: 5/16/2020 1:41:45 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Wrote

Old school. See AlgLib 3.1x.



Many thanks Viacheslav, your NL solver found the solution in few seconds! Forum example w-o units_2.sm (48 KiB) downloaded 64 time(s).

Now I'll test it in a more complex engineering problem
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
1 users liked this post
sergio 5/16/2020 3:35:00 PM
#12 Posted: 5/16/2020 3:55:00 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

I purged units in function definitions: Forum example w-o units.sm (54 KiB) downloaded 68 time(s).

Now I have three different errors:

  • Maxima couldn't reduce functions to polynomials;
  • roots founds 2 equations with 3 variables;
  • FindRoots I do not understand.


I think now I'm closer to the solution. Any other suggest?

PS: sometimes I used a while loop to solve single equations, but I've some desing difficulties with 2 variables...



I think maxima Solve() can't handle functions containing conditional statements. Using boolean expressions won't help, as these aren't translated to maxima.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
SteelCat 5/16/2020 5:07:00 PM
#13 Posted: 5/16/2020 5:04:58 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1675 posts.

Group: User

Wrote

...

I think maxima Solve() can't handle functions containing conditional statements. Using boolean expressions won't help, as these aren't translated to maxima.



Hi Martint. I guess that what you have in Maxima for handle conditionals is unit_step(x) = ( 0 if x <= 0 and 1 for x > 0 ).

Or can use U(x) = (1 + signum(x))/2 which takes U(0)=1/2.

I don't try to use it, but guess that both can be used for Solve, Integrate and Diff inside SMath calling Maxima.

Best regards.
Alvaro.
1 users liked this post
frapuano 5/17/2020 11:47:00 AM
#14 Posted: 5/17/2020 7:40:31 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Wrote

...

I think maxima Solve() can't handle functions containing conditional statements. Using boolean expressions won't help, as these aren't translated to maxima.



Hi Martint. I guess that what you have in Maxima for handle conditionals is unit_step(x) = ( 0 if x <= 0 and 1 for x > 0 ).

Or can use U(x) = (1 + signum(x))/2 which takes U(0)=1/2.

I don't try to use it, but guess that both can be used for Solve, Integrate and Diff inside SMath calling Maxima.

Best regards.
Alvaro.



Hi Alvaro, thanks for the unit_step() hint. Generally, charfun() is a more general approach to convert boolean expressions to 0 and 1. However, symbolic integration in maxima can't handle charfun(), whereas the unit_step() function is handled. See feature request SS-99.
.
Some testing shows that Solve() (maxima's solve()) doesn't handle step functions well. Perhaps there are some options or special packages to improve this, but it doesn't work out of the box. Handling of integrals with abs() and sign() is enabled by loading the package abs_integrate, which is done by default in the plugin, see the session log in the printout.

Here is an overview of integration of piecewise continuous functions (from the interactive handbook). Some of these are handled symbolically by maxima, some of them are returned unchanged and then handled by poor man's non-adaptive SMath numeric integrator.

For now, the sign() and abs() approaches work.

Section math piecewise.png
Section math piecewise.sm (30 KiB) downloaded 73 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#15 Posted: 5/23/2020 7:27:47 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Wrote

Wrote

Old school. See AlgLib 3.1x.



Many thanks Viacheslav, your NL solver found the solution in few seconds! Forum example w-o units_2.sm (48 KiB) downloaded 64 time(s).

Now I'll test it in a more complex engineering problem


Forum example w-o units_3.sm (52 KiB) downloaded 53 time(s).

Here a test with 3 equations: someting went wrong, because the solution is expected to be near the origin and function value in the origin is very large... I can't find a graphical solution in this case...

EDIT: Following AlgLib example, I'm not able to compute the Jacobian matrix. It seems the issues is due to inequalities in the integrand definition...
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#16 Posted: 5/26/2020 6:33:19 AM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Wrote

Wrote

Here a test with 3 equations: someting went wrong, because the solution is expected to be near the origin and function value in the origin is very large... I can't find a graphical solution in this case...


Your project is not visible:
1. NO units whatsoever, nowhere.
2. Visible values
3. NO subscript
As it looks, you seem seeking for the intersection of 2 double integral.
You may proceed like in real Engineering project, i.e:
1. Tabulate each double integral in matrix.
2. Unwrap each matrix in single vector, adjoin fake index.
3. Plot 2D to see intersection.
4. Interpolate, solve for more exact graphical solution.



Wrote

... subjective of visibility.

Integrate Compendium_17 DOUBLE Fourier CoC.sm (55 KiB) downloaded 63 time(s).



I do not well understand your suggestions... There are 3 double integrals with a functions of 3 variables.
However I compared the results of the previous design with those from a simple domain discretization (using the known solution), in a way to detect some input errors: no errors but the solver still does not work.

Forum discretization example.sm (123 KiB) downloaded 70 time(s).
Forum example w-o units_4.sm (79 KiB) downloaded 60 time(s)..

https://en.smath.com/forum/yaf_postst1775p2_AlgLib-3-1x.aspx : I see the solver deals also with 3 variables...

Any other suggested solver?
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#17 Posted: 5/26/2020 12:43:45 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

good news , the AlgLib solver works, but:
  • I'd improve the solution speed;
  • I still can't evaluate the Jacobian matrix.


I think the use of Jacobian would improve the efficiency (https://www.mathworks.com/help/optim/ug/nonlinear-least-squares-with-full-jacobian.html)
Also the use of some eval()...
Forum example w-o units_4-BIS.sm (83 KiB) downloaded 55 time(s).

Any suggestions?
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
#18 Posted: 5/27/2020 4:06:15 PM
Alvaro Gavilán

Alvaro Gavilán

25 likes in 68 posts.

Group: User

Hello SteelCat,

Could you please tell me what are the equations you want to solve (as I sincerely don't know about the Jacobian procedure and the AlgLib solver).

PR concrete.png


Nint = ?;
Mxint = ?;
Myint = ?;


I will give it a try, I understand that you are dealing with biaxial bending of a concrete column.. as I am working on my interaction volume these weeks, I think I could help you.

By the way, I am proceeding with the shoelace Gauss formula to obtain the compression volume of concrete (a discrete approach, not a continuous double-integral approach) and also with the R diagram for concrete (not P-R).

But I will try to find a solution for your equations (staying continuous).

Regards,

Alvaro

#19 Posted: 5/27/2020 4:23:32 PM
Alvaro Gavilán

Alvaro Gavilán

25 likes in 68 posts.

Group: User

Wrote

I purged units in function definitions:

#20 Posted: 5/27/2020 5:35:19 PM
SteelCat

SteelCat

3 likes in 47 posts.

Group: User

Wrote

good news , the AlgLib solver works, but:

  • I'd improve the solution speed;
  • I still can't evaluate the Jacobian matrix.


I think the use of Jacobian would improve the efficiency (https://www.mathworks.com/help/optim/ug/nonlinear-least-squares-with-full-jacobian.html)
Also the use of some eval()...
Forum example w-o units_4-BIS.sm (83 KiB) downloaded 55 time(s).

Any suggestions?



Forum example w-o units_4-BIS.sm (80 KiB) downloaded 67 time(s).

It seems that the issue was due to the Jacob() function: I defined manually the Jacobian matrix, but Smath still do not show me the result...
Physics is like sex. Sure, it may give some practical results, but that’s not why we do it. (R. Feynman)
  • New Posts New Posts
  • No New Posts No New Posts