determination of e^x using Taylor series

조회 수: 2 (최근 30일)
Meshari Alqahtani
Meshari Alqahtani 2018년 9월 6일
댓글: Steven Lord 2023년 2월 1일
hello, i'm new with matlab. i want to solve this equation by using matlab A=B*e^(0.2356X1+0.1869X2+0.0969X3) where A=1e8 and B=1e6 how can i find X1, X2, and X3 values ?
thanks

채택된 답변

Dimitris Kalogiros
Dimitris Kalogiros 2018년 9월 6일
clear; clc;
syms A B x_1 x_2 x_3
syms a_1 a_2 a_3
%definition of equation
myEq= A==B*exp(a_1*x_1+a_2*x_2+a_3*x_3)
% solve equation.
% choose one variable and consider the others as parameters
% which taking arbitrary values
mySol=solve(myEq, x_1 )
% replace the values of parameters
A=exp(8); B=exp(6);
a_1=0.2356; a_2=0.1869; a_3=0.0969;
subs(mySol)
If you run the script:

추가 답변 (3개)

Meshari Alqahtani
Meshari Alqahtani 2018년 9월 6일
Dimitris, thank you for answering my question but why you use the A=exp(8); B=exp(6); what are the 8 and 6 ?
  댓글 수: 3
Meshari Alqahtani
Meshari Alqahtani 2018년 9월 6일
got it. thanks
Meshari Alqahtani
Meshari Alqahtani 2018년 9월 6일
it mean 10^8

댓글을 달려면 로그인하십시오.


Meshari Alqahtani
Meshari Alqahtani 2018년 9월 6일
편집: Walter Roberson 2018년 9월 6일
Dimitris,
how can i get the value of the X1, X2, and X3 as number ?and i just wanna rewrite the equation for you again, because i confused you with exponantial and the e power.
A = B*exp(0.2356X1+0.1869X2+0.0969X3)
where:
A=1x10^8
B=1x10^6
does matlab can solve this problem maybe with Taylor series or any loop method to find the X values as numbers.
thank you again
  댓글 수: 5
Torsten
Torsten 2018년 9월 7일
Did you read Walter's comment ? It answers your question.
Walter Roberson
Walter Roberson 2018년 9월 7일
taylor series is useless for this purpose.
If you are working over real numbers, there are zero solutions if A/B is negative, and there are an infinite number of solutions otherwise. You can choose random values for any two of the three values and directly calculate the third value.
For example,
x12 = randn(2,1) .* rand(2,1) .* 10000; %about +/- 30000-ish
X1 = x12(1); X2 = x12(2);
X3 = (9.4851 - 0.2356*X1 - 0.1869*X2) ./ 0.0969;
%cross check
0.2356*X1 + 0.1869*X2 + 0.0969*X3
In the test I just did, the result of the cross-check was 9.48509999999987 instead of 9.4851 "exactly", a difference of 1.24344978758018e-13 . You will not generally be able to get exact solutions due to floating point round-off. You could reduce the discrepancy by reducing the range of random values used.

댓글을 달려면 로그인하십시오.


Apisara
Apisara 2023년 2월 1일
Find percent(relative) errors of approximating e^x using Taylor series expansions with n=0,1,2,3,4 at x=5
  댓글 수: 1
Steven Lord
Steven Lord 2023년 2월 1일
This is not an answer to the original question. You should ask it as a separate question using the Ask button at the top of this page.
But since this sounds like a homework assignment, when you ask that separate question please show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by