How to solve an ecuation without symbolic variables?

2 ビュー (過去 30 日間)
David
David 2022 年 12 月 7 日
コメント済み: John D'Errico 2022 年 12 月 7 日
Hi! This is related for a college assignment. My code is about integral aproximation, and after i got that, i'm asked to find a 'c' in [a,b] that satisfies the mean value theorem for integrals, so, in this case i have the option of solving the equation, or, going for the inverse of the input function. The problem here is that we have a handicap: We can't use symbolic variables, so i looked through the documentation, and i didn't anything useful. So, there is a way to do that without syms? Thanks beforehand <3
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2022 年 12 月 7 日
What exactly is the problem? Please mention the actual problem and your code as well.
David
David 2022 年 12 月 7 日
Actually, John solved it. Thanks for the disposition <3

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2022 年 12 月 7 日
編集済み: John D'Errico 2022 年 12 月 7 日
I won't do homework. But I'll give you a hint or two.
First, what does the mean value theorem tell us for integrals. It says that for a CONTINUOUS function f, the AVERAGE value of a function over an interval is the same as the value of the function at some point in that interval.
Can you perform a numerical integration of the function, using trapz? (OF COURSE YOU CAN.) Or you can do it more accurately using integral. Therefore, you can compute the average value of that function. No syms are needed in either case.
Next, can you find the value of x that yeild the necessary point? Of COURSE YOU CAN! (HINT: use fzero.) If you don't want that, then you can use any other solver you wish, even bisection would work.
  2 件のコメント
David
David 2022 年 12 月 7 日
Thanks for the answer! Actually, on the first version of the code i did that, i used fzero into the original function, minus the approximation of f(c). Anyways, probably i'll need that answer for a remote future, because i don't know why, but my teacher will keep the handicap. As i said before, thank you so much. <3
John D'Errico
John D'Errico 2022 年 12 月 7 日
Teachers can be such a pain in the neck. :)
Honestly, I love the ability to use syms. But sometimes I think people can fall too much in love with them, and forget how to do numerical computations, or never learn those skills. So it can be a good thing to force students to use mathematics from both sides of the fence.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by