ª10. Write a pseudocode segment to evaluate the expression $$z = \sum_{i=1}^{n} b_{i}^{-1} \prod_{j=1}^{i} a_{j}$$ where ($$a_1, a_2, \ldots, a_n$$) and ($$b_1, b_2, \ldots, b_n$$) are linear arrays containing given values.
Added by Nerea R.
Close
Step 1
The expression is $$z = \sum_{i=1}^{n} b_{i}^{-1} \prod_{j=1}^{i} a_{j}$$. This can be rewritten as $$z = \sum_{i=1}^{n} \frac{1}{b_{i}} \left( \prod_{j=1}^{i} a_{j} \right)$$. It involves an outer summation from $$i=1$$ to $$n$$ and an inner product from $$j=1$$ Show more…
Show all steps
Your feedback will help us improve your experience
Anand Jangid and 78 other Algebra educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Using summation and product notation, write mathematical expressions for the following pseudocode segments: $\begin{aligned} & \text { a. integer } i, n \text {; real } v, x \\ & \text { real array }\left(a_i\right)_{0 n} \\ & v \leftarrow a_0 \\ & \text { for } i=1 \text { to } n \\ & \quad v \leftarrow v+x a_i \\ & \text { end for }\end{aligned}$ $\begin{aligned} & \text { b. integer } i, n ; \text { real } v, x \\ & \text { real array }\left(a_i\right)_{0 n} \\ & v \leftarrow a_n \\ & \text { for } i=1 \text { to } n \\ & \quad v \leftarrow v x+a_{n-i} \\ & \text { end for }\end{aligned}$ $\begin{aligned} & \text { c. integer } i, n \text {; real } v, x \\ & \text { real array }\left(a_i\right) 0 n \\ & v \leftarrow a_0 \\ & \text { for } i=1 \text { to } n \\ & \quad v \leftarrow v x+a_i \\ & \text { end for }\end{aligned}$ $\begin{aligned} & \text { d. integer } i, n \text {; real } v, x, z \\ & \text { real array }\left(a_i\right)_{0-n} \\ & v \leftarrow a_0 \\ & z \leftarrow x \\ & \text { for } i=1 \text { to } n \\ & v \leftarrow v+z a_i \\ & z \leftarrow x z \\ & \text { end for }\end{aligned}$ $\begin{aligned} & \text { e. integer } i, n ; \text { real } v \\ & \text { real array }\left(a_i\right)_{0 n} \\ & v \leftarrow a_n \\ & \text { for } i=1 \text { to } n \\ & \quad v \leftarrow\left(v+a_{n-i}\right) x \\ & \text { end for }\end{aligned}$
Mathematical Preliminaries and Floating-Point Representation
EXERCISES 1.1
Create DAG representation and three – address code for the following C program. i = 1; s = 0; while ( i<= 10) { s = s+ a[i] [i]; i = i + 1; }
Shu N.
Consider the algorithm segment below: for i = 1 to n - 3 for j = n - 2i to n + 3i prod := prod ' a_ij csum := csum + a_ij sqr2 := sqr2 + a_ij^2 Analyze this program segment to find the total number of statements executed. Make sure to show all you steps clearly and completely, including any appropriate inner/outer loop analysis. Your final answer should be a formula, S_n, for the total number of executed statements (where n is the input size). For reference, here are a couple of formulas likely to be useful in your calculations.
Likhit G.
Recommended Textbooks
Elementary and Intermediate Algebra
Algebra and Trigonometry
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD