## How do I save a matrix in an intermediate step of ...

I am working on an iterative code where I need to save a matrix in an intermediate step. My code is long and it uses a separate data file. So, I am trying to state my problem taking a simple example.

At first, I define a column matrix A0. Using A0, I do some calculations and test some conditions.
In the next step, I want  to do similar calculations and test some conditions but this time by changing the first element of A0. For the purpose of later use, I need to save the matrix A0 in its original form. I am trying to use the following method but both A0 and A1 (modified A0) turn out to be same.

> restart;
> n := 3;
> A0 := Matrix(n, 1, 1);
> #Do some calculation with A0
> A1 := A0;
> A1[1, 1] := A1[1, 1]+.1*A1[1, 1];
> A1;
> print(A0, A1);

This might be because I set A1:=A0 in the third line. But how do I save A0 in its original form?

## Solving with HPM...

Hi everyone. I'm going to solve a problem of an article with hpm. well I wrote some initial codes(I uploaded both codes and article). but now I face with a problem. I cant reach to the correct plot that is in the article. could you please help me???

(dont think I am lazy ;))) I found f and g (by make a system with A1 and B1 and solve it i found f[0] and g[0], with p^3 coefficient in A-->f[1] and then with B2 I foud g[1]) and their plot was correct. but the problem is theta and phi and their plots :(( )

Project.mw

2.pdf   this is article

 > restart;
 > lambda:=0.5;K[r]:=0.5;Sc:=0.5;Nb:=0.1;Nt:=0.1;Pr:=10;
 (1)
 > equ1:=diff(f(eta),eta\$4)-R*(diff(f(eta),eta)*diff(f(eta),eta\$2)-f(eta)*diff(f(eta),eta\$2))-2*K[r]*diff(g(eta),eta)=0; equ2:=diff(g(eta),eta\$2)-R*(diff(f(eta),eta)*g(eta)-f(eta)*diff(g(eta),eta))+2*K[r]*diff(f(eta),eta)=0; equ3:=diff(theta(eta),eta\$2)+Pr*R*f(eta)*diff(theta(eta),eta)+Nb*diff(phi(eta),eta)*diff(theta(eta),eta)+Nt*diff(theta(eta),eta)^2=0; equ4:=diff(phi(eta),eta\$2)+R*Sc*f(eta)*diff(phi(eta),eta)+diff(theta(eta),eta\$2)*(Nt/Nb)=0;
 (2)
 > ics:= f(0)=0,D(f)(0)=1,g(0)=0,theta(0)=1,phi(0)=1; f(1)=lambda,D(f)(1)=0,g(1)=0,theta(1)=0,phi(1)=0;
 (3)
 > hpm1:=(1-p)*(diff(f(eta),eta\$4)-2*K[r]*diff(g(eta),eta))+p*(diff(f(eta),eta\$4)-R*(diff(f(eta),eta)*diff(f(eta),eta\$2)-f(eta)*diff(f(eta),eta\$2))-2*K[r]*diff(g(eta),eta))=0; hpm2:=(1-p)*(diff(g(eta),eta\$2)+2*K[r]*diff(f(eta),eta))+p*(diff(g(eta),eta\$2)-R*(diff(f(eta),eta)*g(eta)-f(eta)*diff(g(eta),eta))+2*K[r]*diff(f(eta),eta))=0; hpm3:=(1-p)*(diff(theta(eta),eta\$2))+p*(diff(theta(eta),eta\$2)+Pr*R*f(eta)*diff(theta(eta),eta)+Nb*diff(phi(eta),eta)*diff(theta(eta),eta)+Nt*diff(theta(eta),eta)^2)=0; hpm4:=(1-p)*(diff(phi(eta),eta\$2)+diff(theta(eta),eta\$2)*(Nt/Nb))+p*(diff(phi(eta),eta\$2)+R*Sc*f(eta)*diff(phi(eta),eta)+diff(theta(eta),eta\$2)*(Nt/Nb))=0;
 (4)
 > f(eta)=sum(f[i](eta)*p^i,i=0..1);
 (5)
 > g(eta)=sum(g[i](eta)*p^i,i=0..1);
 (6)
 > theta(eta)=sum(theta[i](eta)*p^i,i=0..1);
 (7)
 > phi(eta)=sum(phi[i](eta)*p^i,i=0..1);
 (8)
 > A:=collect(expand(subs(f(eta)=f[0](eta)+f[1](eta)*p,g(eta)=g[0](eta)+g[1](eta)*p,hpm1)),p);
 (9)
 > A1:=diff(f[0](eta),eta\$4)-2*K[r]*(diff(g[0](eta),eta))=0; A2:=diff(f[1](eta),eta\$4)-2*K[r]*(diff(g[1](eta),eta))-R*(diff(f[0](eta),eta))*(diff(f[0](eta),eta\$2))+R*f[0](eta)*(diff(f[0](eta),eta\$2))=0;
 (10)
 > icsA1:=f[0](0)=0,D(f[0])(0)=1,g[0](0)=0,f[0](1)=lambda,D(f[0])(1)=0,g[0](1)=0; icsA2:=f[1](0)=0,D(f[1])(0)=0,g[1](0)=0,f[1](1)=0,D(f[1])(1)=0,g[1](1)=0;
 (11)
 > B:=collect(expand(subs(f(eta)=f[0](eta)+f[1](eta)*p,g(eta)=g[0](eta)+g[1](eta)*p,hpm2)),p);
 (12)
 > B1:=diff(g[0](eta),eta\$2)+2*K[r]*(diff(f[0](eta),eta))=0; B2:=diff(g[1](eta),eta\$2)+2*K[r]*(diff(f[1](eta),eta))-R*(diff(f[0](eta),eta))*g[0](eta)+R*f[0](eta)*(diff(g[0](eta),eta))=0;
 (13)
 > icsB1:=f[0](0)=0,D(f[0])(0)=1,g[0](0)=0,f[0](1)=lambda,D(f[0])(1)=0,g[0](1)=0; icsB2:=f[1](0)=0,D(f[1])(0)=0,g[1](0)=0,f[1](1)=0,D(f[1])(1)=0,g[1](1)=0;
 (14)
 > C:=collect(expand(subs(theta(eta)=theta[0](eta)+theta[1](eta)*p,phi(eta)=phi[0](eta)+phi[1](eta)*p,f(eta)=f[0](eta)+f[1](eta)*p,hpm3)),p);
 (15)
 > C1:=diff(theta[0](eta),eta\$2)=0; C2:=diff(theta[1](eta), eta, eta)+Pr*R*f[0](eta)*(diff(theta[0](eta), eta))+Nb*(diff(phi[0](eta), eta))*(diff(theta[0](eta), eta))+Nt*(diff(theta[0](eta), eta))^2=0;
 (16)
 > icsC1:=theta[0](0)=1,theta[0](1)=0; icsC2:=f[0](0)=0,D(f[0])(0)=1,f[1](1)=0,D(f[1])(1)=0,theta[1](0)=0,theta[1](1)=0,phi[0](0)=0,phi[0](1)=0;
 (17)
 > E:=collect(expand(subs(theta(eta)=theta[0](eta)+theta[1](eta)*p,phi(eta)=phi[0](eta)+phi[1](eta)*p,f(eta)=f[0](eta)+f[1](eta)*p,hpm4)),p);
 (18)
 > E1:=diff(phi[0](eta),eta\$2)+Nt*(diff(theta[0](eta),eta\$2))/Nb=0; E2:=diff(phi[1](eta),eta\$2)+Nt*(diff(theta[1](eta),eta\$2))/Nb+R*Sc*f[0](eta)*(diff(phi[0](eta),eta))=0;
 (19)
 > icsE1:=phi[0](0)=1,phi[0](1)=0; icsE2:=f[0](0)=0,D(f[0])(0)=1,f[1](1)=0,D(f[1])(1)=0,theta[1](0)=0,theta[1](1)=0,phi[1](0)=0,phi[1](1)=0;
 (20)
 >

Project.mw

## Sum vs expanded form...

N:=3;

sum1 := lcm(N, 0)+lcm(N, 1)+lcm(N, 2)+lcm(N, 3);

sum2 := sum(lcm(N, k), k = 0 .. N);

Why is sum2 wrong?

Regards,

## Problem with HPM...

Hi everyone.

I'm going to solve a problem with HPM in Maple. I wrote some initial codes but now I'm confused becouse of P^0 coefficients in A1 and B1. I mean I can't reach to f0 and g0.

I upload that file. these are codes that i typed. could you please help me how can I reach to them(f0 & g0)?

http://www.filehosting.org/file/details/573095/Maple%20Project+.mw

## How to solve this PDE problem?...

 >
 >
 >
 >
 (1)
 >
 >
 >
 (2)
 >
 (3)
 >
 >
 >

hai All,

i have problem to soilve pde in the maple

can anyone suggest / idea to solve in maple?

## Why are args being changed to integers?...

The following code is part of my attempt to answer the recent Question about the bifurcation of the map f:= x-> exp(x^2*(a-x)). Two very weird things are happening. They can be seen by applying trace to f. The first is that the input argument to f seems to be changed to a very large integer. The second is that for some real values of a and x, I get imaginary results from this obviously real-valued function. Why are these things happening?

 > restart:
 > f:= x-> exp(x^2*(a-x)):
 > trace(f):
 > Iterate:= proc(a, x0:= 1., n:= 2000) local A:= hfarray(1..n, [x0]), f:= subs(:-a= a, eval(:-f));                #evalhf(           proc(f, A, n)           local k;                for k from 2 to n do A[k]:= f(A[k-1]) end do           end proc           (f, A, n);      #);      evalf[4]~(convert(A[1000..], set)) end proc:
 > Iterate(1.05);
 {--> enter f, args = 4607182418800017408
 <-- exit f (now in unknown) = 4607413323290551347} {--> enter f, args = 4607413323290551347
 <-- exit f (now in unknown) = 4607169774561176020} {--> enter f, args = 4607169774561176020
 > Iterate(.75);
 {--> enter f, args = 4607182418800017408
 <-- exit f (now in unknown) = HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I} Error, (in unknown) unable to store 'HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I' when datatype=float[8]
 >

## Zeros of a partial sum of Riemann zeta...

Hi!

In a paper due to Borwein

http://www.cecm.sfu.ca/personal/pborwein/PAPERS/P172.pdf

it is shown a (very beautiful) graph of the zeros of a partial sum of the Zeta-Riemann, where he indicates that the plot is "the normalized zeros of the 5th partial sum of the Zeta function". Somebody know how one can plot this with Maple?

Thank you!

✐♦❝❄t✉⑥♠❧❄❞❢❤❡⑦⑧❛❋⑨⑤⑦⑧❛✯ts❝⑩❦✑❝❄❜❚qs❴❇❛ ✈❇❜❶q✉❴❷♥♦❧❄t✇q✉❤❡❧❄❞★❦sr❇⑥✤❝❄❜✫qs❴❇❛❹❸✫❤❡❛⑧⑥✜❧❺✐❇✐❻⑦⑧❛⑧q✉❧❈❼❽❜❀r❇✐♦♣✒qs❤❡❝❄✐

## Why Unexpected Lack of Output?...

Here is my Maple 16 code:

I expected to get outuput

a [a,b,c]

a [a,c,b]

But I get no output.

Why?

## How to type in a procedure...

Every time I try to type in a procedure I get the error:

Error, unterminated procedure

immediately after typing in the first line.  How can I type in the remaining lines of my procedure?

Note:  in maple 7 (years ago) I never had this problem.

## Error when using sum...

Hi everyone. This problem is driving me nuts. I'm pretty sure it's a glitch but I'm not sure how to solve it. I'm trying to do some data analysis with Maple:

(as a side note, even if I remove the for loop but don't execute the restart command the error remains, however if I get rid of the for loop and execute the restart command it is fine.)

Any help would be greatly appreciated. As it stands this is really driving me insane.

## Issue with exporting to PDF ...

We are running Maple16 in a virtual lab setup using Citrix, when exporting to PDF and saving the file to the local machine the PDF comes out as a 0kb file and the PDF is corrupt.  Has anyone else had an issue like this before?

## Inverse function in restricted domain...

Hello,

I've tried to find the solution to my problem, but none of my attempts was succesful.

I have a function which is one-to-one in a particular domain which I am interested in. I would like to get the inverse function of it only in this domain. Here is my function and plot for xp=0..10000:

x := xp-> (-1)*720.5668720*sinh(0.2043018094e-3*xp-0.8532729286)+84952.59423+4.014460003*10^5*arcsinh(0.1219272144e-1*sinh(0.2043018094e-3*xp-0.8532729286)-0.2032498888)

I would appreciate any help,

Iza

## Problem with isolve...

Hello everyone,

I have some problems with the "isolve" command on Maple. I am trying to solve for integer a very easy system of equations. When I type the commands

restart;

n := 2;
isolve({sum(a[k], k = 1 .. n)-1 = 1}, d)

I get the expected {a[1] = 2-d, a[2] = d}. However, if I add conditions a[1],a[2] >= 0, that is the commands

restart;
n := 2;
isolve({ge(a[1], 0), ge(a[2], 0), sum(a[k], k = 1 .. n)-1 = 1}, d)

I get the warning "Warning, solutions may have been lost". What am I doing wrong? Is there a way to get Maple to give me the possible values?

David

## Derivative of functions with constants...

Hi everyone. Please excuse me in advance, as I am new on this website and to Maple.

So I am using Maple 16 and I want it to give me the derivative of a function that has constants in it, for example f(x)=(x-a)(x-b). I wrote the (probably stupid) commands on Maple:

> f(x):=(x-a)(x-b);

> diff(f(x), x);

but the result is not the expected (2x-a-b), but rather (D(x))(x-b)-(D(a))(x-b). What would be the right things to write to get what I need?

David

## How to map a piecewise?...

Hello,

I use a map() command to get the values of function for each element of vector. Here is an example of a simple task:

restart:

A:=[1,2,8];

f1:=x->2*x;
f1_table_A:=Vector([map(f1,A)]);

I would like to do the same with piecewise function but it doesn't work. Here is an example:

restart:
with(plots):
f:=2*x:
g:=x^2:

h:=x->piecewise( 0<=x and x<= 5, f, 5<x and x <= 10, g ) ;
A:=[1,2,8]:
h_table_A:=map(h,A):

Is it possible to work with piecewise function? Maybe someone has an idea how to do it in different way?

Kind regards,

Iza

 1 2 3 4 5 6 7 Last Page 2 of 36
﻿